Skip to content

Conversation

neiser
Copy link
Contributor

@neiser neiser commented Mar 4, 2023

This prevents leakage of token information using timing attacks. A simple string comparison does not suffice here.

It's also good practice to hash first to prevent leakage of the length of the secret, as subtle.ConstantTimeCompare has the undesired behavior of returning early if the length of the two given byte slices does not match. A hash function always generates a byte slice of constant length though.

This prevents leakage of token information using timing
attacks. A simple string comparison does not suffice here.
@coveralls
Copy link

Coverage Status

Coverage: 88.244% (+0.04%) from 88.208% when pulling 5f7b060 on neiser:prevent-timing-attacks into 4f72f9c on go-playground:master.

@deankarn deankarn merged commit 7647123 into go-playground:master May 21, 2023
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