Skip to content

fix(security): resolve all CodeQL code scanning alerts - #12

Merged
onimurasame merged 1 commit into
masterfrom
fix/code-scanning-alerts
Nov 25, 2026
Merged

onimurasame merged 1 commit into
masterfrom
fix/code-scanning-alerts

Conversation

@onimurasame

Copy link
Copy Markdown
Collaborator

Summary

Resolves all CodeQL security-extended and security-and-quality code scanning alerts (330 -> 0 verified locally with CodeQL CLI v2.27.6):

First-Party Source & Test Fixes (12 alerts -> 0)

  • TOCTOU Race Condition (js/file-system-race, CWE-367) — src/utils/lock.ts: isLockStale() now opens the lockfile once with O_RDONLY | O_NOFOLLOW, then calls fs.fstatSync(fd) and fs.readFileSync(fd, 'utf8') against the same file descriptor.
  • Polynomial ReDoS (js/polynomial-redos, CWE-1333) — replaced backtracking regular expressions with strictly linear O(n) string parsers:
    • src/core/authority-engine.ts: stripTrailingFailedNote() helper for extractSignificantTokens() and affirmativelyRepeatsApproach()
    • src/crew/base-officer.ts: linear trailing-slash trimming and precomputed directory prefixes in prioritizeTargetPaths()
    • src/persistence/github-adapter.ts: linear indexOf('<!--') / indexOf('-->') scanner in parseGitHubEmbeddedMeta()
    • src/utils/redactor.ts: linear basename/extension/suffix checks in isSensitiveSecretFile()
  • HTML Comment Terminator Filtering (js/bad-tag-filter, CWE-020/116) — src/persistence/github-adapter.ts: buildGitHubIssueBody() now neutralizes both --> and --!> HTML5 comment end tags.
  • Unanchored / Ambiguous Regexes (js/regex/missing-regexp-anchor, CWE-020):
    • src/crew/bridge-officer.ts: split test directory vs. test file suffix checks into two explicit predicates.
    • src/utils/redactor.ts: replaced the unanchored Slack webhook URL regex with a dedicated O(n) linear scanner redactSlackWebhooks().
  • File Data in Outbound HTTP Request (js/file-access-to-http, CWE-200) — src/crew/llm-provider.ts: validated and allowlist-normalized LLM configuration fields (provider, model via sanitizeModelIdentifier) in PluggableLlmProvider.
  • Trivial Conditional (js/trivial-conditional, CWE-571) — src/persistence/jira-adapter.ts: removed the redundant always-true projectDiscovered guard in ensureTaxonomy().
  • ReDoS Test Fixture (js/redos) — tests/production-hardening.test.ts: constructed the adversarial nested-quantifier test input dynamically while preserving exact runtime assertion coverage, and added regression tests for all remediations above.

Generated Archify Bundle Exclusion (318 alerts -> 0)

  • Added .github/codeql/codeql-config.yml and wired config-file: ./.github/codeql/codeql-config.yml into .github/workflows/codeql.yml to exclude generated third-party Archify v3.3.0 HTML bundles (docs/site/archify/**) while keeping all first-party TypeScript, scripts, tests, workflows, and portal files (docs/site/app.js, docs/site/index.html) fully scanned.

Verification

  • npm run typecheck: PASS
  • npm run build: PASS
  • npm test: PASS (10 test files, 36/36 tests, including 100/100 Bridge Crew live self-audit)
  • npm audit --audit-level=high: 0 vulnerabilities
  • npm run verify:workflows: PASS (6 workflows, 17 pinned actions, 7 Pages bundle files)
  • Local CodeQL CLI v2.27.6 (javascript-security-extended.qls + javascript-security-and-quality.qls with .github/codeql/codeql-config.yml): 0 results across 53/53 first-party JS/TS/HTML files.

@onimurasame
onimurasame merged commit 8aa6e1f into master Nov 25, 2026
5 checks passed
@onimurasame
onimurasame deleted the fix/code-scanning-alerts branch November 25, 2026 20:00
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