Repository navigation
fix: Honor the password in the query-parameter message export - #586
tonygermano wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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.
|
@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. |
|
@pacmano1 Thanks for testing this. You're right that 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- The fix probably belongs in Claude checked the cause in 🤖 Drafted with Claude Code |
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.
MessageWriterFactoryonly 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 inMessageServletTestfor a password, no password and an empty password. The first fails without the change.Claude checked:
./gradlew clean build distpasses on this branch.oie/main,POST /api/channels/{channelId}/messages/_exportwitharchiveFormat=zip,password=secretandencryptionType=AES256as query parameters wrote a ZIP whose entries are not encrypted.passwordstill writes a plain ZIP.Release notes
passwordparameter and writing an unprotected ZIP.🤖 Drafted with Claude Code