Skip to content

fix: jwt provider cel and security policy validator - #9953

Open
kkk777-7 wants to merge 2 commits into
envoyproxy:mainfrom
kkk777-7:fix-merge-sp
Open

fix: jwt provider cel and security policy validator#9953
kkk777-7 wants to merge 2 commits into
envoyproxy:mainfrom
kkk777-7:fix-merge-sp

Conversation

@kkk777-7

@kkk777-7 kkk777-7 commented Sep 5, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Fixed jwt provider CRD CEL. currently, reject policy that doesn't have jwt provider even when the policy has mergeType and parent policy has jwt provider.

Updated CRD CEL and added validation for jwt provider in gatewayapi translator layer.

Which issue(s) this PR fixes:

Fixes #9722


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: If this PR contains API changes (changes under /api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.
  • Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: User-facing changes update the docs, either in this PR or a follow-up PR. N/A if this PR does not contain user-facing changes.
  • Release notes: For any non-trivial change, added a release-note fragment under release-notes/current/<section>/<pr-number>-<slug>.md (see release-notes/current/README.md for sections and naming). N/A if this PR does not contain non-trivial changes.
  • Generated files committed: Ran make gen-check and committed the result if API/helm charts/modules changed.
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments.

Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
@netlify

netlify Bot commented Sep 5, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 992efe9
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a9c04665a8dd90007223c59
😎 Deploy Preview https://deploy-preview-9953--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.33%. Comparing base (513b511) to head (992efe9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9953   +/-   ##
=======================================
  Coverage   81.33%   81.33%           
=======================================
  Files         264      264           
  Lines       40967    40994   +27     
=======================================
+ Hits        33320    33343   +23     
- Misses       7646     7650    +4     
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kkk777-7
kkk777-7 marked this pull request as ready for review September 5, 2026 13:22
@kkk777-7
kkk777-7 requested a review from a team as a code owner September 5, 2026 13:22
@kkk777-7

kkk777-7 commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@kkk777-7 kkk777-7 added this to the v1.10.0-rc.1 Release milestone Sep 5, 2026

@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: 992efe9572

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +596 to +605
if err := validator(policy); err != nil {
status.SetConditionForPolicyAncestor(&policy.Status,
&ancestorRef,
t.GatewayControllerName,
gwapiv1.PolicyConditionAccepted, metav1.ConditionFalse,
egv1a1.PolicyReasonInvalid,
status.Error2ConditionMsg(err),
policy.Generation,
)
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fail closed when no JWT provider can be inherited

When a merging route policy uses JWT authorization but its listener has no parent SecurityPolicy (the newly added httproute-no-parent-policy fixture exercises this), validation fails here and continue skips translation entirely. The generated route consequently has no security stanza or direct response, so traffic is unrestricted even though the policy specifies defaultAction: Deny; this can also happen transiently if the expected parent policy is removed. Preserve a fail-closed route/direct-response marker while reporting the policy as invalid.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the behavior is right. with no parent policy, validation fails and translation is skipped.

that said, this is not specific to this PR. Every validateSecurityPolicy have same issue.
so I'd like to raise issue and handle follow up PRs.

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.

Unable to reference jwt provider when composing Gateway SecurityPolicy and HTTPRoute SecurityPolicy

1 participant