Skip to content

Make new api compatible with the Signing interface - #1272

Merged
lukpueh merged 1 commit into
theupdateframework:developfrom
MVrachev:signer-interface
Mar 10, 2021
Merged

Make new api compatible with the Signing interface#1272
lukpueh merged 1 commit into
theupdateframework:developfrom
MVrachev:signer-interface

Conversation

@MVrachev

@MVrachevMVrachev commented Feb 3, 2021

Copy link
Copy Markdown
Collaborator

Related to: #1263

Description of the changes being introduced by the pull request:

This pr makes TUF compatible with changes introduced in secure-systems-lab/securesystemslib#319.

Please wait for the securesystemlib pr to be merged first!

Signed-off-by: Martin Vrachev mvrachev@vmware.com

@MVrachev
MVrachev marked this pull request as draft February 3, 2021 16:50

@lukpuehlukpueh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool stuff, @MVrachev! I only noticed one thing (see inline comment), but we can revisit once secure-systems-lab/securesystemslib#319 has landed.

On a general note, I appreciate slightly more informative commit messages.

Comment threadtuf/api/metadata.py Outdated
@MVrachev

Copy link
Copy Markdown
CollaboratorAuthor

Cool stuff, @MVrachev! I only noticed one thing (see inline comment), but we can revisit once secure-systems-lab/securesystemslib#319 has landed.

On a general note, I appreciate slightly more informative commit messages.

Sorry for the lack of a good commit message, you are right.

I will update this pr when the securesystemslib signer interface is merged and I will add a better commit message before mark it
as a non-draft pr.

@MVrachev
MVrachevforce-pushed the signer-interface branch 2 times, most recently from 3062307 to 19e08d0CompareFebruary 24, 2021 12:27
@MVrachev

MVrachev commented Feb 24, 2021

Copy link
Copy Markdown
CollaboratorAuthor

I updated the pr addressing Lukas comment #1272 (comment), adding a new commit fixing one comment in the code, and making the commit message more descriptive.

@MVrachev
MVrachev marked this pull request as ready for review February 24, 2021 13:01
@MVrachev
MVrachevforce-pushed the signer-interface branch 2 times, most recently from a5e64e1 to ce655acCompareFebruary 26, 2021 22:42
@MVrachev

Copy link
Copy Markdown
CollaboratorAuthor

Updated the pr after we have bumped securesystemslib version to 0.20.0 which supports the new Signer interface.

@joshuagl

Copy link
Copy Markdown
Member

Thanks for this PR Martin, I'm hoping to give it a thorough review ASAP.

One quick observation: we should bump the minimum version of securesystemslib in the install_requires entry of setup.py to the version with the Signer abstraction.

@joshuagljoshuagl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The small diffstat of this PR feels like a nice validation of the Signer interface.

This LGTM, thank you @MVrachev. Could you please add a patch to the PR to update the securesystemslib version in setup.py's install_requires? Also, your first patch will no longer be required once we merge #1293.

Comment threadtuf/api/metadata.py Outdated
@MVrachev
MVrachevforce-pushed the signer-interface branch 4 times, most recently from 1856040 to 977f0d4CompareMarch 5, 2021 15:04
@MVrachev

Copy link
Copy Markdown
CollaboratorAuthor

I addressed your comments @joshuagl and fixed the conflicts.

@lukpuehlukpueh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Except for two minor nits this is good to go.

Comment threadtuf/api/metadata.py Outdated
Comment threadtuf/api/metadata.py Outdated
@MVrachev

Copy link
Copy Markdown
CollaboratorAuthor

I updated according to the last @lukpueh remarks.

In the securesystemslib pr secure-systems-lab/securesystemslib#319
I added a new Signer interface with the purpose of supporting multiple
signing implementations.
Additionally, I added the SSlibSigner implementation of that interface
which implements the signing operation for rsa, ed25519 and ecdsa
schemes.
With this commit, I integrate the SSlibSigner into the new API in tuf.
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>

@lukpuehlukpueh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @MVrachev, I took the liberty to rebase your PR on top of #1279, fixing conflicts and making minimal changes. See comments inline...

To get a full diff between your old diff and my new rebased diff you can do:

git range-diff develop 3050fb6 49aa0fc

I think we can merge. But maybe should consult with a 3rd-party, now that we are both authors? (ping @joshuagl, @jku, @sechkova)

Comment threadtuf/api/metadata.py

from securesystemslib.keys import verify_signature
from securesystemslib.util import persist_temp_file
from securesystemslib.signer import Signer, Signature

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-ordered imports alphabetically.

Comment threadtuf/api/metadata.py
# metadata['signatures'], call Signature.from_dict for each item, and
# pass a list of Signature objects to the Metadata constructor instead.
signatures = []
for signature in metadata.pop('signatures'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now popping the signatures list for consistently destructing the passed dictionary as described in the newly added "Side Effect" docstring section.

Comment threadtuf/api/metadata.py

Arguments:
key: A securesystemslib-style private key object used for signing.
signer: An object implementing the securesystemslib.signer.Signer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did s/singer/signer to fix a typo I had missed in my review.

@MVrachev

Copy link
Copy Markdown
CollaboratorAuthor

I agree with your changes @lukpueh.
Let us wait and see what the others will say.

@joshuagljoshuagl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks for the changes @MVrachev and the rebase/fixes @lukpueh

@lukpueh
lukpueh merged commit 65005cf into theupdateframework:developMar 10, 2021
@lukpueh

Copy link
Copy Markdown
Member

Ping @woodruffw! Metadata.sign now accepts a custom Signer. :)

@trishankatdatadog

Copy link
Copy Markdown
Contributor

Very cool, thanks for all the great work, guys!

Will, you should be able to reuse a lot of the Vault-specific code I wrote as part of this PR...

Sign up for freeto 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

@MVrachev@joshuagl@lukpueh@trishankatdatadog