Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The following headers are always redacted and cannot be un-redacted: `Authorizat

Additional query parameter names whose values are logged as `***REMOVED SENSITIVE VALUE***` in the `uri` field. Matching is case-insensitive; the parameter name and the rest of the URI stay unchanged. Default: `[]`.

The following parameters are always redacted and cannot be un-redacted: `access_token`, `api_key`, `apikey`, `auth`, `client_secret`, `password`, `secret`, `signature`, `token`, `X-Amz-Credential`, `X-Amz-Security-Token`, `X-Amz-Signature`.
The following parameters are always redacted and cannot be un-redacted: `access_token`, `api_key`, `apikey`, `auth`, `client_secret`, `key`, `password`, `secret`, `signature`, `token`, `X-Amz-Credential`, `X-Amz-Security-Token`, `X-Amz-Signature`.

```php
'audit_http_client_redact_params' => [
Expand All @@ -118,7 +118,7 @@ The following pattern is always applied and cannot be removed: `#(?<=/private-)[

```php
'audit_http_client_redact_path_patterns' => [
'#(?<=/)key-[0-9a-f]+#',
'#(?<=/)sess-[0-9a-f]+#',
],
```

Expand Down
1 change: 1 addition & 0 deletions lib/Http/Client/Middleware/HttpClientLoggerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ final class HttpClientLoggerMiddleware {
'apikey',
'auth',
'client_secret',
'key',
'password',
'secret',
'signature',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ public function testRedactUriRedactsDefaultParamsCaseInsensitively(): void {
'https://api.example.com/v1/data?Access_Token=***REMOVED SENSITIVE VALUE***',
$this->invokePrivate($mw, 'redactUri', ['https://api.example.com/v1/data?Access_Token=geheim']),
);
$this->assertSame(
'https://maps.googleapis.com/maps/api/geocode/json?address=Berlin&key=***REMOVED SENSITIVE VALUE***',
$this->invokePrivate($mw, 'redactUri', ['https://maps.googleapis.com/maps/api/geocode/json?address=Berlin&key=AIzaSyExample']),
);
}

public function testRedactUriRedactsConfiguredExtraParams(): void {
Expand Down Expand Up @@ -313,10 +317,10 @@ public function testRedactUriRedactsPrivatePathSegments(): void {
}

public function testRedactUriAppliesConfiguredPathPatterns(): void {
$mw = $this->middleware(0, [], [], [], ['#(?<=/)key-[0-9a-f]+#']);
$mw = $this->middleware(0, [], [], [], ['#(?<=/)sess-[0-9a-f]+#']);
$this->assertSame(
'https://x.test/feed/***REMOVED SENSITIVE VALUE***/data.xml',
$this->invokePrivate($mw, 'redactUri', ['https://x.test/feed/key-abc123/data.xml']),
$this->invokePrivate($mw, 'redactUri', ['https://x.test/feed/sess-abc123/data.xml']),
);
}

Expand Down
Loading