opa icon indicating copy to clipboard operation
opa copied to clipboard

Parse and verify certificates with options

Open yogisinha opened this issue 1 year ago • 3 comments

Why the changes in this PR are needed?

parse and verify x509 certificates with additional options was requested

What are the changes in this PR?

buitins.go and crypto.go were modified

Notes to assist PR review:

This is a draft PR as requested by @ashutosh-narkar. Please comment if the implementation looks right

Further comments:

Just to pass the existing tests I created a another method verifyX509CertificateChainWithOpts which is same as verifyX509CertificateChain except it takes additional verifyOptions struct. I can remove this method and add this extra verifyOptions to verifyX509CertificateChain and change the test cases later. verifyX509CertificateChainWithOpts is just temporary.

For an e.g. This method will be called as :

crypto.x509.parse_and_verify_certificates_with_options(
pem encoded cert data,
'{
"DNSName": "some_value", "CurrentTime": "value in millis epoch", 
"KeyUsages": ["KeyUsageServerAuth", "KeyUsageClientAuth", "KeyUsageCodeSigning"]}",
"MaxConstraintComparisons": "int value"
)'
)

yogisinha avatar Feb 11 '24 19:02 yogisinha

Deploy Preview for openpolicyagent ready!

Name Link
Latest commit 91e90078e79b579c938e3258cc2b0872a20f8bab
Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/65fbfc10ae698f0008217e9a
Deploy Preview https://deploy-preview-6583--openpolicyagent.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Feb 11 '24 19:02 netlify[bot]

@yogisinha thanks for the contribution. Can you please resolve the conflicts in the PR?

ashutosh-narkar avatar Feb 14 '24 17:02 ashutosh-narkar

I resolved the conflicts.

yogisinha avatar Feb 14 '24 23:02 yogisinha

@charlieegan3 , I made all the changes. Please take a look.

yogisinha avatar Feb 21 '24 14:02 yogisinha

Hey, I have added a comment here https://github.com/open-policy-agent/opa/pull/6583#discussion_r1497884139 regarding previewing the docs. I think you're also going to need to run make generate and commit the new builtins JSON too. Thanks!

charlieegan3 avatar Feb 21 '24 16:02 charlieegan3

Hey, I have added a comment here #6583 (comment) regarding previewing the docs. I think you're also going to need to run make generate and commit the new builtins JSON too. Thanks!

Added the json files.

yogisinha avatar Feb 21 '24 17:02 yogisinha

Hey @yogisinha, are you able to take a look at the conflicts with main again?

charlieegan3 avatar Feb 27 '24 22:02 charlieegan3

Are you talking about this message "This branch is out-of-date with the base branch" . This was not coming before. What should I do ? Should I do "Update with merge commit" ?

yogisinha avatar Feb 27 '24 22:02 yogisinha

Hey, yeah best would be to run:

git fetch origin
git rebase origin/main
# address any conflicts and make sure the tests all pass etc
git rebase --continue
git push -f

charlieegan3 avatar Feb 27 '24 22:02 charlieegan3

I didn't find any merge conflicts after I did the rebase. There is nothing to push (no files changed) when I did the above .
I did:

git pull origin parse_and_verify_certificates_with_options
git push origin parse_and_verify_certificates_with_options

it removed that msg: "This branch is out-of-date with the base branch"

yogisinha avatar Feb 28 '24 00:02 yogisinha

@yogisinha can you please rebase this branch? I'm unable to do it via the UI. Similar to what Charlie mentioned here. Also make sure your origin points to [email protected]:open-policy-agent/opa.git

ashutosh-narkar avatar Mar 01 '24 19:03 ashutosh-narkar

@ashutosh-narkar , I made all the suggested changes.

yogisinha avatar Mar 02 '24 17:03 yogisinha

Added the test case.

yogisinha avatar Mar 10 '24 03:03 yogisinha

@charlieegan3 , I think it looks good now. I had to make several commits incrementally to see the behavior of deploy preview.

yogisinha avatar Mar 13 '24 22:03 yogisinha

Hey, I think we are nearly there now @yogisinha, I have updated the generated code in https://github.com/open-policy-agent/opa/pull/6583/commits/91e90078e79b579c938e3258cc2b0872a20f8bab but can you rebase this from origin/main so that we can get this in. I'm at KubeCon at the moment so have limited time to help, but will reply when I get a chance.

Thanks for your work here, much appreciated!

charlieegan3 avatar Mar 21 '24 09:03 charlieegan3

Hi @charlieegan3 , I created a new PR . I was getting lot of conflicts when I was trying to rebase, don't know why. In that new PR, everything is in single commit.

New PR: https://github.com/open-policy-agent/opa/pull/6643

yogisinha avatar Mar 23 '24 13:03 yogisinha

Closing this in favor of https://github.com/open-policy-agent/opa/pull/6643.

ashutosh-narkar avatar Mar 25 '24 18:03 ashutosh-narkar