Fix ReDoS spawn-hang + prefix traversal bypass + verify-then-attest (132->193) - #11
Merged
Merged
Conversation
Four security fixes to the default-deny argument sanitizer and spawn attester, each with attack-blocked AND benign-allowed tests (+61 tests, 132 -> 193 total). All packages move to 0.2.0 in lockstep. - ReDoS guard: evalArgRule refuses to run regex patterns prone to catastrophic backtracking (nested unbounded quantifiers like (a+)+). The pattern is author-signed but the value is attacker-controlled — a careless pattern previously froze the spawn hot path for 60+ seconds on a crafted arg. Detection is a linear-time scan (cannot itself ReDoS), fails closed. New regex `maxLength` cap (default 4096) as second layer. Exposed as looksCatastrophic(). - Prefix path-traversal guard: prefix rules rejected `..` was bypassable (/safe/../../etc/passwd satisfies prefix:"/safe/"). Now rejects `..` components incl. %2e%2e, POSIX+Windows separators, default-on via new `denyTraversal` field; enforced at eval time so it holds for in-memory manifests too. Exposed as containsTraversal(). - Control-char gap: shellSafeString now also blocks VT (U+000B), FF (U+000C), NEL (U+0085), completing the newline/separator deny set. CVE-2025-69256 replay fixtures extended. - attestSpawnVerified(): verifies signature then attests in one fail-safe call, closing the footgun where an unverified/tampered manifest reaches attestSpawn. Docs: README security model + quickstart, MANIFEST-FORMAT arg-rule table + ReDoS note, THREAT-MODEL mitigation rows, CHANGELOG 0.2.0. Build + typecheck + full suite green. No runtime-dep changes (lib still zod-only). Behaviour change: prefix denyTraversal defaults true (opt-out with denyTraversal:false). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…and-hardening # Conflicts: # package-lock.json # packages/demo-server/package.json
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.
What
Crypto path audited (Ed25519 sign/verify sound); fixed 4 real security issues in the sanitizer/attester.
looksCatastrophiclinear pre-check (fail-closed) +regex.maxLengthcap. 61s -> <100ms./safe/../../etc/passwdpassed aprefix:"/safe/"rule. NewdenyTraversal(default on, opt-out with false).attestSpawnVerified: verify-then-attest fail-safe (bareattestSpawndid not verify the signature).Tests 132 -> 193. Version -> 0.2.0 (behavior change: denyTraversal default on). No publish in this PR.