This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | declare(strict_types=1); |
||
3 | |||
4 | /** |
||
0 ignored issues
–
show
|
|||
5 | * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) |
||
6 | * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) |
||
0 ignored issues
–
show
|
|||
7 | * |
||
8 | * Licensed under The MIT License |
||
9 | * For full copyright and license information, please see the LICENSE.txt |
||
10 | * Redistributions of files must retain the above copyright notice. |
||
11 | * |
||
12 | * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) |
||
0 ignored issues
–
show
|
|||
13 | * @link https://cakephp.org CakePHP(tm) Project |
||
0 ignored issues
–
show
|
|||
14 | * @since 0.2.9 |
||
0 ignored issues
–
show
|
|||
15 | * @license https://opensource.org/licenses/mit-license.php MIT License |
||
0 ignored issues
–
show
|
|||
16 | */ |
||
0 ignored issues
–
show
|
|||
17 | namespace App\Controller; |
||
18 | |||
19 | use Cake\Core\Configure; |
||
20 | use Cake\Http\Exception\ForbiddenException; |
||
21 | use Cake\Http\Exception\NotFoundException; |
||
22 | use Cake\Http\Response; |
||
23 | use Cake\View\Exception\MissingTemplateException; |
||
24 | |||
25 | /** |
||
26 | * Static content controller |
||
27 | * |
||
28 | * This controller will render views from templates/Pages/ |
||
29 | * |
||
30 | * @link https://book.cakephp.org/4/en/controllers/pages-controller.html |
||
31 | */ |
||
0 ignored issues
–
show
|
|||
32 | class PagesController extends AppController |
||
33 | { |
||
0 ignored issues
–
show
|
|||
34 | /** |
||
35 | * Displays a view |
||
36 | * |
||
37 | * @param string ...$path Path segments. |
||
0 ignored issues
–
show
|
|||
38 | * @return \Cake\Http\Response|null |
||
0 ignored issues
–
show
|
|||
39 | * @throws \Cake\Http\Exception\ForbiddenException When a directory traversal attempt. |
||
0 ignored issues
–
show
|
|||
40 | * @throws \Cake\View\Exception\MissingTemplateException When the view file could not |
||
41 | * be found and in debug mode. |
||
42 | * @throws \Cake\Http\Exception\NotFoundException When the view file could not |
||
43 | * be found and not in debug mode. |
||
44 | * @throws \Cake\View\Exception\MissingTemplateException In debug mode. |
||
45 | */ |
||
46 | 4 | public function display(string ...$path): ?Response |
|
0 ignored issues
–
show
|
|||
47 | { |
||
0 ignored issues
–
show
|
|||
48 | 4 | if (!$path) { |
|
0 ignored issues
–
show
|
|||
49 | return $this->redirect('/'); |
||
50 | } |
||
0 ignored issues
–
show
|
|||
51 | 4 | if (in_array('..', $path, true) || in_array('.', $path, true)) { |
|
52 | 1 | throw new ForbiddenException(); |
|
53 | } |
||
0 ignored issues
–
show
|
|||
54 | 3 | $page = $subpage = null; |
|
0 ignored issues
–
show
|
|||
55 | |||
56 | 3 | if (!empty($path[0])) { |
|
0 ignored issues
–
show
|
|||
57 | 3 | $page = $path[0]; |
|
58 | } |
||
0 ignored issues
–
show
|
|||
59 | 3 | if (!empty($path[1])) { |
|
0 ignored issues
–
show
|
|||
60 | $subpage = $path[1]; |
||
61 | } |
||
0 ignored issues
–
show
|
|||
62 | 3 | $this->set(compact('page', 'subpage')); |
|
63 | |||
64 | try { |
||
65 | 3 | return $this->render(implode('/', $path)); |
|
66 | 2 | } catch (MissingTemplateException $exception) { |
|
0 ignored issues
–
show
|
|||
67 | 2 | if (Configure::read('debug')) { |
|
68 | 1 | throw $exception; |
|
69 | } |
||
0 ignored issues
–
show
|
|||
70 | 1 | throw new NotFoundException(); |
|
71 | } |
||
72 | } |
||
0 ignored issues
–
show
|
|||
73 | } |
||
74 |