Skip to content

[Security] Fix SSE injection in EventStream and URL param cache decode bug - #765

Open
sdogruyol wants to merge 2 commits into
masterfrom
fix/sse-injection-url-param-decode
Open

[Security] Fix SSE injection in EventStream and URL param cache decode bug#765
sdogruyol wants to merge 2 commits into
masterfrom
fix/sse-injection-url-param-decode

Conversation

@sdogruyol

Copy link
Copy Markdown
Member

Summary

This PR addresses a security issue in Kemal's Server-Sent Events support, plus a related URL params caching bug.

  • (SECURITY) Prevent SSE injection in Kemal::EventStream
    • Reject CR/LF in event and id (ArgumentError)
    • Normalize CR/LF/CRLF in data and comment so untrusted input cannot forge SSE fields
  • Fix URL params being decoded again on every request when route lookup results are cached (ParamParser now owns a copy of the params hash)

Huge thanks to @hahwul for the responsible disclosure and detailed report 🙏

Reject CR/LF in event/id and normalize line breaks in data/comment so
untrusted values cannot forge SSE fields.
@sdogruyol

Copy link
Copy Markdown
Member Author

The Windows CI failure is unrelated on Crystal 1.16.3 😐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant