-
Notifications
You must be signed in to change notification settings - Fork 512
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
Conversation
2af0156
to
2d9883a
Compare
2d9883a
to
490b9c7
Compare
//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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
6e82bce
to
111b01d
Compare
//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") |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
111b01d
to
36492e5
Compare
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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)
thank you for adding this in, LGTM after comments! |
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") | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
LGTM pending comments - thanks so much for adding the warnings! |
Signed-off-by: avaid96 <avaid1996@gmail.com>
36492e5
to
2bee3f7
Compare
jenkins, test this please |
LGTM! |
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