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

Add k8sallowedreposv2 Policy with Exact Match & Glob Support #616

Merged
merged 15 commits into from
Jan 15, 2025

Conversation

yakirk
Copy link
Contributor

@yakirk yakirk commented Dec 17, 2024

This PR introduces a new k8sallowedreposv2 policy that improves the current k8sallowedrepos rule by adding support for exact matches and glob-like patterns. This makes it easier to create more precise and flexible rules for allowed container images.

What’s New?

  1. New Policy - k8sallowedreposv2:Supports exact image names and glob-like syntax for better control.
    Provides an alternative to the current prefix-only approach of k8sallowedrepos .

  2. Documentation Update: Improved the k8sallowedrepos documentation to highlight the importance of adding a "/" when specifying DockerHub repositories, custom registries, and more.

This ensures users avoid potential bypasses, like allowing malicious registries or repositories with similar prefixes.
This change addresses security concerns discussed previously: #538 and #529
And provides a clearer, more secure way to define allowed container images.

@yakirk yakirk requested a review from a team as a code owner December 17, 2024 13:41
@yakirk
Copy link
Contributor Author

yakirk commented Dec 23, 2024

Hey @maxsmythe @JaydipGabani @ritazh and @sozercan
Any updates regarding this PR? Thanks!

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

@JaydipGabani JaydipGabani requested a review from a team December 31, 2024 21:40
@JaydipGabani
Copy link
Contributor

@yakirk we are updating our library to include CEL logic as well. Are you interested in adding CEL engine code for this policy? Here is a sample policy that is a good starting point - https://open-policy-agent.github.io/gatekeeper-library/website/validation/requiredlabels.

@yakirk
Copy link
Contributor Author

yakirk commented Jan 1, 2025

@JaydipGabani , thanks for the suggestion! I'm not familiar with CEL syntax yet, so I'd prefer merging the current policy for now. I may revisit adding a CEL policy later.

@JaydipGabani
Copy link
Contributor

@yakirk Sounds good, we need approval from one more maintainer to merge.

@ritazh @maxsmythe PTAL

@yakirk
Copy link
Contributor Author

yakirk commented Jan 9, 2025

Hey @JaydipGabani @maxsmythe @ritazh,
Any updates regarding this PR? Thanks!

Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for putting up with all the feedback! Apologies for the slow response over the holidays.

Update allowedrepos version to 1.0.2

Signed-off-by: yakirk <[email protected]>
Update allowedrepos version to 1.0.2
@JaydipGabani JaydipGabani merged commit e3855f5 into open-policy-agent:master Jan 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants