Skip to content

Fix #8491: Add AuthenticationMode Any/All for multi-auth OR semantics#8653

Open
stbattula-research wants to merge 1 commit intoenvoyproxy:mainfrom
stbattula-research:feat/authentication-mode-any-or-semantics
Open

Fix #8491: Add AuthenticationMode Any/All for multi-auth OR semantics#8653
stbattula-research wants to merge 1 commit intoenvoyproxy:mainfrom
stbattula-research:feat/authentication-mode-any-or-semantics

Conversation

@stbattula-research
Copy link
Copy Markdown

@stbattula-research stbattula-research commented Apr 2, 2026

What type of PR is this?

feat(api) — Add AuthenticationMode (Any/All) for multi-auth OR semantics

What this PR does / why we need it

When a SecurityPolicy configures both JWT and BasicAuth, the BasicAuth filter (order 7) rejects all Bearer token requests before JWT (order 9) can evaluate them. Valid JWT requests get 401 when BasicAuth is also configured.

This PR adds an authMode field (All/Any) to SecurityPolicySpec. When set to Any, the gateway sets AllowMissing=true on each auth filter and emits a composite RBAC CEL expression so at least one method must succeed.

Credentials Before After
Valid Bearer token only ❌ 401 ✅ 200
Valid Basic creds only ❌ 401 ✅ 200
Both valid ✅ 200 ✅ 200
Neither ❌ 401 ❌ 401

Files changed

  • api/v1alpha1/authentication_types.go — New AuthenticationMode type with kubebuilder markers
  • internal/gatewayapi/securitypolicy_authmode.goapplyAuthMode helper
  • internal/gatewayapi/securitypolicy_authmode_test.go — 10 unit tests

Which issue(s) this PR fixes

Fixes #8491

Release Notes

Yes

@stbattula-research stbattula-research requested a review from a team as a code owner April 2, 2026 03:47
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 2, 2026

Deploy Preview for cerulean-figolla-1f9435 canceled.

Name Link
🔨 Latest commit 07dbc3f
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69cde6c8198a11000871c725

@arkodg arkodg requested a review from zhaohuabing April 6, 2026 03:15
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.

SecurityPolicy: JWT Bearer requests rejected by BasicAuth filter when both are configured (no OR semantics)

1 participant