Repository navigation
Conversation
Slice 071. Every automatic criterion runs against a local fake Bot API.
The live run needs the owner's bot token and is queued with exact steps.
Two security defects in slice 070's core, each reproduced red first:
- F1. Router.prompt_for/1 sent an unknown sender the very pairing code it
was meant to read on /gateways, so anyone who found the bot could pair
by echoing the prompt back. 070's own test asserted the leak. The
prompt now says where the code is, never what it is, restoring
docs/07's rule ("shown on /gateways and nowhere else").
- F2. Approval ids are UUIDv7, so the 8-character short id is shared by
every request raised within about 65 seconds, and /approve <short>
decided whichever came first. Commands.find_pending/1 now refuses an
ambiguous prefix, and buttons carry the full id.
The gateway:
- Bot API calls over Req, already in the lock: telegex has only an old
release candidate and ex_gram keeps its offset in memory, so neither
meets AC5. The token is read on every call and never stored; errors
never carry the URL, which holds it; Req's retry step is off.
- MarkdownV2 conversion that only emits a closed entity, with chunking
checked after conversion and properties against an independent parse
checker.
- An outbox that throttles edits to at least 1 s and keeps the final
text; long polling with the offset persisted before routing (at most
once); photos fetched only after admission, size-capped and
magic-checked, stored by digest; approval buttons only under the
channel cap.
- Trinity.Gateways.Supervisor starts the configured gateways, chosen by
TRINITY_GATEWAYS; nothing in the app started a gateway before.
- Images reach a session row and a :vision model, and are replaced by a
note otherwise. The log filter and secret scanner learn the token's
shape.
Red evidence R1 to R10 is in the slice NOTES.
Signed-off-by: Ayla Croft <aylacroft@proton.me>
Signed-off-by: Ayla Croft <aylacroft@proton.me> # Conflicts: # CHANGELOG.md # lib/trinity/gateways.ex # lib/trinity/gateways/router.ex
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.
Slice 071, the Telegram gateway, plus two security fixes to slice 070's gateway core. The slice stays
in_progressuntil the owner's live run with a real bot token (steps in the slice's PROOF).Read first: two fixes to 070's approved core
Router.prompt_for/1sent an unknown sender the code they were supposed to read on/gateways, so anyone who found the bot could pair by echoing it back. 070's own test asserted the leak. The prompt now says where the code is, never what it is. This restoresdocs/07-security-model.md's rule, "shown on/gatewaysand nowhere else". Nothing was exposed before this PR, because no gateway was ever started./approve <short>could decide the wrong request. Ambiguous prefixes are now refused, and buttons carry the full id.The gateway
Trinity.Gateways.SupervisorwithTRINITY_GATEWAYS. Nothing in the app started a gateway before this slice.:visionmodel, or are replaced by a note for any other model.Criteria
Evidence
1015 passed (22 properties, 993 tests), 18 excluded,prod_check: PASS.96 passed (2 properties, 94 tests).mix format --check-formattedOK;mix credo --strict --allfound no issues.Merge note
Slice 072 (Mattermost) builds on the same core and is aligning with this PR's supervisor and adapter shapes. Merge this one first.