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

fix: timestamping #478

Merged
merged 7 commits into from
Nov 15, 2024
Merged

fix: timestamping #478

merged 7 commits into from
Nov 15, 2024

Conversation

Two-Hearts
Copy link
Contributor

This PR adds a sanity check on timstamp value against the signing time: timestamp value should always be bounded after the signing time.
This is to say, one cannot timestamp a signature before the signature itself been created. If it happens, fail the verification.

Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.34%. Comparing base (7b9636e) to head (9c53750).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #478      +/-   ##
==========================================
+ Coverage   80.33%   80.34%   +0.01%     
==========================================
  Files          34       34              
  Lines        3320     3323       +3     
==========================================
+ Hits         2667     2670       +3     
  Misses        508      508              
  Partials      145      145              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

@priteshbandi
Copy link
Contributor

Do we need to account for clock skew such as when the local system clock runs faster than the timestamp server??

@Two-Hearts
Copy link
Contributor Author

Two-Hearts commented Nov 15, 2024

Do we need to account for clock skew such as when the local system clock runs faster than the timestamp server??

This change has been tested with several public tsa servers, such as digicert and globalsign.
Since we cannot tell the difference between a clock skew and an intentionally manipulated local system clock, we should fail the verification on both cases following the secure by default practice.

In addition, this check also covers the scenario where the signer generates a Notary Project compliant signature using another tool and send it to tsa for timestamping later on, then attach the signature themselves. When verifying such signature envelopes in Notation, we expect the tsa timestamp to be later than the signing time as well. (given the timestamp being an unsigned attribute)

My suggestion is to follow the secure by default practice for now. If users do meet this issue, we could find a way to relax this validation in the future.
@priteshbandi

Copy link
Contributor

@priteshbandi priteshbandi left a comment

Choose a reason for hiding this comment

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

LGTM

@Two-Hearts Two-Hearts merged commit 5a32333 into notaryproject:main Nov 15, 2024
14 checks passed
@Two-Hearts Two-Hearts deleted the timestamp branch November 15, 2024 08:09
Two-Hearts added a commit to Two-Hearts/notation-go that referenced this pull request Dec 9, 2024
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Pritesh Bandi <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Two-Hearts added a commit to Two-Hearts/notation-go that referenced this pull request Dec 9, 2024
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Pritesh Bandi <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Two-Hearts added a commit to Two-Hearts/notation-go that referenced this pull request Dec 9, 2024
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Pritesh Bandi <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
@Two-Hearts Two-Hearts mentioned this pull request Dec 12, 2024
6 tasks
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