Browse Source
PR #15588 added validation to ServerSentEvent, but the public format_sse_event() function accepted multi-line values for event and id without raising an error. A newline in either field splits into extra SSE lines, allowing callers who pass user-supplied data directly to format_sse_event() to unintentionally inject arbitrary SSE fields. Reuse the existing _check_event_single_line and _check_id_valid helpers at the top of format_sse_event so the two entry points enforce the same rules. Add eight parametrised tests covering \n, \r, \r\n and \0 in both fields, plus an end-to-end injection scenario.pull/15651/head
2 changed files with 37 additions and 4 deletions
Loading…
Reference in new issue