Skip to content

🛡️ Sentinel: [HIGH] Fix global CRLF injection in HTTP headers#107

Merged
tomdesair merged 2 commits into
masterfrom
jules-12850832640110649913-688d6719
Jul 8, 2026
Merged

🛡️ Sentinel: [HIGH] Fix global CRLF injection in HTTP headers#107
tomdesair merged 2 commits into
masterfrom
jules-12850832640110649913-688d6719

Conversation

@tomdesair

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: CRLF Injection (HTTP Response Splitting) was possible when unsanitized user inputs or generic properties were placed into HTTP response headers (such as Upload-Metadata or Content-Disposition). This allowed malicious actors to inject arbitrary headers and potentially modify the response body payload by appending \r\n.
🎯 Impact: Attackers could manipulate server responses, launch XSS attacks, deface pages, or poison web caches by injecting fake or malicious headers.
🔧 Fix: Rather than addressing each affected header independently, the overarching TusServletResponse class was modified with a sanitizeHeaderValue method. This method automatically strips \r and \n characters from all header values when setHeader or addHeader is called, offering global CRLF protection.
✅ Verification: Ensure tests pass via mvn test. The new TusServletResponseCRLFTest verifies that CRLF characters injected into setHeader and addHeader are successfully stripped.


PR created automatically by Jules for task 12850832640110649913 started by @tomdesair

This commit introduces a robust, global defense against HTTP Response Splitting and CRLF Injection vulnerabilities.

Instead of patching individual endpoints and headers (such as Content-Disposition or Upload-Metadata) as they arise, `TusServletResponse.java` has been modified to intrinsically sanitize all outgoing header values by stripping carriage return (`\r`) and line feed (`\n`) characters before they are passed to the underlying HttpServletResponse wrapper.

The specialized `DownloadGetRequestHandlerCRLFTest.java` was removed and replaced with a broader `TusServletResponseCRLFTest.java` that covers `setHeader` and `addHeader` methods.
Additionally, `DownloadGetRequestHandler.java` was simplified slightly since the `TusServletResponse` now uniformly handles CRLF removal.

Co-authored-by: tomdesair <14034630+tomdesair@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coveralls

coveralls commented Jul 7, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 94.749% (-0.06%) from 94.813% — jules-12850832640110649913-688d6719 into master

@tomdesair

Copy link
Copy Markdown
Owner Author

@jules, can you run the code formatting step that is defined in the Maven pom.xml file? Or you can use the pre-commit hooks.

This commit introduces a robust, global defense against HTTP Response Splitting and CRLF Injection vulnerabilities.

Instead of patching individual endpoints and headers (such as Content-Disposition or Upload-Metadata) as they arise, `TusServletResponse.java` has been modified to intrinsically sanitize all outgoing header values by stripping carriage return (`\r`) and line feed (`\n`) characters before they are passed to the underlying HttpServletResponse wrapper.

The specialized `DownloadGetRequestHandlerCRLFTest.java` was removed and replaced with a broader `TusServletResponseCRLFTest.java` that covers `setHeader` and `addHeader` methods.
Additionally, `DownloadGetRequestHandler.java` was simplified slightly since the `TusServletResponse` now uniformly handles CRLF removal.

Co-authored-by: tomdesair <14034630+tomdesair@users.noreply.github.com>
@tomdesair tomdesair merged commit e32c2e5 into master Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants