Visitar URL original
Fix Clock Skew according to internal specification by Madrigal · Pull Request #3472 · aws/aws-sdk-go-v2 · GitHub
Skip to content

Fix Clock Skew according to internal specification - #3472

Merged
Madrigal merged 6 commits into
mainfrom
fix-clockskewsep
Jul 21, 2026
Merged

Madrigal merged 6 commits into
mainfrom
fix-clockskewsep

Conversation

@Madrigal

Copy link
Copy Markdown
Contributor

Update our implementation of Clock Skew to match our internal specification.

Update Skew computation

  • Replaced the current serverTime - responseAt formula with the internal spec midpoint calculation: serverTime - midpoint(requestAt, responseAt), which bounds measurement error to half the round-trip time.
  • Added a maxTrustedRequestDuration (15 min) guard — responses slower than this discard the skew candidate.
  • Added an Age header check — cached responses are not used for skew measurement.

Add disable flag

  • Added DisableClockSkewCorrection flag to disable clock skew computation
  • Wired it through the config resolution chain: env var (AWS_DISABLE_CLOCK_SKEW_CORRECTION), shared config profile (disable_clock_skew_correction), and programmatic.

Update codes

  • Unified definiteSkewCodes and possibleSkewCodes into a single clockSkewCodes set.
  • Added RequestTimeTooSkewed and AccessDeniedException to the set; removed RequestExpired and RequestInTheFuture.

@Madrigal
Madrigal requested a review from a team July 10, 2026 17:02
@Madrigal Madrigal changed the title Fix Clock Skew according to internla specification Fix Clock Skew according to internal specification Jul 10, 2026
if err != nil {
t.Fatalf("enabled: unexpected error: %v", err)
}
if skew, ok := GetAttemptSkew(mdEnabled); !ok || skew != 5*time.Minute {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: from first glance there might be transient case where calculated skew is slight diff from exact 5 min since we use midpoint of req/resp time for calculation now, but that should not impact too much

@lucix-aws

Copy link
Copy Markdown
Contributor

needs a changelog btw, fixandship

@Madrigal
Madrigal merged commit d132ac7 into main Jul 21, 2026
19 checks passed
@Madrigal
Madrigal deleted the fix-clockskewsep branch July 21, 2026 15:57
@claude claude Bot mentioned this pull request Aug 4, 2026
1 task
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.

3 participants