Repository navigation
feat(defense-in-depth): bootstrap Safe Chain from a Claude Code SessionStart hook - #66
Merged
Merged
Conversation
…t hook Claude Code on the web does not run the Dev Container or Cursor install, and hook stdout is injected into the session. Bootstrap from session-start.sh with a 600s timeout, keep the install log on stderr, and track the hook in git. Co-authored-by: Jared Wray <me@jaredwray.com>
jaredwray
marked this pull request as ready for review
September 27, 2026 04:37
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. |
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.
Claude Code on the web never runs the Dev Container
postCreateCommandor Cursor'sinstall, so those sessions started without Safe Chain shims. writr#553 is the setup that fixes that. This teachesdefense-in-depth-nodejsto produce it.What the skill now copies
.claude/hooks/session-start.shruns only whenCLAUDE_CODE_REMOTE=true,cds to$CLAUDE_PROJECT_DIR, and runsscripts/setup-cloud-environment.shwith stdout sent to stderr. Hook stdout is injected into the session, so the install log must not land there..claude/settings.jsonregisters that script as a synchronous SessionStart command with a 600s timeout. The default 60s timeout kills a cold Safe Chain install. There is no matcher, so resume,/clear, compaction, and forks re-run it..gitignoreuses.claude/*plus!.claude/settings.jsonand!.claude/hooks/. A blanket.claudeignore cannot be negated, so the hook would never be committed.PATHstays insetup-cloud-environment.sh, written toCLAUDE_ENV_FILEbefore the bootstrap can fail, with blocking stubs until Safe Chain replaces them. The hook does not appendPATHafter the script returns — that write is skipped when the bootstrap fails, which would leavepnpmunshimmed.agentic-upstream-synctreats the hook script as a verbatim copy, same assetup-cloud-environment.sh.The § 2 Safe Chain catalog line names the hook, the 600s timeout, and the gitignore exceptions, so a repo that already checked the item off with an inline command is re-audited.
Verification
node scripts/validate-skills.mjsnode scripts/validate-safe-chain-setup.mjs(hook is a silent no-op locally; in a cloud session the install log stays off stdout, and a failed bootstrap still writes the shimPATH)