Skip to content

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

Open

Description

@tonygermano

The query-parameter variant of the server-side message export endpoint ignores the password parameter, so a request for a password-protected ZIP silently produces an unprotected one.

Steps

  1. Call POST /channels/{channelId}/messages/_export with archiveFormat=zip, password=secret and encryptionType=AES256 as query parameters, and a rootFolder and archiveFileName the server can write to.
  2. Open the resulting ZIP.

Expected

The archive is encrypted with the given password.

Actual

The export succeeds and the archive is not encrypted.

Cause

MessageServlet.getMessageWriterOptions copies password and encryptionType into the MessageWriterOptions, but never calls setPasswordEnabled. MessageWriterFactory only applies a password when isPasswordEnabled() is true, so it is dropped.

The other overload, which takes a MessageWriterOptions object in the request body, is not affected, because the options arrive with passwordEnabled as the client set it. The administrator's export dialog uses that overload.

Fix

Call writerOptions.setPasswordEnabled(StringUtils.isNotEmpty(password)) in getMessageWriterOptions.

Claude checked: reproduced on a server built from oie/main (dcd48b9, zip4j 1.3.3). A channel with two messages was exported with POST /api/channels/{channelId}/messages/_export?contentType=RAW&rootFolder=appdata/temp/verify-export&filePattern=${message.messageId}.txt&archiveFileName=query-export&archiveFormat=zip&password=secret&encryptionType=AES256&pageSize=10. The request returned 2 and wrote query-export.zip. Both entries have the encrypted flag clear and deflate compression, and the first entry reads back without a password.


🤖 Drafted with Claude Code

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions