Skip to content

fix(release): normalize package tarball modes and prove non-root install - #130335

Merged
steipete merged 1 commit into
mainfrom
claude/pensive-merkle-86fec4
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/pensive-merkle-86fec4

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

scripts/package-openclaw-for-docker.mjs produces openclaw-<version>.tgz
whose extracted files can keep owner-only permissions (0600/0700) when packed
on a restrictive-umask build host. After sudo npm install -g <tarball> on
such an artifact, /usr/lib/node_modules/openclaw/openclaw.mjs (or other
packaged files) can end up unreadable by non-root users — the openclaw
PATH symlink exists but its target is mode-restricted — even though the
/usr/bin/openclaw shim resolves fine for root. Reproduced live on a
crabbox AWS Ubuntu box (npm 11.16.0, node 24) and confirmed the underlying
mechanism against the pinned Docker E2E image (npm 11.16.0/11.17.0).

Docker E2E didn't catch this because the functional lane runs as root
throughout, so a same-user install/execute never exercises the failure mode.

Why This Change Was Made

npm pack/pnpm pack copy on-disk file modes into the tarball, and
node-tar's "portable" mode-fix only strips group/other write bits — it
never adds read bits. So a build host with a restrictive umask ships
owner-only tarball entries, and any mode-preserving consumer (system tar -x, which OpenClaw's own Docker functional stage uses, plus some other
installers) reproduces the owner-only tree on install.

User Impact

  • scripts/package-openclaw-for-docker.mts: normalizes every packed tarball
    entry to 0644/0755 (world-readable, executable bits preserved) as the
    final step of packaging, regardless of the build host's umask.
  • scripts/check-openclaw-package-tarball.mts: adds a tar -tvf mode gate
    that fails the tarball check on any non-world-readable entry, so a
    regression can't ship silently.
  • scripts/e2e/docker-package-install.sh: the npm install lane now runs
    npm install -g as root into the default global prefix and then
    executes openclaw --version/--help as a non-root user via runuser —
    proving the actual sudo npm install -g + non-root-use flow live. The
    identity evidence now records npm:nonRootExecution=passed.
  • Opportunistic fix: while wiring this up, the docker-package-install
    bun proof turned out to be broken on main since improve: verify packaged runtime on Bun 1.4 #129552 wired the
    bun smoke into the shared openclaw-e2e-instance library — the lane's
    file-by-file harness copy list was missing openclaw-e2e-instance.sh,
    then transitively agent-turn-output.mjs/fixtures, then the
    runtime-spawned mock-openai-server.mjs. Replaced the drift-prone
    per-file list with directory copies (scripts/ +
    packages/normalization-core/src) and added a closure-walking guard
    test (test/scripts/docker-build-helper.test.ts) that fails on any
    missing harness dependency — verified it catches all three pre-fix gaps.

Evidence

  • New regression test (test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts)
    packs a 0600/0700 fixture through the real pipeline and asserts 0644/0755
    output; fails pre-fix.
  • New check-script test (test/scripts/check-openclaw-package-tarball.test.ts)
    proves the mode gate rejects an owner-only tarball fixture.
  • Live: built the real package artifact end-to-end
    (pnpm build + scripts/package-openclaw-for-docker.mjs) — 57MB tarball,
    11,299 files at 0644, 11 executables at 0755, 296 dirs at 0755 — passed
    the extended tarball check, then ran the full
    scripts/e2e/docker-package-install.sh lane against it: npm (root
    install, non-root exec), pnpm, and Bun proofs all passed
    (npm, pnpm, and Bun package artifact proofs passed, exit 0).
  • pnpm test test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts test/scripts/check-openclaw-package-tarball.test.ts test/scripts/docker-build-helper.test.ts — all pass.
  • node scripts/check-changed.mjs — green (format, tsgo, oxlint, import
    cycles, coercion/wrapper/dependency-pin guards).
  • Codex autoreview (gpt-5.6-sol, high): clean, no accepted findings
    ("patch is correct 0.96").

npm/pnpm pack copy on-disk file modes into the tarball, and node-tar's
portable mode-fix only strips group/other write bits — it never adds
read bits. A restrictive-umask build host therefore ships owner-only
(0600/0700) tarball entries, which breaks the CLI for non-root users
after `sudo npm install -g` under mode-preserving consumers such as
system tar.

- Normalize every packed entry to 0644/0755 (a+rX, exec bits kept) as
  the last step of packOpenClawPackageForDocker.
- Add a tar -tvf mode gate to check-openclaw-package-tarball that
  rejects any non-world-readable entry.
- Run the docker-package-install npm lane as root and execute the
  installed CLI as a non-root user to prove the fix live.
- Fix the docker-package-install bun proof, broken on main since
  #129552 wired the bun smoke into the shared openclaw-e2e-instance
  library: replace the drift-prone per-file harness copy list with
  directory copies, and add a closure-walking guard test that fails
  on missing harness dependencies.
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts docker Docker and sandbox tooling extensions: qa-lab size: M maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 19:55
@steipete
steipete merged commit fc2724d into main Aug 26, 2026
243 checks passed
@steipete
steipete deleted the claude/pensive-merkle-86fec4 branch August 26, 2026 20:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…all (openclaw#130335)

npm/pnpm pack copy on-disk file modes into the tarball, and node-tar's
portable mode-fix only strips group/other write bits — it never adds
read bits. A restrictive-umask build host therefore ships owner-only
(0600/0700) tarball entries, which breaks the CLI for non-root users
after `sudo npm install -g` under mode-preserving consumers such as
system tar.

- Normalize every packed entry to 0644/0755 (a+rX, exec bits kept) as
  the last step of packOpenClawPackageForDocker.
- Add a tar -tvf mode gate to check-openclaw-package-tarball that
  rejects any non-world-readable entry.
- Run the docker-package-install npm lane as root and execute the
  installed CLI as a non-root user to prove the fix live.
- Fix the docker-package-install bun proof, broken on main since
  openclaw#129552 wired the bun smoke into the shared openclaw-e2e-instance
  library: replace the drift-prone per-file harness copy list with
  directory copies, and add a closure-walking guard test that fails
  on missing harness dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling extensions: qa-lab maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant