Skip to content

Close SSE empty line type loophole - #38

Merged
AlexanderKolberg merged 1 commit into
webrpc:masterfrom
rapropos:safe-sse-blanks
Aug 18, 2026
Merged

Close SSE empty line type loophole#38
AlexanderKolberg merged 1 commit into
webrpc:masterfrom
rapropos:safe-sse-blanks

Conversation

@rapropos

@rapropos rapropos commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

line?.length === 0 will be falsy even if line is undefined. If the tsc option noUncheckedIndexedAccess is enabled, array dereferences always run the risk of being undefined. Thus, the call to JSON.parse will generate errors. Changing the emptiness test to !line || line.length === 0 closes off this possibility and makes the JSON.parse call happy.

@AlexanderKolberg
AlexanderKolberg merged commit 0e5f538 into webrpc:master Aug 18, 2026
1 check passed
@VojtechVitek

Copy link
Copy Markdown
Contributor

Thank you @rapropos 👍

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.

3 participants