Fix mission-critical TraceKit and HTTP parser safety gaps#18
Open
christopherkarani wants to merge 2 commits into
Open
Fix mission-critical TraceKit and HTTP parser safety gaps#18christopherkarani wants to merge 2 commits into
christopherkarani wants to merge 2 commits into
Conversation
- Enforce zero-retention semantics for TraceStore(maxSpans: 0) to prevent unbounded memory growth - Exclude numeric directories from TraceFileLocator so only regular files are treated as traces - Add 10 MiB response-size guard in AIResponseParser before JSON decoding to avoid oversized payload parsing - Add regression tests for all three issues - Update tasks/todo.md audit remediation checklist and review notes Validation: - swift test --filter TraceStoreTests/testIngestWithZeroMaxSpansKeepsNoSpans --filter locatorExcludesNumericDirectories --filter oversizedResponseBodyReturnsNil - swift build - swift test
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
This PR remediates three correctness/safety issues identified during the mission-critical framework audit:
TraceStore(maxSpans: 0)previously accepted spans and could grow unbounded.TraceFileLocatorpreviously accepted numeric directory names as trace files.AIResponseParserpreviously attempted JSON decoding for unbounded payload sizes.Test-first changes
Added regression tests that fail on old behavior and pass after fixes:
TraceStoreTests.testIngestWithZeroMaxSpansKeepsNoSpansTraceKitTests.locatorExcludesNumericDirectoriesAIRequestParserTests.oversizedResponseBodyReturnsNilValidation
swift test --filter TraceStoreTests/testIngestWithZeroMaxSpansKeepsNoSpans --filter locatorExcludesNumericDirectories --filter oversizedResponseBodyReturnsNilswift buildswift testAll tests pass.