Repository navigation
fix(update): ignore permission-only drift in retained package trees - #175449
Conversation
Mask group/other bits for private retained-tree fingerprints, then tighten verified owned objects through the shared no-follow permission repair. Preserve full-mode historical receipts without changing their persisted shape. Cover pre-fix receipts, recursive POSIX ACLs, recovery, and strict content and owner-mode refusals. Pin frozen legacy-helper fixtures to their Node runtime. Fixes #170032
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 899eb02eaf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const { file, stat } of entries) { | ||
| assertCurrent(); | ||
| try { | ||
| repairPackagePermissions(file, stat, Number(stat.mode & 0o7700n)); |
There was a problem hiding this comment.
Deduplicate permission repairs for hard-linked files
When two paths in the retained tree reference the same widened hard-linked inode, both observations enter permissionRepairs; repairing the first path changes that inode's mode and ctime, so the second call compares against its stale stat and throws object changed before permission repair. Because that custom error is not among the tolerated filesystem errors, recovery fails instead of ignoring permission-only drift. Deduplicate repairs by device/inode or recognize an already-repaired alias.
Useful? React with 👍 / 👎.
| if ( | ||
| !("digest" in expectedTree) || | ||
| !packageIntegrityMatches({ ...expectedTree, identity: installedIdentity }, tree) |
There was a problem hiding this comment.
Tighten permissions before settling remounted recovery
For a non-legacy operation recovered through the remount settlement path, packageIntegrityMatches now accepts widened group/other mode bits, but this path never calls repairPackageIntegrityPermissions. The operation can therefore be durably settled and its recovery custody archived while the installed package or retained previous tree remains accessible through the widened permissions, unlike the ordinary publication matcher path that tightens them. The mutating settlement path should repair or explicitly report failed repairs before committing settlement; dry-run can remain read-only.
Useful? React with 👍 / 👎.
…penclaw#175449) After a recursive setfacl (e.g. granting a second account read access to ~/.npm-global), files inside the updater's private retained package trees carried an ACL mask in their group bits, and recovery refused with 'Package publication object changed' even though identity and content matched; only 'openclaw update repair' recovered. Integrity verification of private retained trees now ignores group/other permission bits (content, type, identity, ownership, owner bits and symlink targets still must match; legacy full-mode receipts still need an exact digest match), and verified objects with widened bits are tightened back through the shared no-follow repair helper with one aggregated warning. No receipt format change. Fixes openclaw#170032
Fixes #170032
What Problem This Solves
Recovery rejects an otherwise unchanged private retained package after recursive ACL or chmod changes widen its group/other mode bits, reporting
Package publication object changed.User Impact
Recovery accepts permission-only drift, tightens the verified owned files and directories through the existing no-follow repair helper, and emits one aggregated warning. Permission-denied or read-only-filesystem failures while tightening become warnings; changed contents, identity, ownership, owner permissions, or symlink targets still refuse recovery.
Why This Change Was Made
The integrity owner masks group/other bits in the retained-tree digest while keeping raw observations for file hashing and within-read stability. Publication and copy/recovery comparisons share one compatibility helper. No receipt fields, receipt format, schema, or link-count policy changes.
The copy path preserves npm's original modes, so old receipts can contain public-mode trees. Those receipts may match their original full-mode digest; their modes are preserved with a warning so the unchanged receipt remains usable on the next recovery attempt. Symlinks keep their platform mode and are never followed by permission repair.
Evidence
Package publication object changed; unchanged public-mode receipts and the other controls passed (1 failed, 5 passed; 31.24 s wrapper time, dominated by compilation).setfacl -R -m u:65534:rXon an isolated retained tree; production publication-tree verification succeeded, all four file/directory modes returned to owner-only, ACL masks became---, and exactly one warning was recorded. 8 tests passed; 22.98 s wrapper time. Blacksmith Testbox leasetbx_01m54qvb7z6kga8axvfny2g6h6, run, stopped after proof. The source-only sync initially lacked dependencies; installing the frozen lockfile in that same isolated lease resolved the setup failure.check:changedSQLite inventory was omitted under the campaign's local time-budget rule; PR CI provides broad proof.managed-handoff-build-config.test.ts/loads the staged production package runtime without neighboring assetstook 38.36 s. It builds/stages an isolated production helper and exercises two recovery generations through repeated real child commands; retained under the campaign's pre-existing-slow-proof allowance. Initial shared runtime preparation took 84.6 s separately from test time.Production delta: +146/-34 lines. Tests and test helpers: +183/-8 lines. Documentation: +9 lines. The existing activation permission repair is shared, with no second chmod path.