Skip to content

Implement WAFPolicy controller #3532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: feat/nap-waf
Choose a base branch
from
Draft

Conversation

ciarams87
Copy link
Contributor

@ciarams87 ciarams87 commented Jun 21, 2025

Proposed changes

Problem:
As a user of NGF
I want NGF to fetch my NAP WAF Policy bundle from a remote location and I want my WafPolicy configuration applied to NGINX for the Gateway or Route scope and
So that that this bundle can be applied and I can enable WAF protection on my traffic

Solution: Implement the policy fetcher and the WAFPolicy controller.

This solution deliberately omits status, polling, and authentication, as they will be done in future PRs.

Testing: Over 90% unit test coverage, added and extended BDD tests where appropriate, and manual testing in a GKE cluster

Please focus on (optional): I split out the policy fetcher into a separate PR. The WAFPolicy controller code is the final commit in this PR, as it depends on the policy fetcher functionality.

Closes: #3454

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

NONE

@ciarams87 ciarams87 force-pushed the feat/wafpolicy-ctlr branch from 469bfd8 to 77a793f Compare June 25, 2025 08:06
@github-actions github-actions bot removed the helm-chart Relates to helm chart label Jun 25, 2025
@ciarams87 ciarams87 force-pushed the feat/wafpolicy-ctlr branch from ddeaa8e to 499cfed Compare June 25, 2025 17:04
if conds := validator.ValidateGlobalSettings(policy.Source, globalSettings); len(conds) > 0 {
ancestor.Conditions = conds
policy.Ancestors = append(policy.Ancestors, ancestor)
return
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any mechanism to log failed validation if it takes a place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

Implement WafPolicy controller & generate the correct NGINX configuration
2 participants