Repository navigation
Conversation
When an environment variable containing `\r\n` is expanded into an HTTP response header via `${VAR}`, it could cause HTTP response splitting. This commit introduces `sanitizeHeaderValue` to strip control characters like CRLF during the `Render()` phase, preventing this vulnerability.
Co-authored-by: tejjasdev <213147578+tejjasdev@users.noreply.github.com>
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
When an environment variable containing `\r\n` is expanded into an HTTP response header via `${VAR}`, it could cause HTTP response splitting. This commit introduces `sanitizeHeaderValue` to strip control characters like CRLF during the `Render()` phase, preventing this vulnerability.
It also fixes an errcheck lint failure by adding a nolint directive.
Co-authored-by: tejjasdev <213147578+tejjasdev@users.noreply.github.com>
π‘οΈ Sentinel: [CRITICAL/HIGH] Fix CRLF Injection in Environment Variables
π¨ Severity: HIGH
π‘ Vulnerability: HTTP Response Splitting (CRLF injection) vulnerability via environment variable expansion in response headers. While header values defined in
Specare validated, if an environment variable is referenced using${VAR}and that variable contains control characters like\r\n, the characters are blindly injected into theevents.ResponsebyRender(). This can cause HTTP response splitting or invalid HTTP headers when sent over the wire.π― Impact: A user crafting a reply file referencing system environment variables could unintentionally or maliciously inject arbitrary headers or split the response body if the environment variables contain injected
\r\ncharacters.π§ Fix: Added a
sanitizeHeaderValuefunction that actively strips out control characters (like\nand\r) from the output ofEnvPolicy.Expand(h.Value)duringRender().β Verification: A new test
TestRenderSanitizesCRLFInHeadershas been added, andmake checkpasses.PR created automatically by Jules for task 4223147148252735421 started by @tejjasdev