Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo jacking protection and cleanups #1411

Merged
merged 4 commits into from
Jan 11, 2024
Merged

Conversation

Seldaek
Copy link
Member

@Seldaek Seldaek commented Jan 10, 2024

Replaces #1402

Copy link

composer.lock

Package changes

Package Operation From To About
phpstan/phpdoc-parser upgrade 1.24.2 1.25.0 diff

Dev Package changes

Package Operation From To About
phpstan/phpstan upgrade 1.10.39 1.10.55 diff
phpstan/phpstan-doctrine upgrade 1.3.43 1.3.54 diff
phpstan/phpstan-symfony upgrade 1.3.4 1.3.6 diff

Settings · Docs · Powered by Private Packagist

@Seldaek Seldaek requested a review from naderman January 10, 2024 15:01
@@ -33,6 +33,13 @@
use Composer\Util\HttpDownloader;
use DateTimeInterface;

enum PackageFreezeReason: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why defining it inline instead of making it autoloadable ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it belongs together with the class, and is much more readable to me than having tiny enum files lingering around, and there is no reason to use it without package instance, so the package class will be loaded when you need it.


public function translationKey(): string
{
return 'freezing_reasons.' . $this->value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to make those translations extractable, a solution would be to make a method returning a TranslatableMessage object (that you would still use in Twig by passing it to the trans filter), using a match() statement instead of concatenation (as dynamic keys cannot be extracted by the tooling)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks that's good to know but I don't really care about extractability here.

</div>
{% if package.isFrozen() %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be displayed only for package maintainers and admins (as done right now by being inside the {% if has_actions %}) or to all users ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should open it to everyone, I don't expect this to be too frequent anyway.. And it'd be valuable to see the warning for the gone packages.

@Seldaek Seldaek merged commit 5c7c82e into composer:main Jan 11, 2024
3 checks passed
@Seldaek Seldaek deleted the repojack branch January 11, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants