Skip to content

Commit 6b7bd13

Browse files
docs: describe HAR redaction features in README
Document the new HarSanitizer API and the har:sanitize CLI command so users can discover them without reading the source. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a1e86cb commit 6b7bd13

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,39 @@ Features include:
2626
* Adapters for PSR-7 Request and Response interfaces.
2727
* An interface and `\Deviantintegral\Har\HarRepository` class to load HARs from a filesystem or other backend.
2828
* [A CLI tool](https://github.com/deviantintegral/har/releases) to split a HAR file into single files per request / response pair.
29+
* Redacting sensitive values (headers, cookies, query parameters, and JSON body fields) before sharing a HAR.
2930

3031
## Example
3132

3233
See [ReadmeTest.php](tests/src/Unit/ReadmeTest.php) for an example of how to use this library.
3334

35+
## Redacting sensitive data
36+
37+
HAR files captured from browsers or proxies often contain credentials, session
38+
cookies, or other secrets. Use `HarSanitizer` to replace those values with
39+
`[REDACTED]` (configurable via `setRedactedValue()`) before sharing the file.
40+
Field matching is case-insensitive by default.
41+
42+
```php
43+
use Deviantintegral\Har\HarSanitizer;
44+
45+
$sanitized = (new HarSanitizer())
46+
->redactHeaders(['Authorization', 'Cookie'])
47+
->redactCookies(['session'])
48+
->redactQueryParams(['api_key'])
49+
->redactBodyFields(['password', 'token'])
50+
->sanitize($har);
51+
```
52+
53+
The CLI ships a `har:sanitize` command that exposes the same options:
54+
55+
```
56+
bin/console har:sanitize input.har output.har \
57+
--header=Authorization --header=Cookie \
58+
--query-param=api_key \
59+
--body-field=password
60+
```
61+
3462
## Optional values
3563

3664
The HAR specification documents some fields as `-1` if they do not have a

0 commit comments

Comments
 (0)