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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace App\Containers\Debugger\Values; |
||
4 | |||
5 | use App\Ship\Parents\Values\Value; |
||
6 | use Illuminate\Support\Facades\Config; |
||
7 | use Jenssegers\Agent\Facades\Agent; |
||
8 | use Symfony\Component\HttpFoundation\Request; |
||
9 | use Symfony\Component\HttpFoundation\Response; |
||
10 | |||
11 | /** |
||
12 | * Class Output |
||
13 | * |
||
14 | * @author Mahmoud Zalt <[email protected]> |
||
15 | */ |
||
16 | class Output extends Value |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | public $output = ''; |
||
23 | |||
24 | /** |
||
25 | * @var |
||
26 | */ |
||
27 | private $request; |
||
28 | |||
29 | /** |
||
30 | * @var |
||
31 | */ |
||
32 | private $response; |
||
33 | |||
34 | /** |
||
35 | * @var |
||
36 | */ |
||
37 | protected $responseDataCut; |
||
38 | |||
39 | /** |
||
40 | * @var |
||
41 | */ |
||
42 | protected $tokenDataCut; |
||
43 | |||
44 | /** |
||
45 | * Output constructor. |
||
46 | * |
||
47 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
48 | * @param \Symfony\Component\HttpFoundation\Response $response |
||
49 | */ |
||
50 | public function __construct(Request $request, Response $response) |
||
51 | { |
||
52 | $this->request = $request; |
||
53 | $this->response = $response; |
||
54 | |||
55 | $this->responseDataCut = Config::get("debugger.requests.response_show_first"); |
||
56 | $this->tokenDataCut = Config::get("debugger.requests.token_show_first"); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param $text |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | protected function set($text) |
||
65 | { |
||
66 | return $this->output = $text; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | public function get() |
||
73 | { |
||
74 | return $this->output; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @void |
||
79 | */ |
||
80 | public function clear() |
||
81 | { |
||
82 | $this->set(''); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Add header |
||
87 | * |
||
88 | * @param $name |
||
89 | */ |
||
90 | public function header($name) |
||
91 | { |
||
92 | $this->append("$name: \n"); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Add line to indicate new request |
||
97 | * |
||
98 | * @void |
||
99 | */ |
||
100 | public function newRequest() |
||
101 | { |
||
102 | $this->append("----------------- NEW REQUEST -----------------"); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Add empty line |
||
107 | * |
||
108 | * @void |
||
109 | */ |
||
110 | public function spaceLine() |
||
111 | { |
||
112 | $this->append("\n \n"); |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @void |
||
117 | */ |
||
118 | public function endpoint() |
||
119 | { |
||
120 | $this->append(" * Endpoint: " . $this->request->fullUrl() . "\n"); |
||
121 | $this->append(" * Method: " . $this->request->getMethod() . "\n"); |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * @void |
||
126 | */ |
||
127 | public function version() |
||
128 | { |
||
129 | if (method_exists($this->request, 'version')) { |
||
130 | $this->append(" * Version: " . $this->request->version() . "\n"); |
||
0 ignored issues
–
show
|
|||
131 | } |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * @void |
||
136 | */ |
||
137 | public function ip() |
||
138 | { |
||
139 | $this->append(" * IP: " . $this->request->ip() . " (Port: " . $this->request->getPort() . ") \n"); |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * @void |
||
144 | */ |
||
145 | public function format() |
||
146 | { |
||
147 | $this->append(" * Format: " . $this->request->format() . "\n"); |
||
0 ignored issues
–
show
The method
format() does not exist on Symfony\Component\HttpFoundation\Request . Did you maybe mean getFormat() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
148 | } |
||
149 | |||
150 | /** |
||
151 | * @void |
||
152 | */ |
||
153 | public function userInfo() |
||
154 | { |
||
155 | // Auth Header |
||
156 | $authHeader = $this->request->header("Authorization"); |
||
0 ignored issues
–
show
The method
header() does not exist on Symfony\Component\HttpFoundation\Request . Did you maybe mean getTrustedHeaderSet() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
157 | // User |
||
158 | $user = $this->request->user() ? "ID: " . $this->request->user()->id . " (Name: " . $this->request->user()->name . ")" : "N/A"; |
||
159 | // Browser |
||
160 | $browser = Agent::browser(); |
||
161 | |||
162 | $this->append(" * Access Token: " . substr($authHeader, 0, |
||
163 | $this->tokenDataCut) . (!is_null($authHeader) ? "..." : "N/A") . "\n"); |
||
164 | $this->append(" * User: " . $user . "\n"); |
||
165 | $this->append(" * Device: " . Agent::device() . " (Platform: " . Agent::platform() . ") \n"); |
||
166 | $this->append(" * Browser: " . $browser . " (Version: " . Agent::version($browser) . ") \n"); |
||
167 | $this->append(" * Languages: " . implode(", ", Agent::languages()) . "\n"); |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * @void |
||
172 | */ |
||
173 | public function requestData() |
||
174 | { |
||
175 | // Request Data |
||
176 | $requestData = $this->request->all() ? http_build_query($this->request->all(), "", " + ") : "N/A"; |
||
177 | |||
178 | $this->append(" * " . $requestData . "\n"); |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * @void |
||
183 | */ |
||
184 | public function responseData() |
||
185 | { |
||
186 | // Response Data |
||
187 | $responseContent = ($this->response && method_exists($this->response, |
||
188 | "content")) ? $this->response->content() : "N/A"; |
||
0 ignored issues
–
show
The method
content() does not exist on Symfony\Component\HttpFoundation\Response . Did you maybe mean getContent() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
189 | |||
190 | $this->append(" * " . substr($responseContent, 0, $this->responseDataCut) . "..." . "\n"); |
||
191 | } |
||
192 | |||
193 | /** |
||
194 | * @param $output |
||
195 | * |
||
196 | * @return string |
||
197 | */ |
||
198 | private function append($output) |
||
199 | { |
||
200 | return $this->output .= $output; |
||
201 | } |
||
202 | |||
203 | } |
||
204 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.