Repository navigation
fix: reject control bytes in header names - #1119
Open
rootsiemen wants to merge 1 commit into
Open
rootsiemen wants to merge 1 commit into
rootsiemen wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1117
RequestConverter::buildServerHeaders()validated header values for control bytes but not header names, so a control byte in a name (e.g.X-Foo\x01) was forwarded to the Symfony header bag and the$_SERVERkey, where it could not be matched by its normal name.HEADER_VALUE_CONTROL_CHARSmask used for values (per FAQ-027, masks stay literal byte sets; no new constant, so the benchmark-mask equality test is unaffected) and rejected withMalformedRequestException(HTTP 400), the same outcome as a control byte in a value.METHOD_REGEXnow anchors with\zinstead of$, so a method with a trailing newline no longer passes validation (the related item noted in the issue).testControlByteInHeaderNameThrowsMalformedRequestExceptiontotests/RequestConverterTest.phpand aCHANGELOG.mdentry under[Unreleased]Security.Note: this environment has no PHP runtime, so the PHPUnit suite and
bin/lint.shcould not be run locally here; CI verification is pending.