fix(security): resolve all 35 open code-scanning alerts#7
Merged
Conversation
Trivy (1): - CVE-2026-53550 (medium): bump js-yaml ^4.1.0 -> ^4.3.0 (DoS via crafted YAML merge keys; fixed in 4.2.0). Lockfile also self-syncs stale root metadata (version/engines) to match package.json. Semgrep (34) — two real hardening fixes, the rest justified suppressions per the workflow's sanctioned `// nosemgrep` path (SAST is report-only): detect-non-literal-regexp (14): - stack-snapshot.js, install.js: storyKey/key were interpolated UNESCAPED into `new RegExp` — now regex-escaped (latent correctness + hardening). - remainder: input already escaped (escapeRe/escapeRegex/inline), glob->regex compilers that escape metachars during translation, or an operator-supplied grep pattern by design — suppressed with rationale. contains-bidirectional-characters (12 -> 3 lines): - resolve-dag.js / sprint-plan.js sanitizer regexes intentionally contain bidi code points in order to strip/reject them. Suppressed. prototype-pollution-loop (8): - read-only path traversals (no write sink), already-UNSAFE_KEYS-guarded writes (state-shard), and a null-proto tree (config-merger). Suppressed. Verified: Semgrep (p/default,p/security-audit,p/secrets) reports 0 findings; biome clean; 2234 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| // Escape the key so a metacharacter in it can't alter the pattern. | ||
| const safeKey = storyKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp -- pattern built from a regex-escaped, trusted story key | ||
| const re = new RegExp(`^\\s*${safeKey}:\\s*(\\w+)`, 'm'); |
| // Escape the key so a metacharacter in it can't alter the pattern. | ||
| const safeKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp -- pattern built from a regex-escaped config key | ||
| const replaceRe = new RegExp(`^([ \\t]*)${safeKey}:[ \\t]*(\\S[^#\\n]*?)?([ \\t]*#.*)?$`, 'm'); |
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.
Closes all 35 open code-scanning alerts on this repo.
Summary
CVE-2026-53550(Trivy, medium)js-yaml ^4.1.0 → ^4.3.0(DoS via crafted YAML merge keys; fixed in 4.2.0)detect-non-literal-regexp(Semgrep)contains-bidirectional-characters(Semgrep)prototype-pollution-loop(Semgrep)Real hardening fixes
stack-snapshot.js/install.js: a story key / config key was interpolated unescaped intonew RegExp(...). Now regex-escaped so a metacharacter can't alter the pattern.js-yamlbumped past the DoS CVE; lockfile also self-syncs stale rootversion/enginesthat were out of step withpackage.json.Suppressions
Semgrep SAST is report-only in
security.yml; the workflow explicitly directs FP suppression via inline// nosemgrep. Each suppression carries a specific rationale (escaped input, glob→regex compiler, operator-supplied pattern by design,UNSAFE_KEYS-guarded write,Object.create(null)tree, read-only traversal).Verification
semgrep scan --config p/default --config p/security-audit --config p/secrets→ 0 findingsbiome check→ cleancd tests && npm test→ 2234 passed, 0 failuresThe Trivy CVE alert and Semgrep alerts will auto-close on the next FULL security scan after merge.
🤖 Generated with Claude Code