Skip to content

[BUG] Message export fails with a NullPointerException when a password is given without an encryption type #591

Open

Description

@tonygermano

A message export that is given a password but no encryptionType fails with HTTP 500 and a NullPointerException. Nothing is logged in mirth.log, and an empty .export.zip is left in the export folder.

Steps

  1. Call POST /channels/{channelId}/messages/_export with archiveFormat=zip and password=secret, and no encryptionType. The same happens through _exportUsingFilter when passwordEnabled is true and encryptionType is missing.
  2. Look at the response and the export folder.

Expected

The request is rejected with a message that says encryptionType is required with a password, or the type has a documented default. Nothing is left in the export folder.

Actual

HTTP 500 with a NullPointerException, no log entry, and an empty .export.zip in the export folder.

Cause

encryptionType is optional and has no default. In ArchiveUtils.createFolderArchive, a null type counts as AES (encryptionType != EncryptionType.STANDARD), so it reaches encryptionType.getKeyStrength() and throws.

Before #586, the query-parameter variant never enabled the password, so it ignored it and wrote an unprotected ZIP with a 200. _exportUsingFilter already fails this way on main. #586 makes the query-parameter variant fail the same way, which is the safer outcome but a poor error. The report is in the review of #586.

Suggested fix

Reject a password without an encryptionType up front in MessageWriterFactory, with a message naming the missing parameter. That covers both variants and writes nothing. Defaulting to AES-256 would also work, but it chooses a cipher for the caller.

#580 changes the same method to reject a password for archive formats that can't be protected. A fix here will conflict with it, so build on #580 or wait for it to merge.

Claude checked: the cause by reading ArchiveUtils and MessageWriterOptions. The 500 was reported in the review of #586 and was not reproduced by Claude.


🤖 Drafted with Claude Code

Activity

  1. added theissue type on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions