Skip to content

feat: allow deleting own messages with an application token (#1090) - #1091

Open
EinfacheSache wants to merge 2 commits into
gotify:masterfrom
EinfacheSache:feat/app-token-delete-message
Open

EinfacheSache wants to merge 2 commits into
gotify:masterfrom
EinfacheSache:feat/app-token-delete-message

Conversation

@EinfacheSache

@EinfacheSache EinfacheSache commented Nov 19, 2026 •

Copy link
Copy Markdown

Closes #1090.

Applications can delete their own messages with their application token. Before, DELETE /message/{id} required a client token, which has access to all messages.

Changes

  • DELETE /message/{id} now uses RequireApplicationOrClient, like POST /message. The route moved out of the client-only group. RequireApplicationOrClient checks the same client/basic-auth handlers as RequireClient, plus the application token.
  • Disabled by default. Deleting with an application token has to be allowed per application with the new allowMessageDelete setting (switch in the application's edit dialog, or allowMessageDelete on POST/PUT /application). Otherwise the request returns 403, so applications stay push-only unless the user explicitly allows more, e.g. an ssh login notifier can't remove its messages. On PUT /application/{id} an omitted value keeps the current setting.
  • With an application token, only messages of that application can be deleted. Messages of other applications return 404, the same as unknown ids.
  • Client token and basic auth behave as before.
  • Swagger docs and docs/spec.json list the application token security definitions.

Tests

  • API/router: deleting with an application token is forbidden (403) unless allowed; the setting defaults to false and is kept when omitted on update.
  • e2e: the switch in the application dialog is off by default and can be enabled per application.
  • API: deleting your own message, a message of another application (404), an unknown id (404), and the client path unchanged.
  • Router: app token, client token, invalid token (401), and a foreign message.
  • Passing locally: go vet ./..., go test ./..., tsc, lint, testformat and the full UI e2e suite.

Deletions are still not sent over /stream. This is unchanged and could be a follow-up.

DELETE /message/{id} now also accepts an application token. An application
can only delete its own messages, messages of other applications return 404
like unknown ids. Client token and basic auth behave as before.
Deleting messages with an application token is disabled by default. It
has to be enabled per application with the new `allowMessageDelete`
setting, e.g. in the application's edit dialog in the web UI. Otherwise
`DELETE /message/{id}` returns 403 for application tokens. Client tokens
and basic auth are unchanged.

This keeps applications push-only unless the user explicitly allows more.
An application whose token could be misused (e.g. an ssh login notifier)
can't remove its messages afterwards.

On `PUT /application/{id}` an omitted `allowMessageDelete` keeps the
current value, so existing clients don't reset it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Allow applications to delete their own messages with an application token

1 participant