Add federation routes to RBAC static API list - #747
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
The federation management routes are registered and served in api/agent/server.go but are absent from staticAPIV1List, so validateInitParameters rejects any RBAC policy that names them and authorizeAPIV1Request denies them for every role. That leaves /api/v1/spire/federations and the clusterfederatedtrustdomains route unreachable whenever RBAC is enabled. Adds both to the static list with the methods the router registers, matching the existing /api/v1/spire/federations/bundles entry. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
arpitjain099
requested review from
lumjjb,
maia-iyer,
mamy-CS and
mrsabath
as code owners
July 21, 2026 18:22
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.
The federation management routes are registered on the API router in
api/agent/server.gobut never made it intostaticAPIV1Listinpkg/agent/authorization/rbac.go:/api/v1/spire/federationsGET/POST/PATCH/DELETE (server.go:210-213)/api/v1/spire-controller-manager/clusterfederatedtrustdomainsGET/POST (server.go:216-217)Because the list is what
validateInitParameterschecks policies against, naming either path in an RBAC policy fails startup with "API V1 path ... does not exist with method ...". And since they can't be in the mapping,authorizeAPIV1Requestfinds no allowed roles and denies them for everyone. So with RBAC enabled these endpoints are unreachable regardless of role, even for admin.The direction is fail-closed, so this isn't an authorization bypass, just federation management being unusable under RBAC.
The sibling
/api/v1/spire/federations/bundlesentry already covers all four of its methods, so I followed that entry's shape. Methods match what the router registers. OPTIONS is left out on purpose sinceverificationMiddlewareshort-circuits preflight before authorization, same as every other entry.Test: extended
rbac_test.gowithTestRBACPolicyAcceptsFederationRoutes, which builds a one-route policy for each path/method pair and assertsNewRBACAuthorizeraccepts it.Before the fix, all six pairs fail:
After:
go build ./...is clean. The existingTestNewRBACAuthorizerstill passes, so the added entries don't loosen the negative cases.I work on supply-chain security and was reading through Tornjak's authorization layer when I noticed the route table and the static list had drifted apart.