Skip to content

Allow applications to delete their own messages with an application token #1090

Open

Description

@EinfacheSache

Is your feature request related to a problem? Please describe.
Applications send messages with an application token, but deleting a message (DELETE /message/{id}) requires a client token. A client token can read and manage all messages of all applications, so a script that only wants to remove its own message (e.g. an approval request after it was handled, or a status message that is outdated) needs far more access than it should have.

POST /message already returns the id of the created message, and #302 suggests deleting and re-sending as a workaround, but that isn't possible with an application token today.

Describe the solution you'd like
Allow DELETE /message/{id} with an application token, limited to messages of that application:

  • The route uses RequireApplicationOrClient, like POST /message.
  • With an application token, only messages of this application can be deleted. Messages of other applications return 404, the same as unknown ids, so ids can't be probed.
  • With a client token or basic auth, behavior is unchanged.

Describe alternatives you've considered

  • A separate path such as DELETE /application/message/{id}. This adds a second endpoint for the same resource, so I'd prefer reusing DELETE /message/{id}.
  • Using a client token in scripts, which grants access to all messages.

Additional context
Deletions are currently not sent over /stream. That stays unchanged here and could be a follow-up.

I've implemented this and will open a PR.

Activity

  1. jmattheis commented on Nov 19, 2026

    @jmattheis
    Member

    I don't think I'd want to support this. It was a intentional decision to allow applications to only push message.

    E.g. you have a script that notifies you on every ssh login, in case third-party log into your server. If the application is allowed to delete messages, then they can just remove the message.

  2. EinfacheSache commented on Nov 19, 2026

    @EinfacheSache
    Author

    Thanks for the explanation, that's a good point. An ssh login notifier must not be able to hide its own message.

    I've changed #1091 so that deleting is disabled by default and has to be enabled per application (allowMessageDelete, a switch in the application's edit dialog). Applications stay push-only unless the user explicitly allows more for a specific application. For your example nothing changes: the ssh notifier doesn't get the permission, so its token can't delete anything, even if it's stolen.

    The opt-in is useful for applications that manage their own messages, e.g. an approval request that is removed after it was handled, or a status message that is outdated. Today these scripts need a client token, which can read and delete all messages of all applications. Enabling the permission for one application is a much smaller grant than that.

    I applied the same opt-in to updating messages in #1089 (allowMessageUpdate), because the same argument applies there: an application could otherwise overwrite its message.

    Would this work for you?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions