Repository navigation
fix(redaction): harden URL, literal and line-break redaction - #17
Merged
Merged
Conversation
Values found under sensitive context keys were replaced in the whole record regardless of length. Code that logs request input under such a key let an attacker erase arbitrary text from the entry (their IP, user name) or garble it completely with a one-character "password". Only values of at least 8 characters are now scrubbed across the record. Shorter values are still redacted at their own key.
Failed WP HTTP API requests were logged with their full URL. Redaction dropped query and userinfo but kept the path, where Slack and Discord webhooks and Telegram bot tokens carry their credential. Anyone reading the log could post to the channel or control the bot. The http channel now logs scheme, host and port and replaces any path or query with a placeholder.
With include_stacktraces, Monolog keeps inline line breaks, so CR/LF in messages or context strings (database errors, HTTP error messages, third-party input) produced lines that look like separate log entries. The sanitizer now escapes CR and LF as literal \r and \n in all text it returns. Stack traces are appended by the formatter afterwards and stay multi-line.
Document the minimum length for record-wide scrubbing, escaped line breaks and origin-only URLs for failed HTTP requests, so docs/handlers.md stays exact.
Bump the plugin header, which had stayed at 1.1.5 since that release, and add the changelog entry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Three Low findings from the 2026-11-15 security audit:
WordPressHttpApiLogger::context()).ContextSanitizer::sanitizeText()strips query and userinfo but keeps the path, where Slack/Discord webhooks and Telegrambot<id>:<token>carry the credential.password,nonce,token…) werestr_replaced across the whole record. Code that logs request input under such a key let an attacker erase their IP/user name from the entry or garble it (password => 'e').include_stacktraces– Monolog then keeps inline line breaks, and CR/LF in messages or context strings survived sanitization.Fix
WordPressHttpApiLoggerlogs onlyscheme://host[:port]and replaces any path/query with/[path redacted](unparsable URLs become[url redacted]).ContextSanitizer::withSensitiveContext()collects values for record-wide scrubbing only from 8 characters on. Shorter values stay redacted at their own key. The full literal is still matched exactly.ContextSanitizer::sanitizeText()escapes CR/LF as literal\r/\nas its last step, which covers messages, context/extra strings and sanitized exception messages. Stack trace frames are unaffected.docs/handlers.mddescribes the new rules.Behaviour change: a short (< 8 chars) value under a sensitive key that also appears unlabelled elsewhere in the record is no longer masked there. The old test
testActualShortPasswordsRemainRedactedasserted exactly the behaviour flagged by the audit and was replaced.Tests
WordPressHttpApiLoggerTest(Slack, Discord, Telegram, origin-only, unparsable): 5/5 failed before, pass after.testShortSensitiveValuesAreRedactedOnlyAtTheirKey: failed before ('user' => '[r[redacted]dact[redacted]d]'), passes after.testLineBreaksCannotForgeEntriesWhenStackTracesAreEnabled(LineFormatter withincludeStacktraces()): failed before (3 line breaks instead of 1), passes after.composer validate --strict,composer cs,composer static-analysis(PHPStan level 8) andcomposer tests(50 tests, 367 assertions) are green locally.Release
Patch release 1.1.8 (
chore(release): prepare 1.1.8): CHANGELOG entry and plugin header. The header had stayed at 1.1.5 and is corrected. The entry also mentions the unreleased CI pin tosympress/workflowsv1.3.2.