git.cweiske.de
/
anoweco.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43f8f35
)
Verify that the authorization header has 2 parts
author
Christian Weiske
<
[email protected]
>
Thu, 22 Mar 2018 20:20:51 +0000
(21:20 +0100)
committer
Christian Weiske
<
[email protected]
>
Thu, 22 Mar 2018 20:20:51 +0000
(21:20 +0100)
Resolves: https://github.com/cweiske/anoweco/issues/4
www/token.php
patch
|
blob
|
history
diff --git
a/www/token.php
b/www/token.php
index abe14ed6f9c93c143151c7b5d48674ce1a787295..6a7fa81332960785cb0f4a5ef7e43b0b5728fd4e 100644
(file)
--- a/
www/token.php
+++ b/
www/token.php
@@
-47,7
+47,13
@@
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
} else {
error('Authorization HTTP header missing');
}
- list($bearer, $token) = explode(' ', $auth, 2);
+
+ $parts = explode(' ', $auth, 2);
+ if (count($parts) != 2) {
+ error('Authorization header must container "Bearer" and the token');
+ }
+
+ list($bearer, $token) = $parts;
if ($bearer !== 'Bearer') {
error('Authorization header must start with "Bearer"');
}