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

Nearexpirywarnings for re-signing roles on read or write #786

Merged
merged 1 commit into from
Jun 15, 2016

Conversation

avaid96
Copy link
Contributor

@avaid96 avaid96 commented Jun 14, 2016

Warnings are now output on read and write actions. Should indicate which role will be expiring soon and will need to be re-signed.
Also deleted an unused function in testutils- AddTarget
closes #733

//get every role and its respective signed common and call nearExpiry on it
//Root check
//Reset levels to display warnings through logrus
logrus.SetLevel(logrus.WarnLevel)
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldn't actually change the log level here, so we can remove this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, editing the commit

@avaid96 avaid96 force-pushed the nearexpirywarnings branch 2 times, most recently from 6e82bce to 111b01d Compare June 14, 2016 22:21
//get every role and its respective signed common and call nearExpiry on it
//Root check
if nearExpiry(r.Root.Signed.SignedCommon) {
logrus.Warn("root is nearing expiry, you should re-sign the key")
Copy link
Contributor

@riyazdf riyazdf Jun 14, 2016

Choose a reason for hiding this comment

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

I think the log warning message should indicate that we need to re-sign the role metadata, not the key itself (same for targets and snapshot below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

coming with the other changes

if nearExpiry(r.Snapshot.Signed.SignedCommon) {
logrus.Warn("snapshot is nearing expiry, you should re-sign the role metadata")
}
//Timestamp is not checked since the user doesn't need to worry about it, we deal with it
Copy link
Contributor

Choose a reason for hiding this comment

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

can we clarify the we deal with it part by saying something like ...doesn't need to worry about it, notary signer will re-sign with the timestamp key?

Copy link
Contributor Author

@avaid96 avaid96 Jun 15, 2016

Choose a reason for hiding this comment

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

will do with other changes (if necessary)

@riyazdf
Copy link
Contributor

riyazdf commented Jun 15, 2016

thank you for adding this in, LGTM after comments!

@cyli
Copy link
Contributor

cyli commented Jun 15, 2016

jenkins, test this please

require.Contains(t, b.String(), "targets/exp metadata is nearing expiry, you should re-sign the role metadata", "targets/exp should show near expiry")
require.Contains(t, b.String(), "root is nearing expiry, you should re-sign the role metadata", "Root should show near expiry")
require.Contains(t, b.String(), "snapshot is nearing expiry, you should re-sign the role metadata", "Snapshot should show near expiry")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also set the timestamp expiry date to nearexpdate, and assert that b does not contain any information about the timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Timestamp isn't being warned about since @riyazdf mentioned that Notary deals with that role and the user needs to worry about it. Hence there is no warning output related to it. Also, the role will always throw a warning since defaults are lower than the 6 month threshold. Let me know what you think, I'm okay to do it either ways but what Riyaz mentioned seemed to make sense

Copy link
Contributor

Choose a reason for hiding this comment

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

Right - so this would just test that we don't warn about the timestamp even though it is near expiry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will edit this as per your recommendation. Thanks for the suggestion! +1

@cyli
Copy link
Contributor

cyli commented Jun 15, 2016

LGTM pending comments - thanks so much for adding the warnings!

@avaid96
Copy link
Contributor Author

avaid96 commented Jun 15, 2016

Thanks @riyazdf and @cyli for the detailed feedback!

@cyli
Copy link
Contributor

cyli commented Jun 15, 2016

jenkins, test this please

@riyazdf
Copy link
Contributor

riyazdf commented Jun 15, 2016

LGTM!

@riyazdf riyazdf merged commit 2e1e07e into notaryproject:master Jun 15, 2016
@avaid96 avaid96 deleted the nearexpirywarnings branch June 15, 2016 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings when a role is soon to expire
4 participants