fix(security): bind analysis paths to filesystem authority - #858
fix(security): bind analysis paths to filesystem authority#858seonghobae wants to merge 49 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks 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-current-head security review on I am treating this as blocking current #858 semantics. Minimal repair is to regression-lock the exact feature and temporary children first, then resolve each repository-owned child through the existing canonical containment helper immediately before use; do not broaden authority or suppress the race caveat. |
|
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.


Security gap
Analysis path strings are authority-bearing inputs. This Draft addresses #852 from protected
developwithout dependency, lockfile, workflow, model, network, database, or.trivyignorechanges.Exact current state
30293ac30680f9cff5b3888bb9399d6b611f7e75.develop@acdbea6344fe1231c39535b575f4de35e4c607c9.main, and no qualifying independent non-author last-push approval exists.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 derived 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. Canonicalization remains a point-in-time check and does not claim descriptor/handle-level race freedom against a privileged local actor replacing entries after validation.
Current-head repair adopted from validated successor commit
Exact-current-head review on predecessor
8a9321d3eeadbf4a35c996d3d3a013b294af38cafound two still-valid BandScope-owned defects:_run_stem_separation_with_timeouttrusted the worker-returnedarraysPathas writable sidecar/reload authority, allowing a mismatchedok_fileenvelope to target a sibling outside the parent-helper-authorized stem-work child.ValueErrorfrom_build_local_audio_featuresafter progress remained fail-closed but was reported asengine_unavailable, misleading the musician instead of returning the existing payload-safeinvalid_requestcontract.Successor commit
30293ac30680f9cff5b3888bb9399d6b611f7e75was independently verified to be a direct child of8a9321d.... Rather than open another #852 PR, the canonical #858 branch was fast-forwarded non-forced to that commit.The repair:
arraysPathto the already-authorized parent-helperarrays_pathand rejects missing/mismatched values asInvalid analysis job request: invalid field 'tempRoot'before sidecar write or unlink;{digest}.jsonsidecar and reloads arrays only through the authorizedarrays_path;ValueError/FileNotFoundErroron the existing engine-unavailable path, but keepsValueErrormessages beginningInvalid analysis job request:asinvalid_requesteven when discovered after progress;CHANGELOG.mdwith the exact authority contract.The two review threads that described these defects were rechecked against
30293ac...and resolved only after the production code matched the requested invariant. The predecessor-head CursorCHANGES_REQUESTEDreview was then dismissed as stale after this exact-current-head verification; that dismissal is not an approval and does not satisfy the independent-review gate.TDD / verification history
Earlier RED/GREEN slices on this branch cover Windows leading-space normalization,
CONIN$/CONOUT$, mixed-separator UNC/device authority, derived cache/temp symlink escapes, exact feature-cache sibling authority, atomic-write siblings, and stem-work sidecar symlinks. Historical successful or failed predecessor checks remain historical and do not transfer.Exact-current-head repository evidence
Repository workflows for unchanged head
30293ac30680f9cff5b3888bb9399d6b611f7e75are now terminal.Terminal-success repository lanes:
ci31960639721;build-baseline31960639710;release31960639743;sbom31960639752;bandit31960639766;secret-scan-gate31960639773; andSAST Semgrep31960639817.security-audit31960639797and aggregateSecurity Scan31960639724are terminal-failure/non-passing. This branch has no JavaScript dependency/root-lock or vulnerability-suppression delta; those whole-tree failures remain the protected-base dependency-security baseline owned by canonical #783 and must be regenerated after #783 integrates. They are neither suppressed nor counted as success here.Merge gate
Keep Draft until one unchanged exact head has all applicable repository/central required workflows terminal-success, exact 100% owned production statement and branch coverage plus other exposed metrics, docstrings/type/lint/build evidence, SAST/security/SBOM/supply-chain/package/release evidence, zero valid unresolved threads/findings, #783/#861/central prerequisites integrated and regenerated, a qualifying independent non-author last-push approval, and ordinary protected-branch acceptance without bypass.
Closes #852 only after protected merge.