-
Notifications
You must be signed in to change notification settings - Fork 67
Add support for Policy URLs #518
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #518 +/- ##
==========================================
- Coverage 56.21% 55.93% -0.29%
==========================================
Files 42 42
Lines 4454 4505 +51
==========================================
+ Hits 2504 2520 +16
- Misses 1747 1778 +31
- Partials 203 207 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Took a quick pass, couple of thoughts! Thanks for working on this!
| if err != nil { | ||
| return fmt.Errorf("failed to read policy url response: %w", err) | ||
| } | ||
| policyRef.Data = string(data) |
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.
I think we really should add the status field into the CIPs sooner rather than later, this one (not picking on it just reminds me of it again), that if the policy is invalid it will fail at run time. I understand that even when creating inlined CIPs and configmap refs, we need to do a better job validating the policy.
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.
Yes, we need to take over the status work again. I can start writing something down for this.
| } | ||
| if p.URL != nil { | ||
| url := *p.URL | ||
| _, err := apis.ParseURL(url.String()) |
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.
I can't recall if this allows for things like relative URLs? Also, wonder if this should be required to be https?
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.
I can easily improve the validation here. Yes, i like the https requirement here
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.
I added some additional validations.
|
@vaikas I made some changes. Please, take a look when possible. |
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
|
Is this a good idea? I worry about an attacker just giving you the "everything passes" policy. Should we check signatures on remote policies? |
|
@znewman01 Yes, we should check signatures, I'd like to get the policies from an OCI registry. Perhaps we could use sget logic here. |
D'oh, should have actually read the PR. 🤦 Yes, you don't need signing if you're checking the sha256. But if you know the checksum, why not just inline the policy? For size or something? |
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.
Thanks!!! I'll rebase after merge to add these to status stuff.
closes #458
Summary
I am proposing a solution for setting cue-rego policies via a URL. This PR parses the url during creation time, and fetches the content of the URL to policy.Data during reconciliation.
Release Note
Documentation