FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

security: validate header names and values to prevent CRLF injection by insaf021 · Pull Request #2184 · googleapis/google-http-java-client · GitHub

security: validate header names and values to prevent CRLF injection - #2184

Open
insaf021 wants to merge 1 commit into
googleapis:mainfrom
insaf021:security/crlf-header-validation
Open

security: validate header names and values to prevent CRLF injection#2184
insaf021 wants to merge 1 commit into
googleapis:mainfrom
insaf021:security/crlf-header-validation

Conversation

Copy link
Copy Markdown

HttpHeaders#addHeader now rejects header names/values containing CR (\r) or LF (\n),
throwing IllegalArgumentException on CRLF injection attempts — prevents HTTP Header
Injection and Response Splitting.

Changes

  • HttpHeaders.java: added CRLF validation in addHeader() after computing stringValue.

  • HttpHeadersTest.java: added testSerializeHeaders_crlfInjectionInName and
    testSerializeHeaders_crlfInjectionInValue.

  • Opened an issue before writing code — Core: Validate header names and values to prevent CRLF injection #2180

  • Tests and linter pass

  • Code coverage does not decrease (2 new tests added)

  • Docs updated

Fixes #2180 ☕️

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

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core: Validate header names and values to prevent CRLF injection

1 participant


Back | FazBrowse Home | New Git URL