Skip to content

MLE-30240: Redact auth headers from OkHttp logs#1942

Merged
jonmille merged 3 commits into
developfrom
MLE-30240
Jun 22, 2026
Merged

MLE-30240: Redact auth headers from OkHttp logs#1942
jonmille merged 3 commits into
developfrom
MLE-30240

Conversation

@jonmille

Copy link
Copy Markdown

Summary

When OkHttp HTTP traffic logging is enabled via the
com.marklogic.client.okhttp.httplogginginterceptor.level system property,
Authorization and x-auth-token header values are now automatically
replaced with [REDACTED] before any log output is written — preventing
credentials from appearing in log files, stdout, or stderr.

Changes

File Change
OkHttpServices.java Added redactSensitiveHeaders() method; applied to all three log output paths; pre-compiled Pattern constant; security Javadoc added
CONTRIBUTING.md New "HTTP Logging (Debugging Only)" section with security warning and property documentation
RedactSensitiveHeadersTest.java New unit test (9 tests, no MarkLogic instance required)

Jira Bug: https://progresssoftware.atlassian.net/browse/MLE-30240

Redact Authorization header from OkHttp logs
Copilot AI review requested due to automatic review settings June 17, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds automatic redaction of sensitive authentication headers in OkHttp HTTP traffic logging within the Java Client to prevent credentials from being written to logs/console output.

Changes:

  • Introduces a header-redaction helper in OkHttpServices and applies it to all OkHttp logging outputs (SLF4J logger / stdout / stderr).
  • Documents HTTP logging configuration and security risks in CONTRIBUTING.md.
  • Adds a focused unit test suite validating redaction behavior without requiring a MarkLogic instance.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java Adds redaction regex + helper and ensures all OkHttp log output paths redact sensitive headers.
CONTRIBUTING.md Documents HTTP logging properties and includes a security warning for non-production use.
marklogic-client-api/src/test/java/com/marklogic/client/impl/RedactSensitiveHeadersTest.java Adds unit tests for redaction behavior (single-line and multi-line messages).

Comment thread marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java Outdated
Comment thread CONTRIBUTING.md Outdated
Extract the OkHttp logging message handler and header-redaction logic from OkHttpServices into a dedicated RedactingHttpLogger class. Move the unit test to RedactingHttpLoggerTest in the same package. Revert CONTRIBUTING.md changes (HTTP logging docs belong in product documentation, not the contributor guide).
@jonmille jonmille requested a review from rjrudin June 18, 2026 17:43
@jonmille jonmille merged commit 523b444 into develop Jun 22, 2026
3 of 4 checks passed
@jonmille jonmille deleted the MLE-30240 branch June 22, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants