Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd10262

Browse files
committed
Merge branch '272-token-comparation' into 'master'
fix: use a constant time string comparison function to compare a verification token (#272) Closes #272 See merge request postgres-ai/database-lab!307
2 parents a2a4ec8 + ddf5aff commit dd10262

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎pkg/srv/mw/auth.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package mw
77

88
import (
99
"context"
10+
"crypto/subtle"
1011
"net/http"
1112

1213
"gitlab.com/postgres-ai/database-lab/v2/pkg/services/platform"
@@ -45,7 +46,7 @@ func (a *Auth) isAccessAllowed(ctx context.Context, token string) bool {
4546
return false
4647
}
4748

48-
if a.verificationToken== token {
49+
if subtle.ConstantTimeCompare([]byte(a.verificationToken), []byte(token)) == 1 {
4950
return true
5051
}
5152

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /