Skip to content

Add security audit report identifying critical and high severity issues#1

Merged
blaineam merged 5 commits intomainfrom
claude/security-audit-SibrB
Apr 6, 2026
Merged

Add security audit report identifying critical and high severity issues#1
blaineam merged 5 commits intomainfrom
claude/security-audit-SibrB

Conversation

@blaineam
Copy link
Copy Markdown
Owner

@blaineam blaineam commented Apr 6, 2026

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

claude added 5 commits April 6, 2026 08:04
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
@blaineam blaineam merged commit 77c9425 into main Apr 6, 2026
3 checks passed
@blaineam blaineam deleted the claude/security-audit-SibrB branch April 7, 2026 01:24
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.

2 participants