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

fix: Added .Values.validatingWebhookExemptNamespacesLabels to the /v1/admitlabel webhook #3147

Conversation

Gaardsholt
Copy link

What this PR does / why we need it: When running on GKE we get the following error in the console:
image

@Gaardsholt Gaardsholt requested a review from a team as a code owner November 6, 2023 08:00
@Gaardsholt Gaardsholt force-pushed the validatingWebhookExemptNamespacesLabels branch from 2a0c7cd to 72b2e38 Compare November 6, 2023 08:03
@maxsmythe
Copy link
Contributor

Thanks for the PR!

Unfortunately, this change would get clobbered by our auto-gen pipeline as-is. Please see https://open-policy-agent.github.io/gatekeeper/website/docs/help/#contributing-to-helm-chart for more details.

@Gaardsholt Gaardsholt force-pushed the validatingWebhookExemptNamespacesLabels branch from 0552b92 to b5eeeff Compare November 7, 2023 10:32
@Gaardsholt
Copy link
Author

Thanks for the PR!

Unfortunately, this change would get clobbered by our auto-gen pipeline as-is. Please see https://open-policy-agent.github.io/gatekeeper/website/docs/help/#contributing-to-helm-chart for more details.

@maxsmythe like this then?

@JaydipGabani
Copy link
Contributor

@Gaardsholt you need to modify this and add this there as well. Then run make manifests and push the changes

@Gaardsholt
Copy link
Author

Thank you so much for pointing me the the right direction @JaydipGabani !
I think I have made the changes correctly now :)

Copy link
Contributor

@JaydipGabani JaydipGabani left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5db70c1) 53.68% compared to head (8e67093) 53.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3147      +/-   ##
==========================================
+ Coverage   53.68%   53.78%   +0.10%     
==========================================
  Files         136      136              
  Lines       12198    12198              
==========================================
+ Hits         6548     6561      +13     
+ Misses       5145     5136       -9     
+ Partials      505      501       -4     
Flag Coverage Δ
unittests 53.78% <ø> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Gaardsholt Gaardsholt force-pushed the validatingWebhookExemptNamespacesLabels branch from 16f1f2e to 1f5a5a7 Compare November 24, 2023 14:28
@JaydipGabani
Copy link
Contributor

@Gaardsholt please sign the commit to resolve DCO

@Gaardsholt Gaardsholt force-pushed the validatingWebhookExemptNamespacesLabels branch from 1f5a5a7 to 29de8fd Compare November 27, 2023 18:19
@Gaardsholt
Copy link
Author

@JaydipGabani DCO has been fixed

@maxsmythe
Copy link
Contributor

There is a security hole in modifying the admitLabel webhook like this in the form of a privilege escalation.

The purpose of admitLabel is to make sure the ability to add/remove/edit namespaces is not equivalent to the ability to bypass admission policy. As such, it needs to be evaluated against all namespaces. Essentially this is our way of creating ACLd namespace labels.

If we were to merge this as-is, the effect would be to nullify the purpose of the webhook, since any user with permissions to edit namespaces would be able to modify that namespace's label, bypassing the webhook. At that point, it would be clearer (and more stable), to just remove the admitLabel entirely.

Some users may consider the ability to add/remove/edit namespaces to be a privileged operation, and therefore would be fine with relying on RBAC alone as the security mechanism here. For these users, disabling admitLabel makes sense.

TL;DR we probably just want a switch that makes the admitLabel webhook optional. It would be a more robust and more explicit in its behavior. We should document the security implications of disabling that webhook.

Copy link

stale bot commented Jan 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 29, 2024
@stale stale bot closed this Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants