Repository navigation
Description
A message export that asks for a password but gives a blank one (empty or only whitespace) writes a plain, unprotected archive and reports success.
Steps
- Call
POST /channels/{channelId}/messages/_exportUsingFilterwitharchiveFormat=zip,passwordEnabledtrue,encryptionType=AES256andpasswordset to three spaces. The query-parameter variant withpassword=%20%20%20ends up in the same place, since fix: Honor the password in the query-parameter message export #586 enables the password whenever it is not empty. - Open the resulting archive.
Expected
The password is used, or the request is rejected with a message that the password is blank. Nothing unprotected is written.
Actual
A plain ZIP, HTTP 200, and no log entry. The password is enabled, but MessageWriterFactory and ArchiveUtils both skip it with StringUtils.isNotBlank.
The same is true for TAR, where the unsupported-format check from #580 also skips a blank password.
Existing behavior
The Administrator already refuses a blank password. MessageExportPanel shows "A password is required." when "Password Protect: Yes" is selected and the field is blank (isBlank). The server API has no such check, so a request that bypasses the GUI gets an unprotected archive.
This came up in the review of #586. It was left as is there because #586 did not change what happens to a blank password: the archive is the same whether the servlet enables the password or not.
Options
- Reject it. Fail up front in
MessageWriterFactorywith a message that the password is blank, and write nothing. This matches the GUI and the direction of [BUG] Query-parameter message export ignores the password and writes an unprotected ZIP #582 and [BUG] Message export fails with a NullPointerException when a password is given without an encryption type #591. It changes behavior for any client that currently sends a blank password with the password enabled and relies on getting a plain archive. - Use it. A password of spaces is weak but valid, and a caller who asked for a password gets one. This means changing
ArchiveUtilsand the factory check, and it differs from the GUI. - Keep ignoring it. No change, with the behavior documented. This leaves the same failure as [BUG] Query-parameter message export ignores the password and writes an unprotected ZIP #582 in place for blank passwords.
I'd lean toward rejecting it, but it needs a maintainer decision, since options 1 and 2 both change behavior.
Related
- [BUG] Message export fails with a NullPointerException when a password is given without an encryption type #591 is the sibling bug: a password with no
encryptionTypethrows aNullPointerException. Both fixes would go in the same place inMessageWriterFactory, so whoever lands second may need a small rebase. [BUG] Message export fails with a NullPointerException when a password is given without an encryption type #591's fix deliberately keeps the non-blank condition, so a blank password stays out of its scope. - [BUG] Query-parameter message export ignores the password and writes an unprotected ZIP #582 and fix: Honor the password in the query-parameter message export #586 are the original bug and its fix.
Claude checked: the blank-password path through MessageWriterFactory and ArchiveUtils for ZIP and TAR, and the GUI validation in MessageExportPanel, by reading the code. Claude did not run it against a server.
🤖 Drafted with Claude Code
Activity