Skip to content

fix(security): resolve CodeQL findings in untrusted-input paths - #30

Merged
leonacostaok merged 1 commit into
mainfrom
fix-codeql-redos
Jul 23, 2026
Merged

leonacostaok merged 1 commit into
mainfrom
fix-codeql-redos

Conversation

@leonacostaok

Copy link
Copy Markdown
Member

Fixes the CodeQL findings that sit on attacker-controlled input:

  • biased-cryptographic-random (qProbe ML-KEM probe key): now unbiased rejection sampling. It is a throwaway key, but a crypto tool should not sample biased randomness.
  • polynomial-redos in Sieve fromB64 (parses untrusted system-under-test output) and MCP bearer-token parsing (untrusted auth header): both O(n^2) regexes replaced with linear equivalents.

216 tests pass, including the fuzz tests on the patched parsers. The remaining trailing-slash-trim findings (walk glob patterns, agent baseURL) are on trusted config input and are dismissed separately.

- qprobe/mlkem768: replace biased modulo sampling with unbiased rejection
  sampling for the throwaway probe key (js/biased-cryptographic-random)
- sieve/protocol fromB64: replace the /=+$/ trailing-trim (O(n^2) on the
  untrusted SUT response) with a linear scan (js/polynomial-redos)
- mcp/http: disambiguate the Bearer regex (\S.* instead of .+) so the auth
  header parse can't backtrack (js/polynomial-redos)

All 216 tests pass, including the property-based fuzz tests on the patched
parsers. Trailing-slash trims on trusted config input (walk globs, agent
baseURL) are dismissed separately as not attacker-controlled.
@leonacostaok
leonacostaok enabled auto-merge (squash) July 23, 2026 10:44
@leonacostaok
leonacostaok merged commit e68ab13 into main Jul 23, 2026
13 checks passed
@leonacostaok
leonacostaok deleted the fix-codeql-redos branch August 19, 2026 13:52
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.

1 participant