Skip to content

feat(dir): grant registry credentials only to peer nodes named by SPIFFE ID - #2246

Merged
muscariello merged 3 commits into
feat/policy-gate-gapsfrom
feat/registry-credentials-peers
Oct 2, 2026
Merged

muscariello merged 3 commits into
feat/policy-gate-gapsfrom
feat/registry-credentials-peers

Conversation

@muscariello

@muscariello muscariello commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Closes #2245. Part of #2240 and #2205. Stacked on #2241: main ← #2226 ← #2229 ← #2235 ← #2237 ← #2238 ← #2241 ← this.

Why

RequestRegistryCredentials hands out the registry password, which reads every record straight from the registry without passing through the server's policy gate. Authorization matched only the caller's trust domain, so the default p,example.org,* gave the node's own users that password along with everything else.

What this changes

  • Authorization sees the full SPIFFE ID. A policy subject starting with spiffe:// names callers by ID, exactly or by a prefix ending in *. It is never treated as a regular expression: an unanchored one would let .../sa/dir match .../sa/dirctl. Any other subject is a trust domain, matched as before.
  • Only an ID rule grants registry credentials. A trust-domain rule, * included, no longer does. Every other method is authorized exactly as before, and existing two-column policy files load unchanged.
  • Default policies fixed. The Helm defaults and the OpenShift guide granted /agntcy.dir.sync.v1.SyncService/RequestRegistryCredentials, but the service is agntcy.dir.store.v1.SyncService, so the rule matched nothing and external peers were refused. They now show an ID rule, commented out, for the operator to fill in with the peers allowed to sync from the node. The authz README documents ID rules and its SyncService paths are corrected.

Upgrade impact

Deployments that let peers sync through a trust-domain rule, such as the p,*,/agntcy.dir.store.v1.SyncService/RequestRegistryCredentials the Kubernetes and EKS federation guides showed, will refuse credentials until they add a rule naming each peer's SPIFFE ID, e.g. p,spiffe://partner.org/ns/dir/sa/dir-apiserver,/agntcy.dir.store.v1.SyncService/RequestRegistryCredentials. The peer calls with its reconciler's ID. Deployments on the Helm defaults see no change for external peers, which were already refused.

With authz disabled, the default, every caller can still call every method, credentials included; this PR changes only what policies grant.

Testing

  • Registry credentials: the node's own user, a workload whose ID only starts with a peer's, and an unnamed caller are refused; a named peer and a workload under a peer prefix are granted. This holds even though the same policies also grant the method to every trust domain.
  • Trust-domain rules still grant every other method, and a peer ID rule grants only its method.
  • Through the interceptor, which the authn interceptor feeds the SPIFFE ID: the node's own user is denied credentials, a named peer is let through, a request with no ID is unauthenticated.
  • The existing table changes only in the three rows where a trust-domain rule granted credentials.
  • Every policy the charts ship or the docs show is checked against the services the server registers. Against the old defaults it reports all six misspelt paths.
  • Mutation-checked, every mutant compiling: letting trust-domain rules grant credentials, also matching ID rules as regexes, treating no subject as an ID, matching an ID without its path, and an interceptor that drops the ID's path or ignores a denial each make a test fail.
  • server/authz tests pass and server vets clean. The chart can't be rendered locally without its dependency charts, so the three edited values files were parsed instead and yield the expected policy text.

@muscariello
muscariello requested a review from a team as a code owner September 30, 2026 19:10
@muscariello muscariello added area/dir/server kind/security Categorizes issue or PR as related to security. size/S Denotes a PR that changes 50-199 lines labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedOct 2, 2026, 12:59 PM

@github-actions github-actions Bot added size/M Denotes a PR that changes 200-999 lines and removed size/S Denotes a PR that changes 50-199 lines labels Sep 30, 2026
@muscariello
muscariello added this pull request to stack #2234 September 30, 2026 19:18
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/authz/authorizer.go 83.3% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

csirmazbendeguz
csirmazbendeguz previously approved these changes Oct 2, 2026
@muscariello
muscariello dismissed csirmazbendeguz’s stale review October 2, 2026 12:05

The merge-base changed after approval.

@muscariello
muscariello force-pushed the feat/registry-credentials-peers branch from b0da71b to b0d87b0 Compare October 2, 2026 12:05
@muscariello
muscariello force-pushed the feat/registry-credentials-peers branch from b0d87b0 to 462afa1 Compare October 2, 2026 12:33
…FFE ID

RequestRegistryCredentials hands out the registry password, which reads
every record straight from the registry without passing through this
server's policy gate. Authorization matched only the caller's trust
domain, so a rule like "p,example.org,*" gave the node's own users that
password along with everything else.

Authorization now sees the caller's full SPIFFE ID. A policy subject
starting with spiffe:// names callers by ID, exactly or by a prefix
ending in *; it is never a regular expression, since an unanchored one
would let .../sa/dir match .../sa/dirctl. Registry credentials are
granted only by such a rule: a trust-domain rule, * included, no longer
grants them. Every other method is authorized as before, and existing
two-column policy files load unchanged.

Refs #2245

Signed-off-by: Luca Muscariello <[email protected]>
The Helm defaults and the OpenShift guide granted
/agntcy.dir.sync.v1.SyncService/RequestRegistryCredentials, but the
service is agntcy.dir.store.v1.SyncService, so the rule matched nothing
and external peers were refused credentials. Fixing the path alone would
hand the registry password to every trust domain; now that only a rule
naming a SPIFFE ID grants it, the defaults and the deployment guides show
such a rule, commented out, for the operator to fill in with the peers
allowed to sync from the node.

A test checks every policy the charts ship or the docs show against the
services the server registers, so a misspelt method fails the build
instead of silently denying access.

Refs #2245

Signed-off-by: Luca Muscariello <[email protected]>
The interceptor is where the caller's SPIFFE ID reaches authorization,
and nothing tested it. A request for registry credentials from the
node's own user is denied, a named peer's is let through, and one with
no SPIFFE ID is unauthenticated.

Refs #2245

Signed-off-by: Luca Muscariello <[email protected]>
@muscariello
muscariello force-pushed the feat/registry-credentials-peers branch from 462afa1 to b8aa2d5 Compare October 2, 2026 12:59
@muscariello
muscariello added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit deb9445 Oct 2, 2026
37 checks passed
@muscariello
muscariello deleted the feat/registry-credentials-peers branch October 2, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/dir/server kind/security Categorizes issue or PR as related to security. size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict registry credentials to peer nodes

2 participants