Repository navigation
fix(security): redact malformed NDJSON stream diagnostics - #2420
Merged
Merged
Conversation
Contributor
jbeckwith-oai
approved these changes
Aug 19, 2026
jbeckwith-oai
left a comment
Contributor
There was a problem hiding this comment.
Independent two-pass security review confirms malformed NDJSON now raises a fresh payload-free SyntaxError across public streams and Chat, Assistants, and Responses wrappers. Sensitive data stays out of error messages, causes, and stacks while unrelated errors, valid fragmented input, UTF-8, limits, cancellation, and reader cleanup retain their established behavior. Focused regressions and substantive CI are green; no actionable findings.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stream.fromReadableStream, preventing raw streamed patient data, credentials, and other response contents from escaping through error messages, stack traces, or wrapper error causesSyntaxErrorfor the direct stream and the existingOpenAIErrorwrapper/cause behavior across public Chat Completions, Assistants, and Responses stream replay constructorsSecurity regression
The regression was written and run against unchanged
mainfirst: 6 failed and 8 passed. All four real publicfromReadableStreamsurfaces exposed synthetic patient and credential values on the failing baseline. With the minimal parser-boundary fix, all 14 privacy and compatibility regressions pass without storing the original leaking exception as a nested cause.Validation
Scope is exactly the handwritten stream implementation and one new dedicated regression test.