Skip to content

feat(secrets): custody protocol, broker and CLI core (#922, PR 1 slice) - #923

Draft
defangdevs wants to merge 1 commit into
masterfrom
feat/922-secret-custody
Draft

defangdevs wants to merge 1 commit into
masterfrom
feat/922-secret-custody

Conversation

@defangdevs

Copy link
Copy Markdown
Owner

Part of #922 (PR 1, first slice). Draft: payloads and unit tests only.

What is here

  • modules/src/lib/secret-protocol.py: length-prefixed JSON framing (64 KiB cap, checked before allocation), strict request schema that refuses unknown fields, and the record store (0700/0600, directory-fd + O_NOFOLLOW, temp+fsync+rename, flock, namespace bound to user+uid, tombstone on remove).
  • modules/src/secret-broker.py: root broker for one user; checks SO_PEERCRED uid; the request cannot pick uid, path or namespace. No operation returns a value.
  • modules/src/secret-cli.py: agent-box-secret list | set NAME --stdin | remove NAME.
  • tests/test-secret-custody.py: 8 tests over a real Unix socket (python3 tests/test-secret-custody.py).

What is NOT here (so PR 1 stays unchecked on #922)

  • No services.agent-box.secrets.enable, units, socket, contract, bin/agentbox wiring or generated module/fixtures.
  • No VM test. The OS boundary (agent user cannot read records or the socket, uid spoofing, two users) is unproven; the host that wrote this has no KVM. The unit tests do not claim it.
  • Needs privileged-code security review before anything ships.

Open question

Reading meta.json binding stores user as the namespace name; confirm that is the namespace scheme you want before wiring.

🤖 Generated with Claude Code

…922)

Slice of PR 1: the payloads and their unit tests only. Not wired into
either backend yet, so nothing is rendered, enabled or deployed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M3UqKAcm8ivvcx2JwwNide
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant