Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
32825e8a
Commit
32825e8a
authored
May 29, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basicauth: Patch timing vulnerability
parent
cb8691a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
middleware/basicauth/basicauth.go
middleware/basicauth/basicauth.go
+6
-2
No files found.
middleware/basicauth/basicauth.go
View file @
32825e8a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
basicauth
package
basicauth
import
(
import
(
"crypto/subtle"
"net/http"
"net/http"
"github.com/mholt/caddy/middleware"
"github.com/mholt/caddy/middleware"
...
@@ -34,10 +35,13 @@ func (a BasicAuth) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
...
@@ -34,10 +35,13 @@ func (a BasicAuth) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
hasAuth
=
true
hasAuth
=
true
// Check credentials
// Check credentials
if
!
ok
||
username
!=
rule
.
Username
||
password
!=
rule
.
Password
{
if
!
ok
||
username
!=
rule
.
Username
||
subtle
.
ConstantTimeCompare
([]
byte
(
password
),
[]
byte
(
rule
.
Password
))
!=
1
{
continue
continue
}
}
// flag set only on success authentication
// Flag set only on successful authentication
isAuthenticated
=
true
isAuthenticated
=
true
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment