cosign icon indicating copy to clipboard operation
cosign copied to clipboard

Enchance validation of ClusterImagePolicy

Open vaikas opened this issue 2 years ago • 5 comments

As a follow on to #1548 @kkavitha and I chatted about some additional checks that we should be doing. For example, we should check the inline data to ensure inline data is a valid Public Key. There might be some additional ones as well. Just creating this to track that work here.

vaikas avatar Mar 10 '22 06:03 vaikas

Another one we should do is validate the glob string. My understanding is that we only support 'one' trailing '*' character. Since parsing functions have traditionally been a source of confusion / bugs, I'd like to propose that we enforce it strictly so matching is easier to reason about.

vaikas avatar Mar 10 '22 07:03 vaikas

Thanks for creating the issue! Public keys, certs and regex/glob validations were the three we talked about.Do we need extra validations for the URL field? KMS field is still a string though.

kkavitha avatar Mar 10 '22 14:03 kkavitha

Also, when we add validation for inline data being a valid public key, we should also reuse that validation to address the public key we get from the secret. I have created this to track that work: #1596

Good question about the URL field.

vaikas avatar Mar 11 '22 14:03 vaikas

Regarding, the URL I believe a url.Parse( validation would be enough.

hectorj2f avatar Mar 11 '22 15:03 hectorj2f

@vaikas Do we miss any work here ? If so we could create a new issue in the policy-controller repository.

hectorj2f avatar Jun 20 '22 18:06 hectorj2f