Skip to content

Add sct and cert verification - #1

Merged
loosebazooka merged 1 commit into
mainfrom
add-sct-verification
May 11, 2022
Merged

loosebazooka merged 1 commit into
mainfrom
add-sct-verification

Conversation

@loosebazooka

@loosebazooka loosebazooka commented Apr 15, 2022 •

Copy link
Copy Markdown
Member

Add sct and cert validations

  • Rename CertificateResponse to SigningCertificate
  • Add more testing around parsing
  • Add example fulcio/ctfe public keys and sct/cert examples for testing
  • Exceptions are still kinda just passed along

@loosebazooka
loosebazooka force-pushed the add-sct-verification branch 2 times, most recently from b78b894 to 8bc998d Compare April 15, 2022 18:41
@loosebazooka

Copy link
Copy Markdown
Member Author

@di here is working sct/cert validation. There are sample in src/test/resources. They are generated off of my email, so it does feel weird to include them in a python client, but you could get away using them to test your code for now.

Comment thread build.gradle.kts Resolved
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch from 8ffeba2 to 98fe347 Compare April 21, 2022 17:05
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch from 98fe347 to d3f3635 Compare April 21, 2022 19:02
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch 2 times, most recently from 5b21366 to 1d72526 Compare May 4, 2022 00:28
@patflynn
patflynn self-requested a review May 9, 2022 14:57
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch 5 times, most recently from de94559 to f37a67b Compare May 10, 2022 17:11
@loosebazooka loosebazooka mentioned this pull request May 10, 2022
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch from f37a67b to 2f1f53e Compare May 11, 2022 15:37
@loosebazooka
loosebazooka requested a review from Hayden-IO May 11, 2022 16:01
patflynn
patflynn previously approved these changes May 11, 2022

@patflynn patflynn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lots of mysterious stuff in here, but looks like you know what you're doing!

My meta comment is that this would be easier to review broken up into neater PRs. For instance the refactorings could have been separated out. No biggie though.

public CertificateResponse(CertPath certPath, @Nullable byte[] sct) {
this.certPath = certPath;
this.sct = sct;
public class FulcioValidationException extends Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it's kind of weird to fork a response into an exception

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this extend RuntimeException?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, we want the tool to catch this and present it to the user. I don't think it's a catastrophic failure. It could be a misconfigured private key, or the wrong fulcio or something?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OK. Makes sense. We should chat about our approach here some time with Jason. I'll typically avoid throwing any checked exceptions unless it's type or api enables the client in some way.


public static FulcioValidator newFulcioValidator(
byte[] fulcioRoot, @Nullable byte[] ctfePublicKey)
throws InvalidKeySpecException, NoSuchAlgorithmException, CertificateException, IOException,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just curious why we allow the ctfePublicKjey to be null if that'll just result in a validation exception when we call validateSct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it can be null because scts aren't required to be returned from fulcio. they should be, but people could be running private instances and maybe don't care about internal certificate transparency (but maybe they should?)?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this be enforced via a policy/config?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

But validate will always fail as a result won't it?

@loosebazooka
loosebazooka force-pushed the add-sct-verification branch 2 times, most recently from e7b5663 to 16db253 Compare May 11, 2022 18:47
@loosebazooka
loosebazooka force-pushed the add-sct-verification branch from 16db253 to 5e71715 Compare May 11, 2022 18:51
Hayden-IO
Hayden-IO previously approved these changes May 11, 2022
- Rename CertificateResponse to SigningCertificate
- SCTs are optional
- Add more testing around parsing
- Add example fulcio/ctfe public keys and sct/cert examples for testing
- Exceptions are still kinda just passed along

Signed-off-by: Appu Goundan <[email protected]>
Co-authored-by: Vladimir Sitnikov <[email protected]>
@loosebazooka
loosebazooka merged commit 217ec0a into main May 11, 2022
@loosebazooka
loosebazooka deleted the add-sct-verification branch May 18, 2022 17:44
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