Redact API log detail payloads#310
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67854f8886
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $redacted = (string)$value; | ||
| $redacted = preg_replace('/\b(Authorization|Proxy-Authorization)\s*[:=]\s*(?:Bearer|Basic)?\s*[^\r\n,;]+/i', '$1: ***REDACTED***', $redacted); | ||
| $redacted = preg_replace('/\b(Bearer|Basic)\s+[A-Za-z0-9._~+\/=-]+/i', '$1 ***REDACTED***', $redacted); | ||
| $redacted = preg_replace('/([\'"]?(?:api[_-]?key|secret|token|access[_-]?token|refresh[_-]?token|password|client[_-]?secret)[\'"]?\s*[:=]\s*[\'"]?)[^\'",\r\n&]+/i', '$1***REDACTED***', $redacted); |
There was a problem hiding this comment.
Redact bracketed key/value pairs from print_r payloads
Update the redaction pattern to handle print_r-style entries (e.g. [secret] => ...), because the current regex only matches keys followed directly by : or =. In this codebase, API log payloads are stored via print_r(..., true) (see common/components/TapPayments.php around the request_body/response_body assignments), so credential fields like api_key, secret, or token in those arrays will bypass this replacement and still be shown in the API log detail view.
Useful? React with 👍 / 👎.
Summary
/claim #59
Validation