Skip to content

Redact sensitive query params in HTTP error messages#5

Open
trasnake87 wants to merge 1 commit intominecraft-linux:masterfrom
trasnake87:fix/redact-sensitive-query-params
Open

Redact sensitive query params in HTTP error messages#5
trasnake87 wants to merge 1 commit intominecraft-linux:masterfrom
trasnake87:fix/redact-sensitive-query-params

Conversation

@trasnake87
Copy link

@trasnake87 trasnake87 commented Feb 6, 2026

Summary

  • Added redact_url_query() static helper function that replaces query parameter values with [redacted] while preserving parameter names, separators, and URL structure
  • Updated error messages in both synchronous and asynchronous http_request::perform() methods to redact URLs before including them in error output

This prevents sensitive tokens or credentials in query parameters from leaking into error messages/exceptions.

Example

Before:

Failed to perform http request to https://api.example.com/auth?token=secret123&key=abc456 : CURLcode 6

After:

Failed to perform http request to https://api.example.com/auth?token=[redacted]&key=[redacted] : CURLcode 6

Notes

  • Only lib/playapi/util/http.cpp is modified (no unrelated file changes)
  • No new headers or external dependencies required
  • The helper is deliberately simple: it redacts all query parameter values uniformly, preserving keys and separators for debugging utility
  • Debug-only printf statements (guarded by #ifndef NDEBUG) are left unchanged per the issue scope, as they are already disabled by default in release builds

Addresses the same problem described in #3.

Add a static redact_url_query() helper that replaces query parameter
values with [redacted] while preserving parameter names and URL
structure. Update both synchronous and asynchronous perform() error
messages to use it, preventing sensitive tokens or credentials from
leaking into error output.

Closes minecraft-linux#3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant