Commit 709d03f
authored
feat(trust): Phase 1 (discord) — L3 identity via shared gate [DRAFT: canary before merge] (#1270)
* feat(trust): Phase 1 (discord) — gate L3 identity via shared gate
Routes Discord ingress through AdapterRouter::gate_incoming for the L3
(identity) layer, keyed under "discord" in the trust registry.
- registry "discord" entry: L2 open + allow_dm=true (Discord's richer
channel/thread/DM logic stays in the adapter — the flat allowed_channels
model can't express thread-by-parent admission); L3 mirrors resolved
[discord].allow_all_users/allowed_users
- gate call added at the Discord dispatch spawn, redundant-but-matching
with Discord's existing pre-dispatch user check → non-regressive by
construction (cannot deny what already passed)
Behavior-preserving. Phase 1c makes the gate authoritative and removes the
scattered user check; richer Discord L2 modeling + dispatch privatization
tracked in #1269.
Refs #1264 #1269
* fix(trust): Discord gate skips bots + passes real is_dm (review #1270 F1/F2)
F1 (blocker): Discord's is_denied_user has a !is_bot bypass (bot admission
is handled by allow_bot_messages + trusted_bot_ids). The shared L3 gate is
human-identity only, so running it on bots wrongly dropped trusted
bot-to-bot messages when allow_all_users=false (multi-agent). Guard the
gate with !sender.is_bot.
F2: pass the in-scope is_dm instead of hardcoded false (benign today with
the L2-open discord entry, but avoids latent risk).
Note: #1267 (gateway) is unaffected — should_skip_event's user check never
had a bot bypass, so the gateway gate already matched it for bots.
* test(trust): name + test the Discord L3 bot-bypass (review #1270 F4)
Extract the gate's bot-skip into l3_gate_applies(is_bot) and add a
regression test (l3_gate_skips_bots_admits_humans) locking in that bots
bypass the shared L3 gate (mirrors is_denied_user's !is_bot), so
trusted/mode-admitted bots aren't denied when allow_all_users=false.
---------
Co-authored-by: chaodu-agent <chaodu-agent@users.noreply.github.com>1 parent 22a3cb2 commit 709d03f
2 files changed
Lines changed: 69 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1018 | 1018 | | |
1019 | 1019 | | |
1020 | 1020 | | |
| 1021 | + | |
1021 | 1022 | | |
1022 | 1023 | | |
1023 | 1024 | | |
| |||
1032 | 1033 | | |
1033 | 1034 | | |
1034 | 1035 | | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1035 | 1065 | | |
1036 | 1066 | | |
1037 | 1067 | | |
| |||
2898 | 2928 | | |
2899 | 2929 | | |
2900 | 2930 | | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
2901 | 2941 | | |
2902 | 2942 | | |
2903 | 2943 | | |
| |||
3904 | 3944 | | |
3905 | 3945 | | |
3906 | 3946 | | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
3907 | 3956 | | |
3908 | 3957 | | |
3909 | 3958 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
296 | 316 | | |
297 | 317 | | |
298 | 318 | | |
| |||
0 commit comments