fix(environment): clamp zip entry modes during skill extraction#68
Merged
Conversation
Skill zips normalized by older fc-safari builds carry entries with no mode bits: a directory entry reads back as 0666 (no execute bit), and honoring it verbatim creates an un-traversable staging dir — every file inside then fails with EACCES (prod skill-load failures, 2026-06-11). Clamp dirs to owner-rwx and files to owner-rw so such archives still install; archives with sane modes are unaffected.
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.
Problem
Prod skill loads fail deterministically with:
Root cause (reproduced byte-for-byte): fc-safari's zip normalization rewrote entries without mode bits. A mode-less directory entry reads back as
0666— no execute bit — andunzipSkillhonored it viaMkdirAll(absTarget, f.Mode()), creating an un-traversable staging dir. Every file inside then fails with EACCES.Fix
Clamp extraction modes: dirs
Perm()|0o700, filesPerm()|0o600. OR only adds bits, so archives with sane modes (incl. exec bits on scripts) are unaffected. The runner-side clamp is required even though fc-safari is fixed separately — broken normalized zips are already persisted in S3.Verification
TestSyncSkill_ModelessDirEntryZip: red on old code with the exact prod error, green with fix.environment.New+SyncSkillon a prod-replica zip: full install chain (staging → checksum → rename) succeeds, file readable, dir traversable.go build ./... && go vet ./... && go test ./...all green; gofumpt clean.