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

Make Gitlab token verification constant time #165

Merged
merged 1 commit into from
May 21, 2023

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