Skip to content

Add GitHub PAT setup and devcontainer auth (safety fixes only)#7

Open
Ramarti wants to merge 4 commits intomainfrom
safety-only
Open

Add GitHub PAT setup and devcontainer auth (safety fixes only)#7
Ramarti wants to merge 4 commits intomainfrom
safety-only

Conversation

@Ramarti
Copy link
Copy Markdown
Contributor

@Ramarti Ramarti commented May 6, 2026

Summary

  • Add scripts/setup-gh-token.sh for fine-grained PAT setup with macOS Keychain storage, token validation, and atomic shell-profile edits
  • Wire setup_gh_auth() into .devcontainer/post_install.py so containers pick up GH_TOKEN and run gh auth setup-git for HTTPS push/pull
  • Promote web3-auditor persona from placeholder to complete (CLAUDE.md, settings)
  • Update README with claude-container shell function and devcontainer auth instructions
  • Add tests for setup-gh-token.sh and post_install.py

This is a strict subset of #6 — same four commits, without the additional web3-auditor commands/hooks commit. Open it in case we want to land the safety-related review fixes (PAT validation, Keychain storage, atomic sed, mv error handling) independently.

Test plan

  • bash tests/test_setup_gh_token.sh
  • uv run pytest tests/test_post_install.py
  • Manual: run scripts/setup-gh-token.sh end-to-end with a fine-grained PAT
  • Manual: build devcontainer with GH_TOKEN set; verify gh api user and git push both work

🤖 Generated with Claude Code

Ramarti and others added 4 commits March 13, 2026 22:22
…e, atomic sed

- Return early in setup_gh_auth() when GH_TOKEN is invalid, skipping
  the useless gh auth setup-git call
- Replace sed -i.bak with grep -v + mktemp/mv to avoid .bak file leaks
- Store tokens in macOS Keychain instead of plaintext in shell profile;
  fall back to plaintext on Linux with a warning
- Add source guard to setup-gh-token.sh for testability
- Add pytest tests for _warn_broad_token() and setup_gh_auth()
- Add bash tests for remove_existing_gh_token() and store_token()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Log stderr from gh auth status on failure for debuggability
- Replace grep/head/cut chain with jq in curl fallback for robust
  JSON parsing in validate_token()
- chmod 600 shell profile after writing plaintext token on Linux
- Add test for stderr logging and chmod 600 behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If mv fails, clean up the tmpfile and return non-zero instead of
leaving a dangling temp file and continuing with a missing profile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant