Skip to content

Remove request body from exception message - #30

Merged
guusbeckett merged 4 commits into
masterfrom
fix/remove-request-body-from-exception
Oct 20, 2026
Merged

guusbeckett merged 4 commits into
masterfrom
fix/remove-request-body-from-exception

Conversation

@guusbeckett

@guusbeckett guusbeckett commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Authored by Guus H. Beckett.

When a request failed to send (DNS failure, timeout, connection reset, TLS error and so on), HttpHelper.sendRequest threw a RuntimeException whose message contained the complete request body. That body holds the product token, the recipient numbers and the message content (which can include one-time passwords). Anyone able to read the application's logs, crash reports or CI output could therefore recover the product token and personal data.

Changes

  • HttpHelper: the exception message now only contains the URL (Error sending request to url: <url>). The original exception is still attached as the cause, so the underlying failure remains visible.
  • Add MessagingClientErrorTest, which asserts that neither the product token, the recipient nor the message content appear in the exception message or any of its causes, for both a refused connection and an HTTP 500 response. The tests fail against the previous code.
  • Add JUnit 4 as a test dependency, and stop ignoring test failures in the Maven build workflow so that a regression fails the build.
  • Update actions/checkout and actions/setup-java in the build and publish workflows. The old setup-java@v2 failed while restoring the Maven cache, so every build job failed before Maven ran.
  • Publish to Maven Central through the Central Portal (central-publishing-maven-plugin) instead of the retired OSSRH endpoint. The ossrh Maven profile is replaced by a central profile, and the workflow now needs CENTRAL_TOKEN_USERNAME and CENTRAL_TOKEN_PASSWORD repository secrets (a Central Portal user token). The publish workflow can only be fully tested by creating a release.
  • Bump the version to 3.0.1 in pom.xml and the README.md dependency snippet.
  • Add a 3.0.1 entry to CHANGELOG.md.

Notes

  • Versions 2.0.1, 2.1.0 and 3.0.0 are affected. Users should upgrade to 3.0.1 once released.
  • Applications that already logged exceptions from earlier versions should consider rotating their product token if their logs are accessible to others.

Guus Hendrik Beckett added 2 commits October 20, 2026 13:46
HttpHelper included the full request body in the RuntimeException thrown
when a request failed to send. The body contains the product token, the
recipient numbers and the message content, so any transport failure that
was logged would write these to application logs.

The exception message now only contains the URL. The original exception
is still attached as the cause.

Bump version to 3.0.1.
Verify that the exception thrown when a request fails (connection refused
and a non-2xx response) does not contain the product token, the recipient
or the message content, in the message or in any cause.

Add JUnit 4 as a test dependency and no longer ignore test failures in the
Maven build workflow, so that a regression fails the build.
Guus Hendrik Beckett added 2 commits October 20, 2026 14:04
actions/setup-java@v2 fails while restoring the Maven cache ('Cache
service responded with 400') because the legacy cache service it uses
has been retired, so every build job failed before Maven ran.

Use actions/setup-java@v5 and actions/checkout@v4.
Publishing to Maven Central used the OSSRH staging endpoint
(s01.oss.sonatype.org), which has been retired. Replace the ossrh Maven
profile with one for the Central Portal, using
central-publishing-maven-plugin, and use a Central Portal user token
(CENTRAL_TOKEN_USERNAME and CENTRAL_TOKEN_PASSWORD secrets) instead of
the OSSRH credentials.

Also update actions/checkout to v7 and actions/setup-java to v6 in both
workflows, as the older versions are deprecated.
@guusbeckett
guusbeckett merged commit 8bb9e56 into master Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants