Skip to content

Conversation

alamirault
Copy link
Contributor

Fix #19753

@rcsofttech85
Copy link
Contributor

rcsofttech85 commented May 8, 2024

you may consider changing your code to this...

    #[IsCsrfTokenValid(new Expression('"delete-item-" ~ args["post"].id'), tokenKey: 'token')]
    public function delete(Post $post): Response
    {
        // ... do something, like deleting an object
    }

post argument is mandatory in this case

@alamirault
Copy link
Contributor Author

You're right, updated

@OskarStark OskarStark force-pushed the 19753/dynamic-csrf branch from a9515fb to e0a49ba Compare May 10, 2024 07:30
@OskarStark
Copy link
Contributor

Thank you Antoine.

@OskarStark OskarStark merged commit f35eec7 into symfony:7.1 May 10, 2024
@alamirault alamirault deleted the 19753/dynamic-csrf branch May 10, 2024 12:42
@yguedidi
Copy link
Contributor

Thank you @alamirault

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security] Add support for dynamic CSRF id with Expression in `#[IsCsrf…
6 participants