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

chore: Check for clock skew with response header #113

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

patriknw
Copy link
Member

@patriknw patriknw commented Dec 3, 2024

No description provided.

Copy link
Contributor

@pvlugter pvlugter left a comment

Choose a reason for hiding this comment

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

So using DynamoDB roughly as a time server. LGTM.

val awsInstant = Instant.from(dateHeaderParser.parse(dateHeader))
val now = Instant.now()
// The Date header only has precision of seconds so this is just a rough check
if (math.abs(java.time.Duration.between(awsInstant, now).toMillis) >= 2000) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the tolerance configurable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, also good to be able to disable that way:c6a46b5

Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏼

@patriknw patriknw merged commit 1ee98ab into main Dec 4, 2024
5 checks passed
@patriknw patriknw deleted the wip-date-header-patriknw branch December 4, 2024 07:55
@patriknw patriknw added this to the 2.0.4 milestone Dec 12, 2024
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.

2 participants