fix: enforce forced retention on message edits, feedback, and error saves

Two more message-write paths bypassed ephemeral enforcement:

- The edit and feedback endpoints call updateMessage directly, without loading
  retention config, so editing an older permanent message after a switch to
  ephemeral left the message and its conversation non-temporary and visible.
  Load config on those routes and run a new applyForcedRetention helper after the
  update, which stamps the message and cascades the conversation/messages.

- The sendError and denyRequest middleware save messages with retention config
  but never call saveConvo, so a validation/model error or denied-request message
  could outlive its conversation. Pass capExpiryToConversation like the other
  message-only paths.

Extract the conversation cascade into a shared cascadeForcedConversationRetention
helper used by both saveMessage and applyForcedRetention.
This commit is contained in:
Marco Beretta 2026-06-22 10:46:04 +02:00
parent 6ab4400ace
commit 9cbbeb6e85
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
6 changed files with 290 additions and 112 deletions

View file

@ -56,6 +56,7 @@ const sendError = async (req, res, options, callback) => {
{ ...errorMessage, user },
{
context: 'api/server/utils/streamResponse.js - sendError',
capExpiryToConversation: true,
},
);
}