Repository navigation
feat: allow deleting own messages with an application token (#1090) - #1091
Open
EinfacheSache wants to merge 2 commits into
Open
EinfacheSache wants to merge 2 commits into
EinfacheSache wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usesRequireApplicationOrClient, likePOST /message. The route moved out of the client-only group.RequireApplicationOrClientchecks the same client/basic-auth handlers asRequireClient, plus the application token.allowMessageDeletesetting (switch in the application's edit dialog, orallowMessageDeleteonPOST/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. OnPUT /application/{id}an omitted value keeps the current setting.docs/spec.jsonlist the application token security definitions.Tests
go vet ./...,go test ./...,tsc,lint,testformatand the full UI e2e suite.Deletions are still not sent over
/stream. This is unchanged and could be a follow-up.