Repository navigation
Conversation
github-device-fetch.sh created the state directory and cookie jar under the default umask (0755/0644 on most systems) and only chmod'ed the env file afterwards. github-device-poll.sh set umask 0077 after curl had already rewritten the cookie jar, which by then holds the admin coder_session_token. Set umask 0077 right after set -euo pipefail in both scripts so the state directory, cookie jar, env file and response file are owner-only from creation, and drop the now-redundant post-hoc chmod. Claude-Session: https://claude.ai/code/session_012e1sTYKpjcPyQfVzSh6bmQ
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
skills/setup/scripts/github-device-fetch.shcreates$STATE_DIRand the cookie jar under the caller's umask, and only runschmod 0600on the env file once it's been written.github-device-poll.shrunsumask 0077only after its polling loop, so the cookie jar curl rewrites while polling (which by then holds the admincoder_session_token) andgithub-device.respare created under the default umask too.With a typical umask of
022, the fetch step leaves this behind:Fix
Add
umask 0077right afterset -euo pipefailin both scripts, so every scratch file and directory is owner-only when it's created. Remove the separatechmod 0600and the lateumaskthey replace.With the patch, from the same umask
022:Testing
github-device-fetch.shbefore and after the change against a local stub that mimics the callback 307 +Set-Cookieand the/deviceJSON. The permissions shown above come from those runs.shellcheckpasses on both scripts.umask 0077earlier.https://claude.ai/code/session_012e1sTYKpjcPyQfVzSh6bmQ