Skip to content

fix: Honor the password in the query-parameter message export - #586

Open
tonygermano wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
tonygermano:fix/export-query-password
Open

tonygermano wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
tonygermano:fix/export-query-password

Conversation

@tonygermano

Copy link
Copy Markdown
Member

Fixes #582

The variant of the server-side message export that takes query parameters copied the password and encryption type into the writer options but never enabled the password. MessageWriterFactory only protects an archive when the password is enabled, so a request for a password-protected ZIP wrote an unprotected one without any error. The variant that takes the options in the request body, which the administrator uses, was not affected.

This enables the password when one is given.

The fix is a single line in MessageServlet.getMessageWriterOptions, with tests in MessageServletTest for a password, no password and an empty password. The first fails without the change.

Claude checked:

  • ./gradlew clean build dist passes on this branch.
  • On a server built from oie/main, POST /api/channels/{channelId}/messages/_export with archiveFormat=zip, password=secret and encryptionType=AES256 as query parameters wrote a ZIP whose entries are not encrypted.
  • On a server built from this branch, the same request writes entries with the encrypted flag set and the AES method, and an empty password still writes a plain ZIP.

Release notes

  • Fixed the query-parameter variant of the server-side message export ignoring the password parameter and writing an unprotected ZIP.

🤖 Drafted with Claude Code

The variant of the server-side message export that takes query parameters
copied the password and encryption type into the writer options but never
enabled the password. MessageWriterFactory only protects an archive when the
password is enabled, so a request for a password-protected ZIP wrote an
unprotected one without any error. The variant that takes the options in the
request body, which the administrator uses, was not affected.

Enable the password when one is given.

Tests: the options the controller receives for a password, no password and an
empty one; the first fails without the change.

Issue: OpenIntegrationEngine#582
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Tony Germano <tony@germano.name>
@tonygermano tonygermano added the bug Something isn't working label Nov 16, 2026
@github-actions

Copy link
Copy Markdown

Test Results

  142 files  ±0    142 suites  ±0   4m 4s ⏱️ +48s
  960 tests +2    960 ✅ +2  0 💤 ±0  0 ❌ ±0 
1 242 runs  +2  1 236 ✅ +2  6 💤 ±0  0 ❌ ±0 

Results for commit 3b08062. ± Comparison against base commit dcd48b9.

@pacmano1 pacmano1 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Live-tested a build of this branch against main. password=secret&encryptionType=AES256 now writes AES-encrypted entries; main writes them plain.

But password without encryptionType now fails: HTTP 500 with a NullPointerException, nothing in mirth.log, and an empty .export.zip left in the export folder. Main returns 200 with a plain ZIP. encryptionType isn't required and has no default, so a password alone is a valid request and now crashes.

_exportUsingFilter already does this on main when passwordEnabled is true and there's no encryptionType: same 500, same error text, same empty .export.zip. So the missing type needs handling where both variants end up: default it, or fail with a message that says encryptionType is needed.

Co-authored with Claude Code.

@tonygermano

Copy link
Copy Markdown
Member Author

@pacmano1 since it sounds like that is a preexisting bug, can it be handled in a follow-up PR? This PR was to stop it from producing an unencrypted zip when the parameters were passed in correctly for it to encrypt. Failing on bad input in the same way that another working method fails instead of silently producing wrong output sounds like this is meeting its goal.

@tonygermano

Copy link
Copy Markdown
Member Author

@pacmano1 Thanks for testing this. You're right that password without encryptionType now fails with an unhelpful error: a NullPointerException, nothing in the log, and an empty .export.zip left behind.

I still think failing is the right direction for this PR. A request that asks for a password-protected archive used to get a plain ZIP with no error, and that is the bug here. A loud failure is safer than an archive that looks protected and isn't, and the leftover file is empty. The message is what's wrong, not the outcome.

The missing-encryptionType case isn't new. It already happens on main in _exportUsingFilter when passwordEnabled is true, so it affects both variants and I'd rather not widen this fix. I've opened an issue for it so someone can pick it up: #591.

The fix probably belongs in MessageWriterFactory, which #580 also changes to reject a password for formats that can't be protected. Whoever takes it should expect a conflict with #580, and may prefer to build on it or wait for it to merge.

Claude checked the cause in ArchiveUtils: a null type counts as AES (encryptionType != STANDARD), so it reaches encryptionType.getKeyStrength(). Claude did not reproduce the 500 itself.


🤖 Drafted with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Query-parameter message export ignores the password and writes an unprotected ZIP

3 participants