Repository navigation
fix: keep a file's own permissions on a macos dashboard save - #31436
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the macOS ACL carry sits in the shared staging step, behind the existing descriptor seam, and refuses the save when it fails. Notes
[DESIGN-REVIEWED] 7f99972 Description read[DESCRIPTION-READ] dc52c8eb1057a1166d503a0cf0ec342c660f62c2dde0b7b8864cc8164a7b41eb That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The ACL copy goes into the shared save step itself, and the doc text this PR adds says the cron merge's in-place rewrite is no longer needed for ACLs. Not checked: whether libSystem's Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: on macOS, a file saved from the dashboard keeps the access entries its owner put on that file. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 7f99972 Description read[DESCRIPTION-READ] 38ace0184af09ad335d536756597838757ee3d55f0ae7d3bc92b5e63a623262c That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
b86fc21 to
f685e26
Compare
|
[operator: bolichen97]
|
f685e26 to
7ac7eec
Compare
|
[operator: bolichen97] Rebased: main moved in docs/system-specs/modules/cli.md, src/kiro_crew/mcp_cleanup.py, src/kiro_crew/crew_log/store.py and 10 more files beside this change since this head went green (85ce466 -> 38a8ef5); CI re-running. The previous head's only red was |
7ac7eec to
c996e57
Compare
|
[operator: bolichen97] Rebased: main moved in docs/system-specs/modules/cli.md, docs/system-specs/modules/memory-skills-hooks.md, docs/system-specs/modules/steering-viewer.md, src/kiro_crew/atomic_write.py, test/test_atomic_write_acl_preservation.py since this head went green (38a8ef5 -> 1f819b8); CI re-running. The Windows half of #13035 (#31695) merged in the same files, so the issue line is now |
c996e57 to
b3db98d
Compare
On macOS, saving a file from the dashboard (the file editor, a steering document or a skill) replaced it with a new copy that kept only the permissions its folder hands down. An access entry the owner had set on the file itself was lost by a single save. The new copy now takes the replaced file's own access entries before any content is written to it. A save that cannot keep them is refused, the original file is left as it was, and no temporary file is left behind. Cleaning up that temporary file never opens its content to an account the entries kept out.
|
[operator: bolichen97] Rebased: main moved in docs/system-specs/modules/cli.md, docs/system-specs/modules/memory-skills-hooks.md and other files since this head went green (c5c4de1 -> e4611c5); CI re-running. The patch is unchanged (range-diff identical). This is the third and last re-sync on this PR. |
b3db98d to
7f99972
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on 7f99972, no conflict, no open change request.
Pull Request is not mergeable
On macOS, saving a file from the dashboard (the file editor, a steering document or a skill) replaced it with a new copy that kept only the permissions its folder hands down. An access entry the owner had set on the file itself was lost by a single save. The new copy now takes the replaced file's own access entries before any content is written to it. A save that cannot keep them is refused, the original file is left as it was, and no temporary file is left behind. Cleaning up that temporary file never opens its content to an account the entries kept out. (cherry picked from commit 6f9aaf6)
Problem / Motivation
Goal: On macOS, saving a file from the dashboard keeps the access entries the owner set on that file.
On macOS, a save from the dashboard file editor, a steering document or a skill replaced the file with a new copy. The copy kept only the permissions its folder hands down, so an access entry the owner had added to the file itself was gone after one save. This is the code defect behind the first macOS test group in #12268 section 3.
Why it matters
A macOS user who narrows one file below its folder, for example so that another account cannot read it, loses that restriction the first time they save the file from the dashboard, and nothing tells them.
Not a goal
What changed (motivation → approach → change)
A dashboard save writes the new content to a temporary copy beside the file, then swaps the copy in. On Linux that save already copies the file's access entries onto the copy. macOS keeps them where that copy step does not look, so on macOS nothing was copied.
On macOS the save now gives the temporary copy exactly the replaced file's own access entries, inherited ones included, before any content is written to it (
atomic_write.py, with the macOS calls in a newmacos_acl.py). A file with no entries of its own, or on a disk without access lists, saves as before. If the entries cannot be read or copied, the save is refused and the original is left as it was.A refused save still cleans up its temporary copy. When the copied entries stop a plain delete, the copy is first made owner-only (no group or other access), then its entries are emptied so it can be removed, so a "deny read" entry is never lifted while another account could still open the new content. If the copy cannot be made owner-only, it keeps its entries and stays. If its folder refuses the removal anyway, the copy gets its entries back, so a copy left behind is never less restricted than the file it was meant to replace.
The specs under docs that describe these saves say what is kept on macOS.
Backwards compatibility
Breaking: on macOS, a dashboard save of a file whose own access entries cannot be read or copied is refused and the file is left unchanged; before, that save went through and dropped the entries. Writer sweep on origin/main @ a47c2d4: the three callers that hand the shared save step the file being replaced on macOS (the dashboard file save, the steering update, the skill update) already report a failed write as a failed save. Every other caller hands it no file on macOS and is unchanged, its cleanup included.
Tests
Determinism: both changed test files passed 20 of 20 runs at
-n0, 10 of 10 at-n 2 --dist loadgroupbeside two sibling files, and a shuffled order of both (seed 31436). The macOS checks compare an entry's fixed account id, so they do not depend on a name lookup.Proof: PROVEN test/test_atomic_write_acl_preservation.py::test_macos_extended_acl_survives_a_pinned_replace, test/test_atomic_write_acl_preservation.py::test_a_temp_is_owner_only_before_its_acl_is_emptied_for_removal (head c996e57)
The production code is the same on the current head.
prove.pycannot repeat that verdict there: reverting the production code also removes the moduletest/test_macos_acl.pyimports, which stops collection before any test runs.Manual verification
On macOS 26.7.2 (Apple silicon), an isolated gateway on loopback with its own data home saved a file carrying one extra entry (
user:nobody deny read) through the dashboard's file-write endpoint:The macOS test groups from #12268 section 3 pass on main on this Mac (312 passed, 20 skipped), and the dashboard file, steering, skill and cron-merge tests pass with this change.
Screenshots / video
N/A: backend only, nothing on screen changes.
Related Issues
Part of #12268
Closes #13035
#12268 status: section 3's four test groups were already fixed on main, and this change fixes the code defect behind group 1 for the three dashboard saves. Section 1's row fix shipped; the login implementation it names is intentionally absent (a test pins that no backend implements it, and #11596 is closed). Section 2 shipped in #17721.
Sibling sweep
Siblings: none -- the three dashboard saves share the one save step this fixes, and every other caller of that step hands it no file to copy from on macOS.
Pattern harvest
Not generalizable: the loss came from one platform keeping access entries where the shared save step did not look, not from a code shape a rule could match.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)