Add security audit report identifying critical and high severity issues#1
Merged
Add security audit report identifying critical and high severity issues#1
Conversation
Full codebase audit covering 234 Swift files and CI/CD workflows. Key findings: memory leak in unsafe pointer allocation, forced null dereferences in TreeSitter C interop, logic bug in predicate evaluation, unbounded pointer arithmetic, ReDoS via user-controlled regex patterns, and unpinned CI/CD actions. https://claude.ai/code/session_018LZMfr9vbFVZ6HQ17fVTac
Critical fixes: - C1: Fix memory leak - deallocate buffer on getBytes failure path - C2: Replace force-unwraps with guard-let in TreeSitter C interop - C3: Fix wrong capture index (lhs→rhs) in predicate evaluation - C4: Bound predicate parsing loop to totalStepCount High fixes: - H1: Add regex pattern length limit and match count cap for ReDoS - H2: Clamp range arithmetic to string bounds in TextEditHelper - H3: Add null-pointer guard for UnsafeBufferPointer in TreeSitterTree - H4: Document pointer ownership transfer on StringViewBytesResult - H5: Use NSRange(byteRange) instead of manual /2 division - H6: Use UInt32(clamping:) for overflow-safe byte range conversion Medium fixes: - Pin GitHub Actions to commit SHAs - Tighten SPM dependency version ranges to .upToNextMinor - Replace fatalError with graceful handling in ReplacementStringParser - Replace assert with precondition in RedBlackTree.rebuild() Additional fixes: - Guard force-unwrap of node ID in TreeSitterInjectedLanguageMapper - Add null-capture guard in TreeSitterQueryCursor.validCaptures() - Fix CRLF range underflow in NSString+Helpers https://claude.ai/code/session_018LZMfr9vbFVZ6HQ17fVTac
Guard against null payload pointer in the TSInput read callback instead of force-unwrapping. https://claude.ai/code/session_018LZMfr9vbFVZ6HQ17fVTac
…guage code - TreeSitterPredicateMapper: Replace 6 fatalError calls with optional returns. Malformed grammar predicates now silently skip instead of crashing the app. - TreeSitterLanguage.internalLanguage: Return optional instead of fatalError when preparation fails. Callers fall back to PlainText mode gracefully. - TreeSitterLanguageLayer: Fix force-unwrap in debug hierarchy method. https://claude.ai/code/session_018LZMfr9vbFVZ6HQ17fVTac
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.
Full codebase audit covering 234 Swift files and CI/CD workflows.
Key findings: memory leak in unsafe pointer allocation, forced null
dereferences in TreeSitter C interop, logic bug in predicate evaluation,
unbounded pointer arithmetic, ReDoS via user-controlled regex patterns,
and unpinned CI/CD actions.
https://claude.ai/code/session_018LZMfr9vbFVZ6HQ17fVTac