-
Notifications
You must be signed in to change notification settings - Fork 97
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
Restrict policies to non-duplicate routes #2318
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2318 +/- ##
==========================================
+ Coverage 87.77% 88.07% +0.29%
==========================================
Files 96 97 +1
Lines 6847 6993 +146
Branches 50 50
==========================================
+ Hits 6010 6159 +149
+ Misses 780 777 -3
Partials 57 57 ☔ View full report in Codecov by Sentry. |
273d0ab
to
34b6db7
Compare
34b6db7
to
dece2b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc changes LGTM. Always nice to see a notice removed because a feature has been added!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🚀
internal/mode/static/nginx/config/policies/clientsettings/generator.go
Outdated
Show resolved
Hide resolved
internal/mode/static/nginx/config/policies/clientsettings/generator.go
Outdated
Show resolved
Hide resolved
internal/mode/static/nginx/config/policies/clientsettings/generator_test.go
Outdated
Show resolved
Hide resolved
dece2b5
to
cb06d8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitting this for now, about halfway through reviewing.
internal/mode/static/nginx/config/policies/observability/generator.go
Outdated
Show resolved
Hide resolved
Problem: Some NGINX directives are not applied or enforced when configured in an internal location. This occurs when redirecting or rewriting a request from an external location to an internal location. Solution: Only accept a policy if the Route it targets is the only Route that matches the hostname, port, and path combination. If other Routes overlap, the policy will be rejected. This allows us to apply policy configuration to the external location instead of the internal locations. We would limit the policies we accept rather than limiting which Routes we accept. This is possible because, with the policy restriction, a policy cannot be applied to a Route that shares an external location with another Route. However, for the otel module, we still require some internal location directives to be specified, so the policy generator has been refactored to account for this. Finally, revert named locations back to internal locations. As part of this process, we've learned that named locations do not behave as expected. Co-authored-by: Kate Osborn <[email protected]>
8509c3b
to
8fdf3a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Problem: Some NGINX directives are not applied or enforced when configured in an internal location. This occurs when redirecting or rewriting a request from an external location to an internal location.
Solution: Only accept a policy if the Route it targets is the only Route that matches the hostname, port, and path combination. If other Routes overlap, the policy will be rejected.
This allows us to apply policy configuration to the external location instead of the internal locations. We would limit the policies we accept rather than limiting which Routes we accept.
This is possible because, with the policy restriction, a policy cannot be applied to a Route that shares an external location with another Route.
However, for the otel module, we still require some internal location directives to be specified, so the policy generator has been refactored to account for this.
Finally, revert named locations back to internal locations. As part of this process, we've learned that named locations do not behave as expected.
Testing: Manual verification that policies work with matching conditions, as well as Condition is set properly when overlapping routes exist in relation to a policy.
Closes #2308
Checklist
Before creating a PR, run through this checklist and mark each as complete.
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.