Skip to content

Support cross namespace secret references with a ReferenceGrant #7048

Closed

Description

@nfarhadian

Description:
Cross namespace secret reference is not allowed in OIDC security policy, even with reference grant

I checked the code and allowCrossNamespace is "false"

false, from, oidc.ClientSecret, resources); err != nil {

Since it's false, reference grant is not checked

if !allowCrossNamespace {

Environment:
v1.5.1

Logs:
OIDC: secret ref namespace must be unspecified/empty or .

Activity

  1. arkodg commented on Sep 24, 2025

    @arkodg
    Contributor
  2. added
    kind/decision
    and removed on Sep 29, 2025
  3. zhaohuabing commented on Sep 29, 2025

    @zhaohuabing
    Member

    We need to decide whether cross-namespace secret references should be allowed for Envoy Gateway APIs(e.g., for BasicAuth, OIDC, API key auth).

    I lean toward only supporting secrets within the same namespace to keep things simple and avoid unnecessarily complexity.

    @nfarhadian Why do you need cross-namespace secret references? Could they be in the same namespace as the SecurityPolicy?

  4. nfarhadian commented on Sep 29, 2025

    @nfarhadian
    ContributorAuthor

    In our setup, each app team creates their own HTTPRoute in their namespace and we want them to have full control over their service. Having them create the route and then open a ticket for the DevOps team to add a SecurityPolicy elsewhere isn’t a great workflow. (And in that scenario there should be at least one ReferenceGrant per namespace)

    Also, the generated CRD mention that cross-namespace references should work with ReferenceGrant, so it feels like there’s a gap between what the spec allows and what’s currently supported.

    P.S. I know we could script around this, but ideally the workflow shouldn’t need extra tooling.

  5. zhaohuabing commented on Sep 30, 2025

    @zhaohuabing
    Member

    Having them create the route and then open a ticket for the DevOps team to add a SecurityPolicy elsewhere isn’t a great workflow. (And in that scenario there should be at least one ReferenceGrant per namespace)

    Hi @nfarhadian does the DevOps team create the SecurityPolicy in another namespace but reference the client secret in the app namespace? In other words, are the owner of the client secret and the SecurityPolicy different?

  6. nfarhadian commented on Sep 30, 2025

    @nfarhadian
    ContributorAuthor

    Yes, they are different in our case
    OAuth client and client-secret is managed by the DevOps team

  7. zhaohuabing commented on Sep 30, 2025

    @zhaohuabing
    Member

    OAuth client and client-secret is managed by the DevOps team

    Do you mean app team? Or am I miss something?

    SecurityPolicy: DevOps team, created in another namespace
    OAuth client and client-secret: App team, created in app namespace

  8. added
    help wanted
    kind/decision
    and removed
    kind/decision
    help wanted
    on Sep 30, 2025
  9. 12 remaining items

  10. rouke-broersma commented on Dec 15, 2025

    @rouke-broersma

    This is an important feature because ClientTrafficPolicy is restricted to the namespace the gateway lives in which makes it the responsibility of the cluster operators. However client certificate authentication may be an application specific requirement where the team responsible for the application may be responsible for the client CA. In order to allow cluster operators to setup the listener to use the client CA provided by the application developers reference grant should be used.

  11. shavmohin commented on Dec 15, 2025

    @shavmohin
    Contributor

    Any updates on this?

  12. zhaohuabing commented on Jan 28, 2026

    @zhaohuabing
    Member

    Rleated to #8074 and #7895

  13. guydc commented on Jan 30, 2026

    @guydc
    Contributor

    generally +1 to supporting cross-ns where possible given ref grants exist.

  14. zhaohuabing commented on Jan 30, 2026

    @zhaohuabing
    Member

    Discussed in today’s community meeting: the decision is to support the cross-namespace for SecretObjectReferences in the existing API.

  15. removed
    help wanted
    on Jan 30, 2026
  16. chaima-belhedi commented on Feb 2, 2026

    @chaima-belhedi

    Thanks for sharing this, and +1 to what @rouke-broersma highlighted above.
    In our case, we need to reference a Secret from a different namespace in ClientTrafficPolicy.
    Without cross-namespace references (via ReferenceGrant), the only alternative is to manually copy the same secret into the namespace, which is error-prone.

    Glad to see the decision moving toward supporting cross-namespace SecretObjectReference!

  17. sadovnikov commented on Feb 4, 2026

    @sadovnikov
    Contributor

    We came across the same need: using cross-namespace secret referral

  18. zhaohuabing commented on Mar 6, 2026

    @zhaohuabing
    Member

    Fixed in #8074.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions