Skip to content

Redact API log detail payloads#310

Open
jynbil1 wants to merge 1 commit into
BAWES-Universe:developfrom
jynbil1:harden-api-log-view-redaction
Open

Redact API log detail payloads#310
jynbil1 wants to merge 1 commit into
BAWES-Universe:developfrom
jynbil1:harden-api-log-view-redaction

Conversation

@jynbil1
Copy link
Copy Markdown

@jynbil1 jynbil1 commented May 17, 2026

Summary

  • redact sensitive authorization and credential-like values before rendering backend API log detail payloads
  • keep the stored request/response payloads unchanged while masking UI display values
  • add a shell guard to prevent direct ntext rendering of raw API log payload fields

/claim #59

Validation

  • sh -n tests/check-api-log-view-redaction.sh
  • sh tests/check-api-log-view-redaction.sh
  • git diff --check
  • PHP lint not run: php is not installed in this environment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba140bbe-0147-4728-8358-1a02bfe1f750

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant