feat: phantom-credential brokering for tool execution (credential never enters the child) - #16
Merged
Merged
Conversation
…er enters the child) New perseus_agent_core/credentials.py implementing the CredentialBroker interface (#11): - CredentialVault: supervisor-side vault; real secrets live here and nowhere else; zeroise overwrites the secret on exit. - PhantomCredentialBroker: broker() creates a phantom-token lease (policy deny or timeout => BrokerDenied with zero credential material, null effect on deny); execute() runs the child with only the phantom token in its environment and revokes/zeroises the lease on exit; swap_at_boundary() is the proxy that injects the real credential only inside the boundary and zeroises it on exit. - git_style_tool(): reference git/gh-style invocation path through the broker. - Receipts (BrokerLease.as_receipt) record credential id, tool, outcome, and caller-supplied canonicalized argv fields - never the secret value, never raw argv bodies. Tests (7, all passing): child env/file/argv hold only the phantom token; the real credential never enters the child; boundary swap + zeroise on exit; aborted path leaves no credential material; policy deny and timeout are null-effect; receipts never contain the secret or phantom token. Full suite: 10 passed (3 pre-existing test_vault_backend failures reproduced on clean main at ac05a11 - unrelated to this change). Closes #11
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
Implements the phantom-credential brokering pattern (agent-core #11): the real credential never enters the child process.
New
perseus_agent_core/credentials.py:CredentialBroker(Protocol interface) +PhantomCredentialBroker— supervisor-side vault, phantom-token injection, boundary swap, zeroise-on-exit.CredentialVault— holds real secrets;zeroise()overwrites the secret in memory on exit.broker()— creates a phantom-token lease; policy deny or timeout raisesBrokerDeniedwith zero credential material (null effect on deny).execute()— runs the tool child with only the phantom token in its environment (PERSENS_PHANTOM_TOKEN); lease revoked/zeroised on exit (including timeout).swap_at_boundary()— the proxy: validates the phantom and injects the real credential only inside the context (the network boundary); real secret zeroised when the context exits.git_style_tool()— reference git/gh-style invocation wired through the broker.BrokerLease.as_receipt) — credential id, tool, outcome, caller-supplied canonicalized argv fields; never the secret value.Tests (actual output)
python -m pytest tests/test_credentials.py -q→ 7 passed in 0.11s:PERSENS_CREDENTIAL is None)BrokerDeniedwith no materialFull suite: 10 passed; the 3
test_vault_backend.pyfailures are pre-existing (reproduced on clean main atac05a11).git diff --check→ clean.Acceptance criteria
Closes #11