Abuse cases, each with the test that proves it
Work item issue-557, testing-plan activity T8. Run on 2026-11-30 in the work item's checkout, with THE_LOOP_INSTANCE, THE_LOOP_WORK_ITEM and THE_LOOP_CLI_CONFIG unset.
Command
sh
cd cli && uv run python -m pytest -q -k "abuse or quiz_taken or banner"text
431 passed, 7745 deselected in 11.81sThe table
Every abuse case of requirements.md § Security considerations, the mechanism from design.md § Security design, and the negative test. All pass.
| # | Abuse case | Mechanism | Test |
|---|---|---|---|
| 1 | an unauthorized reply moves a gate | the handler never calls the graph; a comment with a second keyword is not an open command | test_quiz_taken_integration.py::test_webhook_abuse_a_stranger_cannot_move_a_gate, …::test_webhook_a_reviewer_who_is_not_authorized_is_recorded_and_gates_nothing, test_quiz_taken_keyword.py::test_keyword_with_a_second_keyword_is_not_an_open_command |
| 2 | an unauthorized tick | edit-history attribution, unchanged | the quiz-gates scenario (test_pdlc_e2e_integration.py::test_the_spec_quiz_gate_obeys_only_an_authorized_tick_on_the_current_spec) |
| 3 | extra text in the reply | the signal has no body; the record and the writer take no text | …::test_webhook_the_signal_carries_no_comment_text, …::test_poller_a_strangers_reply_becomes_a_signal_without_its_text, test_quiz_taken.py::test_store_holds_logins_and_times_and_nothing_else, test_quiz_banner.py::test_the_banner_module_takes_no_comment_text |
| 4 | many accounts reply | one row per login, 20 extra rows, a write only on a difference | test_quiz_banner.py::test_rows_repliers_who_were_never_asked_are_bounded, …::test_refresh_many_strangers_cost_one_write_each_and_a_bounded_table, test_quiz_taken_integration.py::test_webhook_a_second_reply_from_the_same_person_writes_nothing |
| 5 | forged markers | exactly one marker pair or no write; the fallback comment is found by stored id and edited only while it is the-loop's own | test_quiz_banner.py::test_place_refuses_markers_it_cannot_be_sure_of (6 cases), …::test_refresh_falls_back_to_a_comment_on_malformed_markers, …::test_refresh_never_edits_a_comment_that_is_not_its_own |
| 6 | a login outside the grammar | refused before it is recorded or rendered | test_quiz_taken.py::test_store_refuses_anything_that_is_not_a_login (12 cases), test_quiz_banner.py::test_rows_drop_anything_that_is_not_a_login, test_quiz_taken_integration.py::test_webhook_abuse_a_login_outside_the_grammar_is_never_written (5 cases) |
| 7 | markup in the spec or the diff | the page renders one JSON block as text | ui/check.md: hostile strings rendered as text, no element created from a string, hostile strings never executed, in 8 page-and-theme combinations |
| 8 | a reply on an unrelated pull request | the delivering-pull-request check comes first | …::test_webhook_abuse_a_reply_on_a_pull_request_that_delivers_nothing_does_nothing |
| 9 | the-loop's own comment, or a commenter GitHub does not confirm | the self-authored check; the comment is read back by id | …::test_webhook_abuse_the_loops_own_comment_is_never_a_reply, …::test_poller_the_loops_own_comment_is_never_a_reply, …::test_webhook_abuse_a_sender_github_does_not_confirm_is_not_recorded (4 cases), …::test_webhook_abuse_a_comment_github_cannot_be_asked_about_is_not_recorded |
Checks beyond the listed cases
| What | Test |
|---|---|
| a comment id from a webhook that is not a number never reaches a URL | test_quiz_banner_ops.py::test_a_comment_id_that_is_not_a_number_never_reaches_a_url |
| the keyword may not be spelled like a control keyword | test_quiz_taken_keyword.py::test_keyword_may_not_be_spelled_like_a_control_keyword |
a link that is not a plain https URL, or a location that is not a repository path, is not printed in the banner | test_quiz_banner.py::test_render_drops_a_link_that_is_not_a_plain_https_url |
| a quiz record may not name a page in another repository, or a path with a parent-directory segment | test_quiz.py::test_quiz_published_agrees_with_the_gate_on_what_a_location_is (12 cases) |
a quiz-taken comment on a new work item cannot keep it from starting | test_quiz_taken_integration.py::test_poller_abuse_a_reply_cannot_keep_a_work_item_from_starting |
| a round, and so a reply, exists only on a pull request that carries the quiz comment | test_quiz_integration.py::test_a_round_starts_only_where_the_quiz_comment_was_posted |
the instruction that keeps </script> inert names the escape sequence | test_quiz.py::test_the_escape_rule_is_spelled_out_wherever_the_agent_is_told_to_fill_the_block |