Repository navigation
Add role hooks and fnox key resolution to safe - #85
Merged
Merged
Conversation
role-<role>.sh is sourced after the tool's hook, so the work role can export AWS credentials from AWS_PROFILE and opt in to one docker socket. Hooks add generated rules with safe_profile_add, which replaces the socket-only profile. SAFE_FNOX_KEYS resolves secrets with fnox export, so callers don't need to wrap safe in fnox exec. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
Summary
safenow sourcesconfig/agent-safehouse/role-<role>.shafter the tool's hook, so the role can set env and add rules at run time, not just ship a static.sb.safe_profile_add. The socket grants use it too, so there's one generated profile per run instead of a socket-only one.role-work.shexports short-lived AWS credentials forAWS_PROFILE(skipped when unset, and a lapsed SSO login warns instead of failing) and grants one docker socket whenSAFE_DOCKER=1.role-work.sbgets the sorbet and rubocop cache grants.SAFE_FNOX_KEYSnames secrets thatsaferesolves withfnox exportand passes through, so callers can stop wrappingsafeinfnox exec. The prime-agent profile defaults it toOPENROUTER_API_KEY.This is what lets a per-tool wrapper script go away:
safe prime-agentgets the same setup however it's launched.Notes for review
~/.local/share/safe/<tool>) is now created for any toolsaferuns, not only tools with a.sh, because role hooks use it (the docker config copy).AWS_PROFILEis set, not just prime-agent.role-work.sbalready denies sandbox writes to the dotfiles worktree they live in. ADR 0064 says so.Test plan
Ran
bin/safeagainst its own config copy with the realsafehouse, from an unsandboxed terminal:AWS_PROFILEset, the AWS credential vars and aSAFE_FNOX_KEYSsecret are set inside the sandbox, and~/.awsstays unreadable.SAFE_DOCKER=1makesdocker versionwork through the granted socket, and the copied config has noauths. Without it, docker can't connect.safe prime-agent --versionruns under the profile, and no generated profiles are left in$TMPDIR.Also ran it with a stubbed
safehouseandawsto check the home role adds nothing and a missing fnox key warns and is skipped. A full prime-agent session (daemon, kernel venv, a model call) needs this merged and deployed first, so that's still to do.🤖 Generated with Claude Code