-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[HttpFoundation] Add #[IsSignatureValid]
attribute
#60395
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
[HttpFoundation] Add #[IsSignatureValid]
attribute
#60395
Conversation
4730169
to
c72ef83
Compare
src/Symfony/Component/Security/Http/EventListener/IsSignatureValidAttributeListener.php
Show resolved
Hide resolved
This is looking great @santysisi! I'll give it a more thorough review after 7.3 is released. |
c72ef83
to
85320cf
Compare
We could also consider adding an extra argument to the attribute called |
85320cf
to
c000b69
Compare
ready these 2 changes 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really great, nice work @santysisi!
c000b69
to
24fca48
Compare
24fca48
to
524b686
Compare
I believe the error is not relevant 🤔 |
src/Symfony/Component/Security/Http/Attribute/IsSignatureValid.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Attribute/IsSignatureValid.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/DependencyInjection/UriSignerLocatorPass.php
Outdated
Show resolved
Hide resolved
a7d8c95
to
1d8202c
Compare
Awesome, let's wait for some others to take a look. As I said, I think tagged services is the way to go but maybe someone has a different idea. |
1d8202c
to
d2ff216
Compare
I did not go over all comments, but for me it looks false this live inside The UriSigner I can use currently without any SecurityBundle / Security services, so from my point of view the attribute should work also without any security related service and be more part of the FrameworkBundle like the UriSigner service itself. |
d2ff216
to
35cbbc0
Compare
Hi 👋 First of all, thank you very much for your comment 😊 You're right. When I started working on this feature, I saw this new attribute as something similar to However, you're right that Thanks again for the comment! What do you think, @kbond? |
Yeah, this is a good point. I wonder if |
@kbond HttpKernel sounds good for me if I look at the attributes there: https://github.com/symfony/symfony/tree/7.4/src/Symfony/Component/HttpKernel/Attribute |
35cbbc0
to
0c3ec83
Compare
Moved the attribute to the |
#[IsSignatureValid]
attribute#[IsSignatureValid]
attribute
0c3ec83
to
5b0b74e
Compare
5b0b74e
to
c304021
Compare
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)] | ||
final class IsSignatureValid | ||
{ | ||
public readonly array $methods; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the phpdoc @var string[]
to properly document the public API
#[IsSignatureValid]
attribute#[IsSignatureValid]
attribute
c304021
to
b3a992d
Compare
Thank you @santysisi. |
… the `#[IsSignatureValid]` attribute (xabbuh) This PR was merged into the 7.4 branch. Discussion ---------- [HttpKernel] drop the ability to configure a signer with the `#[IsSignatureValid]` attribute | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT I would like to challenge the decision made in #60395 to support custom URI signers per usage of the new `#[IsSignatureValid]` attribute. I doubt that use cases for it are so wide-spread that we need to add support for it here. Commits ------- 7fafe69 drop the ability to configure a signer with the IsSignatureValid attribute
✨ New Feature:
#[IsSignatureValid]
AttributeThis attribute enables declarative signature validation on controller actions. It ensures that requests using specific HTTP methods are validated using
UriSigner
. If the signature is invalid, aSignedUriException
is thrown.✅ Usage Examples