You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that this will also remove the HTML `head` element which contains `meta name="ROBOTS"` tag preventing search engines and other bots indexing the `phpinfo()` output.
22
+
You have to add it back somehow, for example by rendering the `getHtml()` output in your own layout which includes the `head` element with the `meta name="ROBOTS"` tag.
23
+
In general, `phpinfo()` output should be accessible only for authenticated users.
24
+
25
+
## `getFullPageHtml()`
26
+
Sometimes, you may want to display the classic `phpinfo()` output, with the original HTML `head` and `body` elements, `meta name="ROBOTS"` tag, inline styles etc.,
27
+
but still with the sensitive info sanitized (see below). In that case, you may use `getFullPageHtml()`:
28
+
```php
29
+
$phpInfo = new \Spaze\PhpInfo\PhpInfo();
30
+
echo $phpInfo->getFullPageHtml();
31
+
```
32
+
20
33
## Sanitization
21
-
By default, session id (as returned by `session_id()` if session is started, or as stored in `$_COOKIE[session_name()]` if not) will be sanitized and replaced by `[***]` in the output.
34
+
By default, session id will be automatically determined and replaced by `[***]` in the output.
22
35
This is to prevent some session hijacking attacks that would read the session id from the cookie value reflected in the `phpinfo()` output
23
36
(see my [blog post](https://www.michalspacek.com/stealing-session-ids-with-phpinfo-and-how-to-stop-it) describing the attack, `HttpOnly` bypasses, and the solution).
24
37
You can disable the sanitization by calling `doNotSanitizeSessionId()` but it's totally not recommended. Do not disable that. Please.
@@ -32,30 +45,30 @@ If found, the string in `$sanitize` will be replaced with the string `$with`, if
32
45
Some of the values in `phpinfo()` output are printed URL-encoded, so the `$sanitize` value will also be searched URL-encoded automatically.
33
46
This means that both `foo,bar` and `foo%2Cbar` would be replaced.
34
47
35
-
## Sanitizing arbitrary strings
36
-
If you have your `phpinfo()` output (or anything really) in a string, you can use the sanitizer standalone, for example:
37
-
```php
38
-
$sanitizer = new \Spaze\PhpInfo\SensitiveValueSanitizer();
0 commit comments