fix(matrix): fail closed for approval reactions - #33328
Conversation
|
Duplicate of open PR #30062 (same fix: fail-closed Matrix approval reactions when MATRIX_ALLOWED_USERS is empty). Both add gateway auth fallback to run.py verification. |
|
Superseded by #34567 (merged to main as 784d8dd). Thanks for catching the Matrix approval reaction fail-open — it's a real bug and you're right that it needed fail-closed treatment. We went with the minimal shape from #30062: a direct Both approaches preserve the key no-regression case (operators who set |
Summary
Enforces rigid fail-closed authorization criteria on Matrix communication event loops by passing authoritative gateway reference chains to validate emoji reaction approvals against the global default-deny security model.
Why
A security containment defect existed within the Matrix adapter's reaction handler loops. Previously, reaction senders were validated strictly against
MATRIX_ALLOWED_USERS. Whenever this platform variable remained unconfigured, the event loop bypassed verification gates entirely—even if global gateway access was actively guarded byGATEWAY_ALLOWED_USERS. This permitted untrusted room members to resolve high-risk command prompts or dismiss pending agent gates simply by applying reaction emoticons to the bot's validation interface. This patch bounds reaction lifecycles to core runner verification layers.Scope of Changes
Verified Test Cases
Targeted validation blocks and dynamic context checks within the Matrix pipeline completed successfully with absolute zero failures:
test_matrix_empty_platform_allowlist_with_global_mismatch_fails_closedtest_matrix_global_allowlist_match_successfully_authorizes_reactiontest_matrix_unconfigured_allowlist_matrix_defaults_to_strict_denytest_matrix_exec_approval.py