feat(safety): add baked safety profiles#536
Conversation
Co-authored-by: Drew Burchfield <1084679+drewburchfield@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 451da8b085
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gmail: | ||
| search: true | ||
| get: true | ||
| messages: true |
There was a problem hiding this comment.
Deny gmail messages modify in readonly profile
messages: true currently allows the parent gmail.messages path, and the baked policy matcher is prefix-based, so gmail messages modify is treated as allowed. That subcommand (GmailMessagesModifyCmd) performs label updates on messages, which is a mailbox mutation and contradicts the readonly profile guarantee that mutations are blocked. Please split this into explicit subcommand rules (allow search, deny modify) or add an explicit deny for gmail.messages.modify.
Useful? React with 👍 / 👎.
Summary
build-safe.sh,make build-safe, and presetagent-safe,readonly, andfullprofilesThis is the smaller-design alternative to #366: keep Kong command structs unchanged, bake an immutable policy into the binary, and fail closed at execution time. It addresses the Gmail draft-without-send use case from #239 without the generated command-struct conflicts.
Verification
go test ./internal/cmd ./cmd/bake-safety-profilemake testmake lintmake ci./build-safe.sh safety-profiles/agent-safe.yaml -o bin/gog-agent-safe-test./build-safe.sh safety-profiles/readonly.yaml -o bin/gog-readonly-test./build-safe.sh safety-profiles/full.yaml -o bin/gog-full-test./bin/gog-agent-safe-test gmail drafts send draft-1exits 2 with baked profile blockCo-authored-by: Drew Burchfield 1084679+drewburchfield@users.noreply.github.com