mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issue where changing the case for an action in the url would allow the action in the AuthComponent making it accessible to not-logged in users
This commit is contained in:
parent
2bffd4c26d
commit
f6534d2962
2 changed files with 8 additions and 3 deletions
|
@ -268,8 +268,8 @@ class AuthComponent extends Component {
|
|||
return true;
|
||||
}
|
||||
|
||||
$methods = array_flip($controller->methods);
|
||||
$action = $controller->request->params['action'];
|
||||
$methods = array_flip(array_map('strtolower', $controller->methods));
|
||||
$action = strtolower($controller->request->params['action']);
|
||||
|
||||
$isMissingAction = (
|
||||
$controller->scaffold === false &&
|
||||
|
@ -296,7 +296,7 @@ class AuthComponent extends Component {
|
|||
$allowedActions = $this->allowedActions;
|
||||
$isAllowed = (
|
||||
$this->allowedActions == array('*') ||
|
||||
in_array($action, $allowedActions)
|
||||
in_array($action, array_map('strtolower', $allowedActions))
|
||||
);
|
||||
|
||||
if ($loginAction != $url && $isAllowed) {
|
||||
|
|
|
@ -671,6 +671,11 @@ class AuthComponentTest extends CakeTestCase {
|
|||
$this->Controller->request->query['url'] = Router::normalize($url);
|
||||
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
|
||||
$url = '/auth_test/CamelCase';
|
||||
$this->Controller->request->addParams(Router::parse($url));
|
||||
$this->Controller->request->query['url'] = Router::normalize($url);
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue