🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@xabbuh
Copy link
Member

@xabbuh xabbuh commented Oct 11, 2025

Q A
Branch? 8.0
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT


$method = strtoupper($method);

if (\in_array($method, ['GET', 'HEAD', 'CONNECT', 'TRACE'], true)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if we should forbid (in 7.4) listing any of these methods in $allowedHttpMethodOverride

Copy link
Member

Choose a reason for hiding this comment

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

And return a 400?
I wondered the same and thought: what for in the end?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of throwing an exception if setAllowedHttpMethodOverride() is called with a list of methods of which one or more are matching this list.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yes, that'd work for me, to spot misconfigs earlier

Copy link
Member Author

Choose a reason for hiding this comment

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

see #62065

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit b6d7b24 into symfony:8.0 Oct 12, 2025
9 of 10 checks passed
@xabbuh xabbuh deleted the pr-61949 branch October 12, 2025 09:58
nicolas-grekas added a commit that referenced this pull request Oct 14, 2025
…rride of GET, HEAD, CONNECT and TRACE (xabbuh)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle][HttpFoundation] forbid HTTP method override of GET, HEAD, CONNECT and TRACE

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | see #62042 (comment)
| License       | MIT

Commits
-------

1b79380 forbid HTTP method override of GET, HEAD, CONNECT and TRACE
@fabpot fabpot mentioned this pull request Oct 27, 2025
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.

3 participants