Skip to content

Validation fails due to requests from the future #2

@mathewsonr

Description

@mathewsonr

We occasionally run into issues where the clock on the requesting server is slightly ahead of the clock on the API server. Validation fails because the IsReplayRequest method in the SignatureValidator class returns true. This is because the difference in seconds is negative but you are storing them in an unsigned long, resulting in a huge positive value.

If you are ok with allowing request from the past or future up to the RequestMaxAgeInSeconds then this quick fix works:

ulong timestampDifference;
if (serverTotalSeconds > requestTotalSeconds) {
  timestampDifference = serverTotalSeconds - requestTotalSeconds;
} else {
  timestampDifference = requestTotalSeconds - serverTotalSeconds;
}

if (timestampDifference > RequestMaxAgeInSeconds) {
  return true;
}

Are you still maintaining this project? If so can you make this correction and publish and update to Nuget?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions