fix(security): bind analysis paths to filesystem authority - #858
fix(security): bind analysis paths to filesystem authority#858seonghobae wants to merge 56 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@jules Implement the production half of this Draft on the existing Scope is strictly #852: Required behavior:
Use current primary references in doctoring: Microsoft Learn Windows path formats/namespaces, MITRE CWE-22, and Python 3.14 |
|
Exact-head gate refresh for
This seven-file branch has no JavaScript dependency/root-lock delta. Combined with the clean exact-head PR-introduced OSV comparison and the already inspected protected-base Review refresh: both visible inline threads remain resolved and the formal review list still contains no qualifying independent non-author approval. Python branch coverage is also not inferred from this protected-base-lineage |
Reject a pre-existing stem-work {digest}.json symlink before the parent
helper writes worker metadata, and fail the job as invalid_request
before progress so the write cannot follow an escape outside tempRoot.
Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Reject a worker-supplied arraysPath that is not the parent-helper authorized tempRoot child before any sidecar write or unlink, and keep late path-authority ValueError as invalid_request after progress. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
There was a problem hiding this comment.
Exact-head review of 8a9321d3eeadbf4a35c996d3d3a013b294af38ca.
The prior stem-work {digest}.json sidecar residual is fixed on this head: a pre-existing symlink next to the authorized arrays file is rejected before write, and the job fails as invalid_request before progress. Mixed-separator UNC/device prefixes, CONIN$/CONOUT$, leading ASCII-space components, and feature-cache sibling re-resolve still hold.
Do not merge this head as closing #852. _run_stem_separation_with_timeout still treats a worker-supplied arraysPath as writable tempRoot authority. A mismatched ok_file envelope can write or unlink a sidecar outside the authorized stem-work child. I reproduced that write/unlink against an outside sentinel, then bound sidecar write and array reload to the parent-helper authorized arrays_path on successor 30293ac30680f9cff5b3888bb9399d6b611f7e75.
Late _build_local_audio_features path-authority ValueError after progress is still mapped to engine_unavailable on this head. That is fail-closed but tells the musician the engine died instead of asking them to pick another temp folder. The successor keeps that failure as invalid_request.
Inherited JavaScript findings stay with #783. Python branch-coverage ownership stays with #861. Canonicalization remains point-in-time; descriptor-level TOCTOU is still out of scope.
Prefer the successor over this head. Do not open a third #852 PR.
Sent by Cursor Automation: Fix Issues
Findings were verified against successor head 30293ac and addressed on the canonical #858 branch: worker arraysPath is now required to equal the parent-authorized arrays_path before sidecar/reload I/O, and late Invalid analysis job request: ValueError remains invalid_request. Both corresponding threads are resolved. Dismissing this predecessor-head CHANGES_REQUESTED review only clears stale review state; it is not approval, and current-head required checks plus qualifying independent last-push approval remain required.
|
@opencode-agent EXECUTION-FIRST owner repair on existing The old Draft body still treats #783 as pending and its protected base as Apply If the integrated exact head is review-ready, update the PR body to the actual head/base/current evidence and move out of Draft only after the branch itself is clean enough for independent review. Request/obtain a qualifying independent non-author last-push review through the existing authorized review path. Do not merge unless every applicable required exact-head gate succeeds without bypass. |
|
@opencode-agent EXECUTION-FIRST owner repair on existing Apply That production direction is intentional security behavior, not the defect: Smallest repair on this exact owner branch: update only the two stale Run RED/GREEN evidence focused on those two tests plus |
|
@opencode-agent Review current exact head The prior stale-test defect has already been repaired on this head by Perform an independent current-head review of the #852 filesystem-authority boundary and the new logging-test repair. Revalidate relative/drive-relative/traversal/UNC/device/ADS rejection, selected-source and derived cache/temp/stem-work authority, worker |


Security outcome
Analysis path strings are authority-bearing inputs. This Draft addresses #852 in BandScope without dependency, lockfile, workflow, model, network, database, or vulnerability-suppression changes.
Exact current state
bbea51769915b0383dd74d9e900d221e479afeea.develop@749511c3ad4000090048718f685c6bee6b3d2c25.developis already integrated into this branch through ordinary history-preserving ancestry; fix(security): establish canonical npm, PDF.js, Nanoid, and Undici baseline #783 is protected truth rather than a remaining prerequisite.Bounded authority contract
The branch rejects relative/drive-relative paths, traversal, UNC/network roots including mixed-separator spellings, Win32 device namespaces and console aliases, alternate streams, foreign-host absolute authority at native preflight, direct selected-source symlinks, non-directory writable roots, and already-present derived cache/temp symlink escapes. Lexical cross-platform validation stays separate from native filesystem authority and diagnostics stay payload-safe.
Exact feature-cache files, atomic-write siblings, stem-work arrays, and the stem-work metadata sidecar are revalidated against app-owned authority before repository-owned I/O. The parent helper treats the already-authorized
arrays_pathas authority, not the worker-returnedarraysPath; a missing or unequal payload path fails closed before sidecar write or unlink. Late path-authority failures remain payload-safeinvalid_requestresults, while ordinary media/runtime failures retain the existing engine-unavailable/fallback contract.Canonicalization is a point-in-time control and does not claim descriptor/handle-level race freedom against a privileged local actor replacing entries after validation.
Current-head causal repair
Exact predecessor head
197664bcb2fec097aee252e924c12870ebc8c44fadded a production-boundary privacy regression for rejected traversal values. Its release-preflight run33496149363, job99818702562, proved two real failures:cacheRootandtempRoottraversal were rejected safely but emitted no security warning, whileprojectIdalready did. The full analysis suite otherwise reached 777 passed / 24 skipped and 100% owned coverage; the two missing-log assertions made release-preflight correctly fail.Current head
bbea51769915b0383dd74d9e900d221e479afeeais the smallest causal repair.validate_local_path_shapenow emits one WARNING that names only the trusted field identifier when its own lexical traversal branch rejects a value, then preserves the same payload-safeValueError. It never logs the untrusted path text. This keeps traversal classification and telemetry at the path-authority boundary instead of duplicating parsing in API callers, and the existing privacy regression requires the secret marker to remain absent from logs.Fresh repository workflows have materialized for this exact head and are currently queued/in progress. Queued or in-progress evidence is non-passing; predecessor GREEN does not transfer.
Verification contract
The exact PR head must cover POSIX/Windows adversarial path syntax; mixed UNC/device namespaces; DOS/console devices; Windows normalization/stream forms; foreign-host preflight; source/writable-root type and symlink cases; exact feature-cache and atomic-write child authority; stem-work sidecar and worker-envelope authority; late invalid-request classification; payload-safe diagnostics; full analysis-engine behavior; exact 100% owned statement/branch coverage; docstrings/type/lint/build; SAST/security/dependency/SBOM/supply-chain/package/release gates; zero valid unresolved findings; current automated review; and a qualifying independent non-author approval.
Keep Draft until the branch has current review and all applicable exact-head gates required for independent review. Do not merge until every applicable required check is terminal-success on one unchanged exact head and ordinary protected-branch acceptance succeeds without bypass. Queued, pending, skipped-required, cancelled, absent, neutral, failed, stale, predecessor-head, protected-base, model-only, self/author, status-only, or administrative-bypass evidence is not success.
Closes #852 only after protected merge.