Repository navigation
chore: bootstrap Safe Chain in Claude Code web sessions - #553
Merged
Merged
Conversation
Claude Code on the web does not run the devcontainer postCreateCommand or .cursor/environment.json, so web sessions started without Safe Chain shims or node_modules. Add a SessionStart hook that runs scripts/setup-cloud-environment.sh in remote sessions only and writes the shim PATH to CLAUDE_ENV_FILE, since Bash tool shells do not re-read ~/.bashrc. Track only .claude/settings.json and .claude/hooks/ (local Claude state stays ignored), add /.claude/ to CODEOWNERS, and note the bootstrap in SECURITY.md and DEFENSE_IN_DEPTH.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FDGkvwCeXMsedfFUjqSrn9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FDGkvwCeXMsedfFUjqSrn9
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #553 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 515 515
Branches 144 144
=========================================
Hits 515 515 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Please check if the PR fulfills these requirements
src/changes; the hook was exercised manually (see below).What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Tooling / security hardening. Claude Code on the web sessions now bootstrap Aikido Safe Chain automatically, as Codespaces and Cursor Cloud Agents already do.
Why
Claude Code cloud sessions don't run
.devcontainer/devcontainer.json'spostCreateCommandor.cursor/environment.json, so web sessions started with no~/.safe-chain/shimsand nonode_modules. AGENTS.md forbids unshimmedpnpm, which left agents unable to install dependencies.Changes
.claude/hooks/session-start.sh(new, executable): runs only whenCLAUDE_CODE_REMOTE=true, then:scripts/setup-cloud-environment.shfrom the project root. That script is unchanged: a checksum-pinned Safe Chain--ciinstall, thenpnpm safe-chain-verifyandpnpm install --frozen-lockfile.export PATH="$HOME/.safe-chain/shims:$HOME/.safe-chain/bin:$PATH"to$CLAUDE_ENV_FILE, once. Bash tool shells don't re-read~/.bashrc, so without thispnpmstill resolves to the unshimmed binary..claude/settings.json(new): registers the hook as a synchronousSessionStartcommand with a 600 s timeout..gitignore:.claudebecomes.claude/*plus exceptions forsettings.jsonandhooks/. Local state such assettings.local.jsonstays ignored..github/CODEOWNERS: adds/.claude/, since a SessionStart hook runs commands in every web session.SECURITY.mdandDEFENSE_IN_DEPTH.md: mention the Claude Code bootstrap.Validation
CLAUDE_CODE_REMOTEunset: exit 0, no output.CLAUDE_CODE_REMOTE=true, run twice: exit 0 both times, empty stdout, a singlePATHline in the env file. A warm re-run takes about 4 s. Safe Chain reportsOK: Safe-chain works!and the lockfile passes its supply-chain policies.pnpmresolves to~/.safe-chain/shims/pnpm.pnpm exec biome check src/writr-cache.tsandpnpm exec vitest run test/writr-cache.test.ts(13 tests) both pass through the shims.pnpm buildpasses.pnpm test: Biome made no fixes; 8 files, 189 passed, 1 skipped.🤖 Generated with Claude Code
https://claude.ai/code/session_01FDGkvwCeXMsedfFUjqSrn9
Generated by Claude Code