nginxinc / kubernetes-ingress

NGINX and NGINX Plus Ingress Controllers for Kubernetes
https://docs.nginx.com/nginx-ingress-controller
Apache License 2.0
4.68k stars 1.97k forks source link

add nil check to apikey suppliedIn #6733

Closed j1m-ryan closed 3 weeks ago

j1m-ryan commented 3 weeks ago

Proposed changes

Add nil check in apiKey auth policy's suppliedIn field.

Instead of a stack trace, the policy will now be invalid

I20241030 11:30:59.581640   1 controller.go:2430] Skipping invalid Policy default/api-key-policy: spec.apiKey.suppliedIn: Required value: suppliedIn cannot be nil

A VS that uses an invalid policy will then return 500s for each request.

Checklist

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

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 53.46%. Comparing base (83d09fa) to head (6b7b252). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6733 +/- ## ========================================== + Coverage 53.44% 53.46% +0.02% ========================================== Files 87 87 Lines 20111 20120 +9 ========================================== + Hits 10748 10757 +9 Misses 8928 8928 Partials 435 435 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.