Skip to content

feat(agent): add provider-agnostic secret reference scheme#442

Draft
leoparente wants to merge 1 commit into
developfrom
feat/generic-secret-scheme
Draft

feat(agent): add provider-agnostic secret reference scheme#442
leoparente wants to merge 1 commit into
developfrom
feat/generic-secret-scheme

Conversation

@leoparente

@leoparente leoparente commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

Adds a provider-agnostic secret reference scheme: ${secret://<body>} is resolved by whichever secrets manager is active on the agent (vault, delinea, doppler, cyberark, or fleet). A policy or config can now reference a managed secret without naming the provider, so the same reference works on any agent regardless of which secrets manager it is configured with, and upstream layers can submit references without knowing the agent's provider.

Fully backward compatible: the provider-specific schemes (${vault://…}, ${fleet://…}, …) keep working unchanged. secret is a reserved scheme (no provider uses that name). The reference body stays in the active provider's own grammar — secret:// removes the provider name from the reference, not the provider's path format.

How

  • agent/secretsmgr/resolver.go: the shared placeholder matcher now accepts the generic scheme as an alternative to the provider's own (${(?:<scheme>|secret)://…}, non-capturing so match indices are unchanged). All four polling providers pick this up with zero per-provider changes, for both policy and config resolution; first-match/whole-string semantics are untouched.
  • agent/secretsmgr/fleet.go: same alternation in the fleet reference regex, so the generic scheme also works with the fleet secrets manager (policy references).
  • Known limitation (pre-existing, now documented): with the fleet secrets manager active, secret references inside the agent's own CONFIG cannot resolve — config resolution runs at startup, before the MQTT session is established, and this has always been true for ${fleet://…} config references. The previously cryptic MQTT publisher not bound error now explains this case. Policy references are unaffected.
  • No secrets manager configured: a ${secret://…} reference now fails fast with a managed secret reference (${secret://…}) was found but no secrets manager is configured — the generic scheme explicitly requests the active manager, so a clear error beats the literal placeholder reaching the backend. Provider-specific schemes keep their pre-existing passthrough behavior.

Docs

New docs/secretsmgr/secret_references.md documenting the generic scheme, the per-provider body grammar, the no-manager fail-fast error, and the fleet config-level limitation; linked from the README and from each provider page.

Testing

  • Generic scheme resolves identically to the native scheme through the shared polling base (policy and config paths) and through the fleet manager.
  • A payload mixing a native reference and a generic reference resolves both.
  • Dummy manager: generic reference errors (policy path, backends map, and the ManagerConfig branch); provider-specific references and plain values pass through unchanged with no error.
  • All existing tests pass unchanged. Gates: go build ./..., go test -count=1 -race ./agent/secretsmgr/... (including the Docker-backed Vault tests), golangci-lint --config .github/golangci.yaml = 0 issues, gofumpt clean.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 2.31s github.com/netboxlabs/orb-agent/agent 53.4% 20 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend 78.0% 114 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 81.8% 27 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/gnmidiscovery 85.4% 4 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 79.2% 4 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/opentelemetryinfinity 83.7% 46 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/pktvisor 82.3% 20 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/snmpdiscovery 82.1% 15 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/worker 83.1% 31 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/config 89.5% 37 0 0
🟢 PASS 11.57s github.com/netboxlabs/orb-agent/agent/configmgr 55.5% 57 0 0
🟢 PASS 3.56s github.com/netboxlabs/orb-agent/agent/configmgr/fleet 67.9% 176 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/configmgr/fleet/messages -- 6 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/filesmgr 80.9% 79 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/otlpbridge 58.1% 19 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/policies 99.2% 35 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/policymgr 80.2% 24 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/redact 81.6% 84 0 0
🟢 PASS 10.96s github.com/netboxlabs/orb-agent/agent/secretsmgr 73.4% 206 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/telemetry 83.8% 28 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/version 62.5% 5 0 0

Total coverage: 74.4%

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Vulnerability Scan: Passed

Image: orb-agent:scan

No vulnerabilities found.

Commit: 4fcb8d5

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fddf99539

ℹ️ 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".

Comment thread agent/secretsmgr/fleet.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a provider-agnostic secret placeholder scheme (${secret://…}) that resolves through whichever secrets manager is active, while preserving backward compatibility with provider-specific schemes (e.g., ${vault://…}, ${fleet://…}), and adds docs/tests to cover the new behavior.

Changes:

  • Extend shared placeholder matching to accept ${secret://…} as an alternative to the active provider scheme.
  • Make the dummy (no-manager) secrets manager fail fast on ${secret://…} references instead of passing them through.
  • Add documentation and tests for the generic scheme across polling providers and the Fleet secrets manager.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Links and briefly introduces the provider-agnostic ${secret://…} reference scheme.
docs/secretsmgr/vault.md Documents that ${secret://…} can be used in place of ${vault://…}.
docs/secretsmgr/doppler.md Documents that ${secret://…} can be used in place of ${doppler://…}.
docs/secretsmgr/delinea.md Documents that ${secret://…} can be used in place of ${delinea://…}.
docs/secretsmgr/cyberark.md Documents that ${secret://…} can be used in place of ${cyberark://…}.
docs/secretsmgr/secret_references.md Adds a dedicated doc describing generic references, provider body grammar, and no-manager behavior.
agent/secretsmgr/resolver.go Updates the shared placeholder regex to match either the provider scheme or secret.
agent/secretsmgr/polling_test.go Adds tests ensuring polling-base resolution supports ${secret://…} for both policy and config paths.
agent/secretsmgr/manager.go Makes the dummy manager reject ${secret://…} references during policy/config secret solving.
agent/secretsmgr/manager_test.go Adds tests for dummy-manager rejection/passthrough behaviors.
agent/secretsmgr/fleet.go Extends Fleet secret reference matching to also accept ${secret://…}.
agent/secretsmgr/fleet_test.go Adds a test case validating ${secret://…} resolution via the Fleet secrets manager.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent/secretsmgr/fleet.go Outdated
Comment thread agent/secretsmgr/manager.go
Comment thread docs/secretsmgr/secret_references.md
@leoparente
leoparente force-pushed the feat/generic-secret-scheme branch from 3fddf99 to f0d725b Compare July 2, 2026 20:50
@leoparente
leoparente force-pushed the feat/generic-secret-scheme branch 2 times, most recently from 90b965c to 862cd86 Compare July 2, 2026 21:07
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 862cd868e1

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread agent/secretsmgr/resolver.go
@leoparente
leoparente force-pushed the feat/generic-secret-scheme branch 2 times, most recently from bdf5570 to 75ec647 Compare July 2, 2026 21:21
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 75ec647b54

ℹ️ 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".

@leoparente
leoparente requested a review from Copilot July 2, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread agent/secretsmgr/fleet.go Outdated
@leoparente
leoparente force-pushed the feat/generic-secret-scheme branch from 75ec647 to 40efbb7 Compare July 2, 2026 22:44
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40efbb7b3b

ℹ️ 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".

Comment thread agent/secretsmgr/fleet.go Outdated
Policies and config can now reference managed secrets as ${secret://<body>}
instead of naming a specific provider. The reference is resolved by whichever
secrets manager is active (vault, delinea, doppler, cyberark, or fleet); the
body is still interpreted using that provider's own grammar unchanged. All
provider-specific schemes (${vault://…} etc.) keep working exactly as before.

When no secrets manager is configured, the dummy manager now rejects any
${secret://…} reference with a clear error instead of forwarding it to the
backend as a literal string; provider-specific placeholders continue to pass
through untouched in that case, as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@leoparente
leoparente force-pushed the feat/generic-secret-scheme branch from 40efbb7 to fc5de31 Compare July 3, 2026 00:29
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: fc5de319c3

ℹ️ 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".

@leoparente
leoparente marked this pull request as draft July 3, 2026 11:16

@paulstuart paulstuart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leoparente
leoparente marked this pull request as ready for review July 7, 2026 16:55
@davidlanouette

Copy link
Copy Markdown

Please don't merge this.

While talking to Dom it came out that we are going to need to support multiple secrets providers per client - something that this proposal seems to implicitly assume won't be true.

@leoparente
leoparente marked this pull request as draft July 7, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants