[PoC] codex agent authorization hook#163
Open
patatoid wants to merge 16 commits into
Open
Conversation
patatoid
marked this pull request as ready for review
June 13, 2026 18:13
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
This PR adds a proof-of-concept Codex hook integration backed by Boruta authorization.
The hook maps Codex lifecycle events and tool usage to Boruta scopes, chains hook events through Boruta authorization codes, and optionally uses browser-based authorization for sensitive actions such as permission requests, file patches, mutating commands, process stdin writes, image generation, and escalated sandbox requests.
What Changed
Security Model
Each Codex hook event is authorized as part of a chained session. The latest authorization code is stored locally and sent as the previous code for the next event, allowing Boruta to audit a sequence of prompt, tool call, permission request, result, and stop events.
The hook derives scopes from Codex events and tool payloads, for example:
Boruta must know these scopes, the OAuth client must be allowed to request them, and the authorizing user or backend identity should receive them through the seeded codex role.
Local State
The hook writes sensitive local state outside the repository:
~/.boruta/session-code-chain.json
~/.boruta/codex-hook-session.json
~/.boruta/codex-hook-scopes-session.json
~/.boruta/codex-hook-docker-compose-session.json
~/.boruta/keys/
Expected permissions:
~/.boruta/keys 0700
private keys 0600
public JWKs 0644
session and marker JSON files 0600
Notes
This is intended as a proof of concept, not a hardened production policy system. Enforcement depends on Codex hook execution and BORUTA_CODEX_HOOK_ENFORCE=true; disabling enforcement reports authorization failures but lets Codex continue.