Stop the media rsync clamping the upload ACL mask - #224
Merged
Conversation
The documented media sync used --chmod=D755, which is what caused the 2026-09-01 outage where POST /v1/media returned 500 on every upload. A chmod on an ACL'd directory sets the ACL mask from the mode's group bits, and the mask caps every named entry. D755 therefore clamped the backend's user:10001:rwx grant to #effective:r-x on every directory the sync touched. getfacl still prints user:10001:rwx and ls shows only a +, so it reads as correct, and uploads keep working until the 1st of the next month -- the first time the handler has to create a new YYYY/MM directory. D775 keeps the mask at rwx and matches the 0775 the CMS itself creates month directories with. Verified on CephFS against a fixture reproducing the live ACL: D755 reproduces the clamp exactly, D775 leaves the mask rwx, the new month directory inherits the grant, uid 10001 can create the next month, and the synced files stay world-readable for nginx. deploy/README.md claimed the default ACL entry meant this "does not need repeating every month". That is true until something chmods the tree, and believing it is what let the bug hide for a month; it now documents the mask. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tx3ywgRQLzzrZWNcSdtTpr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the 2026-09-01 outage where
POST /v1/mediareturned 500 on every upload. triangle-infrastructure#2 makes Ansible repair the damage; this fixes the command that causes it.The cause
docs/HANDOVER.mddocumented the media sync as:A chmod on an ACL'd directory sets the ACL mask from the mode's group bits, and the mask caps every named entry. So
D755clamped the backend'suser:10001:rwxgrant to#effective:r-xon every directory the sync touched.getfaclstill printsuser:10001:rwxandlsshows only a+, so it reads as correct. Uploads then keep working until the 1st of the next month — the first time the handler has to create a newYYYY/MMdirectory:The fix
D775instead ofD755. The group write bit is load-bearing: it keeps the mask atrwx, and it matches the0775the CMS itself creates month directories with (media.goMkdirAll).Verified on CephFS
Against a scratch fixture reproducing the live uploads ACL, then removed:
D755(old)D775(new)mask::r-x— clampedmask::rwx#effective:r-xuser:10001:rwx0664)The old command reproduced the outage exactly, including that
default:mask::rwxsurvives while the access mask drops — which is what makes the ACL look healthy.Also corrected
deploy/README.mdclaimed the default ACL entry meant this "does not need repeating every month". That holds until something chmods the tree, and believing it is a large part of why the bug hid for a month. It now documents the mask and how to check it.docs/ETL-REBUILD.mdgains the check in post-load verification.Docs only — no code changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Tx3ywgRQLzzrZWNcSdtTpr