Skip to content

fix(api): mask access token in Payload.toString() - #386

Open
buongarzoni wants to merge 1 commit into
masterfrom
fix/stop-logging-access-token
Open

buongarzoni wants to merge 1 commit into
masterfrom
fix/stop-logging-access-token

Conversation

@buongarzoni

Copy link
Copy Markdown
Collaborator

Description of the change

Payload.toString() printed the access token in plain text, and RollbarBase logs the payload at
DEBUG on every event (LOGGER.debug("Payload built: {}", payload)). Turning on DEBUG logging, which
people often do while debugging an incident, wrote the token to log files and any log shipper.

toString() now masks the token and keeps only its last 4 characters, so you can still tell which
token is configured:

Before: Payload{accessToken='fake0000000000000000000000secret', data=...}
After:  Payload{accessToken='****cret', data=...}

Tokens of 8 characters or fewer are fully masked ('****'). A null token still prints null.
Serialization (asJson()) is unchanged, so the token is still sent to the API.

After changes
Captura de pantalla 2026-11-13 a la(s) 3 15 13 a  m

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Checklists

Development

  • Lint rules pass locally (checkstyleMain)
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development (PayloadTest)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T06:17:05.482413Z e96202b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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