Skip to content

fix(update): reject npm redacted global root paths - #107963

Closed
arcabotai wants to merge 2 commits into
openclaw:mainfrom
arcabotai:fix/npm-root-redaction-cad
Closed

arcabotai wants to merge 2 commits into
openclaw:mainfrom
arcabotai:fix/npm-root-redaction-cad

Conversation

@arcabotai

Copy link
Copy Markdown
Contributor

Summary

npm >= 11 can redact UUID-like global-root path segments as literal ***. Treating that output as a real path can create a literal *** directory tree during staged updates while leaving the live install stale.

This revision:

  • rejects *** only for npm root probes, preserving legal pnpm paths;
  • rejects multiline package-manager root output;
  • applies the same parser to install-target resolution and manager detection;
  • verifies the composed update flow never stages into or passes a poisoned root to npm.

Fixes #107239

Test evidence

Two-sided regression proof:

  • current upstream base + new tests: 3 expected failures (redacted npm root, composed poisoned staging path, multiline output);
  • previous PR head + new tests: 2 expected failures (legal pnpm *** path rejected, multiline output accepted);
  • corrected candidate: 57/57 focused tests pass.

Exact candidate proof ran in a disposable Blaxel Linux sandbox bound to parent 921154b7e3d5cebe94a47157ab97743b666970fb and archive SHA-256 60de94bc5eef540c92da905978e1628afc5a5c3a8795f952d76d4e4ca927e9f0:

  • pnpm install --frozen-lockfile
  • Oxfmt check on all four changed files
  • type-aware Oxlint for core production and test files: 0 warnings/errors
  • core TypeScript project check
  • core-test TypeScript project check
  • focused Vitest: 2 files, 57 tests passed

Sandbox cleanup was verified through provider-authoritative inventory ([]).

felirami and others added 2 commits July 15, 2026 02:56
npm >= 11 redacts UUID-like path segments in stdout to literal "***".
Trusting a poisoned path from "npm root -g" causes the updater to
materialize a literal "***" directory tree and leaves the live install
stale. Treat such output as an unresolved probe so the existing package
root fallback is used instead.

Closes openclaw#107239

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 15, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 15, 2026, 10:28 PM ET / July 16, 2026, 02:28 UTC.

Summary
The PR adds package-manager global-root validation for npm redaction and multiline output, applies it to install-target and manager detection, and adds focused updater regression tests.

PR surface: Source +8, Tests +137. Total +145 across 4 files.

Reproducibility: yes. at the helper level: current source can still accept an npm redaction marker when no authoritative package root is supplied. A failing current-main end-user update path was not established because the normal updater now prefers its running npm installation.

Review metrics: 1 noteworthy metric.

  • Probe parsing paths: 1 parallel parser added. Current main already has a shared package-manager probe parser, so a second parser creates conflicting output semantics before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #107239
Summary: This PR is a candidate hardening fix for the linked npm-root redaction report, and the earlier closed PR is a superseded iteration of the same branch work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Rebase and fold npm-only redaction validation into the canonical warning-tolerant probe parser.
  • Post redacted terminal/filesystem evidence from a real before-and-after update in a UUID-containing npm prefix.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR provides focused test and static-check evidence, but needs a real disposable openclaw update run showing the live version changes and no literal *** tree appears; redact private paths, endpoints, credentials, and identifiers before posting, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P2] Rebasing the branch as written could make valid warning-prefixed npm or pnpm probe output unresolved, causing manager detection or global update flows to skip or target a fallback unexpectedly.
  • [P1] The contributor has not yet demonstrated that a real redacted-path update changes the live installation without creating a literal *** directory tree.

Maintainer options:

  1. Preserve canonical probe parsing (recommended)
    Rebase and extend readPackageManagerProbeValue with manager-aware npm redaction validation while retaining its last-non-empty-line warning behavior.
  2. Pause the parser hardening
    Close the PR if current updater ownership rules make the remaining no-package-root probe paths too narrow to justify another parsing contract.

Next step before merge

  • [P1] The contributor should rebase, repair the parser compatibility defect, and add real behavior proof; automation cannot supply proof from the contributor’s affected setup.

Security
Cleared: The parser and regression-test changes add no concrete security or supply-chain concern.

Review findings

  • [P1] Preserve warning-prefixed package-manager probe output — src/infra/package-manager-output.ts:1-4
Review details

Best possible solution:

Rebase onto current main, extend its canonical probe parser to reject *** only for the final npm root value while preserving warning-prefixed output and legal pnpm paths, then prove the complete update flow in a disposable real installation.

Do we have a high-confidence way to reproduce the issue?

Yes at the helper level: current source can still accept an npm redaction marker when no authoritative package root is supplied. A failing current-main end-user update path was not established because the normal updater now prefers its running npm installation.

Is this the best way to solve the issue?

No. The narrow npm-redaction check is appropriate, but adding a parallel parser that rejects all multiline output is not the best fix; it should extend current main’s canonical warning-tolerant parser.

Full review comments:

  • [P1] Preserve warning-prefixed package-manager probe output — src/infra/package-manager-output.ts:1-4
    Current main deliberately reads the last non-empty stdout line because package managers can print warnings before the root value. Rejecting every response containing a newline makes a warning plus valid path unresolved and can cause manager detection or updates to skip. Rebase by extending the existing readPackageManagerProbeValue path with npm-only redaction validation instead of adding this parallel parser.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 08ecf63bb608.

Label changes

Label changes:

  • add P2: This is useful updater hardening with limited remaining reach on current main, but it needs rebase, compatibility repair, and real-flow proof.
  • add merge-risk: 🚨 compatibility: Rejecting every multiline probe response can break existing package-manager output containing warnings followed by a valid root path.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR provides focused test and static-check evidence, but needs a real disposable openclaw update run showing the live version changes and no literal *** tree appears; redact private paths, endpoints, credentials, and identifiers before posting, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Label justifications:

  • P2: This is useful updater hardening with limited remaining reach on current main, but it needs rebase, compatibility repair, and real-flow proof.
  • merge-risk: 🚨 compatibility: Rejecting every multiline probe response can break existing package-manager output containing warnings followed by a valid root path.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR provides focused test and static-check evidence, but needs a real disposable openclaw update run showing the live version changes and no literal *** tree appears; redact private paths, endpoints, credentials, and identifiers before posting, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +8, Tests +137. Total +145 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 11 3 +8
Tests 2 137 0 +137
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 148 3 +145

What I checked:

  • Parallel parser conflicts with current main: The branch adds parseGlobalRootOutput, while current main already centralizes package-manager stdout parsing in readPackageManagerProbeValue, which intentionally selects the last non-empty line after package-manager warnings. (src/infra/package-manager-output.ts:1, a4e3041b8660)
  • Multiline rejection changes supported behavior: The added parser returns null whenever stdout contains a newline, so a warning followed by a valid global-root path is rejected instead of using the final probe value as current main does. (src/infra/package-manager-output.ts:3, a4e3041b8660)
  • Current updater already prefers its running npm installation: Current main derives an authoritative npm global root from the running package root before falling back to package-manager probe output, preventing the original self-update path from blindly selecting a divergent or poisoned npm root. (src/infra/update-global.ts, 08ecf63bb608)
  • Branch needs reconciliation: GitHub reports the PR head as dirty against current main; the affected updater module changed after the PR base, so the proposed parser cannot be evaluated as a clean merge without a rebase. (src/infra/update-global.ts, a4e3041b8660)
  • Proof is test-only: The PR body reports focused tests, formatting, lint, and type checks in a disposable sandbox, but does not show an after-fix openclaw update run verifying the live version changes and no literal *** tree is created. (a4e3041b8660)

Likely related people:

  • stevenchouai: Recent merged work modified the global-update doctor and package-update boundary in src/infra/update-runner.ts, making this the strongest available current-main routing signal for reconciling updater behavior. (role: recent adjacent updater contributor; confidence: medium; commits: fa533101d8cf, 34ca66d49577; files: src/infra/update-runner.ts, src/infra/update-runner.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@arcabotai

Copy link
Copy Markdown
Contributor Author

Closing because current main already fixes the reported self-update failure at the stronger ownership boundary. #101228 (964fd53076c) keeps the running npm package root authoritative over npm root -g, and #107239 was closed after packaged npm 12 proof with a literal redacted-root shim confirmed that the live install updated without activating a parallel *** tree. #108100 records that proof.

The remaining parser change here is not worth carrying: it rejects warning-prefixed multiline probe output that current main intentionally accepts via readPackageManagerProbeValue. Thanks for the investigation and regression work.

@arcabotai arcabotai closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

2 participants