Skip to content
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

Move basic auth policy validation to CRD #7257

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pdabelf5
Copy link
Collaborator

@pdabelf5 pdabelf5 commented Jan 31, 2025

Proposed changes

This change moved the basic auth policy validation to the CRD level, this ensures that the NIC process does not need to be involved in the Policy validation.

Tested with
valid full spec:

apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
  name: basic-auth-policy
spec:
  basicAuth:
    secret: abc123
    realm: "f f f"

missing required field:

apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
  name: basic-auth-policy
spec:
  basicAuth:
    realm: "a.b.c"

missing optional field:

apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
  name: basic-auth-policy
spec:
  basicAuth:
    secret: mysecret

invalid secret name:

apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
  name: basic-auth-policy
spec:
  basicAuth:
    secret: ABC123
    realm: "a.b.c"

invalid realm name:

apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
  name: basic-auth-policy
spec:
  basicAuth:
    secret: abc123
    realm: a.b.ci$

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

@pdabelf5 pdabelf5 requested a review from a team as a code owner January 31, 2025 11:02
@github-actions github-actions bot added the go Pull requests that update Go code label Jan 31, 2025
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.70%. Comparing base (e03b216) to head (570d80d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7257      +/-   ##
==========================================
- Coverage   52.72%   52.70%   -0.03%     
==========================================
  Files          89       89              
  Lines       20843    20833      -10     
==========================================
- Hits        10989    10979      -10     
+ Misses       9396     9395       -1     
- Partials      458      459       +1     

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

@pdabelf5 pdabelf5 marked this pull request as draft January 31, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
Status: Todo ☑
Development

Successfully merging this pull request may close these issues.

1 participant