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

ITE7 Prototype Implementation #119

Merged
merged 7 commits into from
Sep 10, 2021

Conversation

mikhailswift
Copy link
Member

This is a prototype implementation of ITE7 as drafted and proposed at:
in-toto/ITE#21

  • Adds the concept of certificate constraints. This allows layout
    creators to define the shape of a X509 certificate that is allowed to
    act as a functionary for each step of a layout.
  • Adds roots and intermediate CAs to the layout. This allows layout
    creators to define the chain of trust that a X509 certificate must
    fall within to act as a functionary.
  • Adds the leaf certificate to signatures. This will need to be updated
    to be compatible with DSSE if ITE5 is accepted into the specficiation.

Please fill in the fields below to submit a pull request. The more
information that is provided, the better.

Fixes issue #:

Description of pull request:

Please verify and check that the pull request fulfills the following
requirements
:

  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

@mikhailswift
Copy link
Member Author

We're still working on splitting up our fork into separate pull requests. We're thinking two more will be opened: one for the CLI and another for the SPIFFE/SPIRE plugin.

We created end-to-end testing for all of this functionality but it relies upon the CLI pull request. In the meantime I'll continue to work and add unit tests and refining the documentation.

This is a prototype implementation of ITE7 as drafted and proposed at:
in-toto/ITE#21

* Adds the concept of certificate constraints.  This allows layout
  creators to define the shape of a X509 certificate that is allowed to
  act as a functionary for each step of a layout.
* Adds roots and intermediate CAs to the layout.  This allows layout
  creators to define the chain of trust that a X509 certificate must
  fall within to act as a functionary.
* Adds the leaf certificate to signatures.  This will need to be updated
  to be compatible with DSSE if ITE5 is accepted into the specficiation.
in_toto/runlib.go Show resolved Hide resolved
in_toto/runlib.go Show resolved Hide resolved
in_toto/model.go Show resolved Hide resolved
in_toto/keylib_test.go Outdated Show resolved Hide resolved
@shibumi
Copy link
Collaborator

shibumi commented Aug 25, 2021

@mikhailswift Thanks for the PR. I have added a few questions. These are not meant as request for changes, they are just open questions on my side :)

@mikhailswift
Copy link
Member Author

@shibumi I added some tests to cover the functionality added and some documentation. I'll continue to go through and add tests and documentation as I can find areas that need them.

I left the commits separate for ease of review but as we get closer to this being in a merge-able state I can squash them down to a singular commit if desired.

@shibumi
Copy link
Collaborator

shibumi commented Aug 26, 2021

@mikhailswift I have restarted the CI pipeline.. let's see how this looks like. We don't need a perfect code coverage result, a small decrease is fine for us.

Squashing the commits to one feature commit for ITE7 is desirable.

@mikhailswift
Copy link
Member Author

I just remembered one block of important code I left untested, currently working through writing a test for that

@mikhailswift
Copy link
Member Author

mikhailswift commented Aug 26, 2021

@shibumi Okay, that should cover all the happy path test cases. Additional tests can be added to test the errors and improve coverage.

@shibumi
Copy link
Collaborator

shibumi commented Aug 27, 2021

@adityasaky can you have a look?

@shibumi
Copy link
Collaborator

shibumi commented Aug 27, 2021

@adityasaky if you are fine with this PR I think we can merge it. It slightly decreases our code coverage, but this is fine. We are still over 91% (we should maybe change the threshold for future PRs.. I think the current threshold is a little bit too conservative for agile development).

Copy link
Member

@adityasaky adityasaky left a comment

Choose a reason for hiding this comment

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

I only have very minor nits. I'm also satisfying myself that this will still play nice with metadata from the reference implementation.

in_toto/verifylib.go Outdated Show resolved Hide resolved
in_toto/verifylib.go Outdated Show resolved Hide resolved
@adityasaky
Copy link
Member

Hi @mikhailswift, thank you for your work on this, this looks great! I was wondering if we could make the new fields optional so that the implementation continues to support non ITE-7 metadata. I'm wary of breaking, say, verification workflows where the metadata is generated using the python implementation but the verification uses the Go implementation, or even where folks have older metadata generated using the Go implementation.

@mikhailswift
Copy link
Member Author

Absolutely, 100% in favor of that and will focus on getting that done ASAP :)

@adityasaky
Copy link
Member

Thank you, I appreciate it!

@adityasaky adityasaky mentioned this pull request Sep 4, 2021
2 tasks
This commit will make the new fields added by ITE7 optional. This allows
the golang version to load and verify layouts and links created by
versions of in-toto that adhere to the 0.9 specification.
@mikhailswift
Copy link
Member Author

Sorry for the delay in this, the past week has been chaotic. My latest commit makes the new fields optional. Coincidentally this also fixes the KeyID problem discussed before.

@shibumi
Copy link
Collaborator

shibumi commented Sep 8, 2021

looks good for me! :)

if _, ok := obj[field]; !ok {
return fmt.Errorf("required field %s missing", field)
if _, ok := obj[field.name]; !ok && !field.omitempty {
return fmt.Errorf("required field %s missing", field.name)
Copy link
Member Author

Choose a reason for hiding this comment

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

probably not super important, but this for loop and the one above could be combined so we only have to do one pass over all the fields.

@adityasaky adityasaky merged commit 02b98c8 into in-toto:master Sep 10, 2021
@adityasaky
Copy link
Member

Thanks @mikhailswift! Looking forward to the other two PRs :)

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.

3 participants