Repository navigation
feat: revoke button and notices for scheduled grants (part 2 of #108) - #114
Merged
Merged
Conversation
- The message of a scheduled grant keeps a Revoke button until the grant ends. A Revoke ends the grant (grant_ended, cause revoked). It passes the user, chat, data and message checks; it skips the changed-message check, because it only takes a right away, except on a message whose request may still wait. - When a grant ends for any cause, also a later Deny, its message says how and when, and the button goes away. - A grant that reaches its end with uses left sends a "not used" notice. - On a broker stop, one notice lists the dropped grants. The stop denies every request before it updates the messages and sends the notice. Refs #108
7 tasks
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.
Refs #108. Part 2 of 2. Part 1 was #112.
What it does
grant_endedwith the new causerevoked(button datar:+ request ID,audit.AnswerRevoke).grant_ended.How a Revoke tap is checked
A Revoke tap gets every check of an Approve or Deny tap: the approver user, the private chat, not inline, strict data, and in the core the grant of that request ID on that message. It skips the check for a changed message, because a Revoke can only take a right away. Telegram sends no content for a message older than 48 hours, so this check would refuse a real Revoke on an old grant. The one exception: a Revoke on a message whose request may still wait is refused as a changed message, with the alert.
Security review
The
security-revieweragent reviewed the change, then each round of fixes. No critical or high findings. Fixed:edit_daterule for the broker's own edit was removed.editMu. This one-line fix has no test: a test would need a hook or a sleep.Tests
CI=true go test -race ./...passes on Go 1.27.1 and Go 1.26.0.go vetandgolangci-lint run --build-tags e2eare clean.-count=20 -cpu 1,2,4. Each fails without its fix, except item 8.TestCoreNotUsedNotice).internal/brokerwith a fake notice function, and in the core with the fake approver. There is no child-process test incmd/nodkey.No new dependencies.