Commit 7e4875a
authored
* fix(drawer): hide synthetic community id on IP-type ban detail (sbpp#1486)
An IP-type ban stores an empty authid (the SteamID field is intentionally
dropped when the operator picks IP type — see testAddIpTypeAlwaysWritesEmptyAuthid).
api_bans_detail computes community_id in SQL straight off authid, so an
empty authid collapsed the arithmetic to the base 76561197960265728
(STEAM_0:0:0) and the player-detail drawer painted a bogus "Community" id.
Gate community_id on the same SteamID::isValidID() check that already
guards steam_id / steam_id_3, returning '' so the drawer hides the row.
Mirror the gate in api_comms_detail for parity and to cover malformed or
empty legacy authids (sbpp#900). No wire-format change for valid authids, so
existing snapshots and the api-contract stay valid.
* feat(bans): keep validated SteamID-of-record on IP-type bans (sbpp#1486)
When an operator fills both the Steam ID and IP fields and picks an
IP-type ban, store the SteamID alongside the IP instead of dropping it.
The schema has always had separate ip + authid columns; enforcement
stays IP-only (the SourceMod plugin matches an IP ban on the ip column
alone), so the recorded authid is a record-of-fact surfaced by the ban
detail / banlist.
The sbpp#1423 validate-before-convert shape gate is preserved on the
IP-type branch: a non-empty Steam ID is shape-checked before toSteam2()
so garbage returns a structured validation error on the steam field
instead of 500ing (the sbpp#1420/sbpp#1423 bug class) or being silently
swallowed (the pre-sbpp#1486 drop). An empty Steam ID field records nothing.
Covers api_bans_add (JSON) and admin.edit.ban.php (page handler) so the
two surfaces can't diverge. Updates the sbpp#1486 drawer guard comment
(now covers no-steam IP bans + legacy malformed authids), rewrites the
contract test (testAddIpTypeAlwaysWritesEmptyAuthid ->
testAddIpTypeKeepsValidatedSteamOfRecord), and reverses the IP-type
empty-authid contract + anti-pattern in AGENTS.md in lockstep.
* test(bans): fix IP-type steam-of-record newline case (sbpp#1486)
The handler trims `$rawSteam` before the shape gate, so a trailing
newline (`STEAM_0:0:1\n`) is stripped to a valid `STEAM_0:0:1` and
kept, not rejected. Replace the bogus trailing-newline rejection
assertion with a non-trimmable mid-string newline (the shape the
handler gate actually catches) and add a positive case documenting
the trim-then-keep behavior. Aligns AGENTS.md wording with the
trim nuance.
1 parent 5356bb0 commit 7e4875a
6 files changed
Lines changed: 252 additions & 126 deletions
File tree
- web
- api/handlers
- pages
- tests/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | | - | |
838 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
839 | 845 | | |
840 | 846 | | |
841 | 847 | | |
| |||
859 | 865 | | |
860 | 866 | | |
861 | 867 | | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
876 | 887 | | |
877 | 888 | | |
878 | 889 | | |
| |||
4336 | 4347 | | |
4337 | 4348 | | |
4338 | 4349 | | |
4339 | | - | |
4340 | | - | |
4341 | | - | |
4342 | | - | |
4343 | | - | |
4344 | | - | |
4345 | | - | |
4346 | | - | |
4347 | | - | |
4348 | | - | |
4349 | | - | |
4350 | | - | |
4351 | | - | |
4352 | | - | |
4353 | | - | |
4354 | | - | |
4355 | | - | |
4356 | | - | |
4357 | | - | |
4358 | | - | |
4359 | | - | |
4360 | | - | |
4361 | | - | |
4362 | | - | |
4363 | | - | |
4364 | | - | |
4365 | | - | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
4369 | | - | |
| 4350 | + | |
| 4351 | + | |
| 4352 | + | |
| 4353 | + | |
| 4354 | + | |
| 4355 | + | |
| 4356 | + | |
| 4357 | + | |
| 4358 | + | |
| 4359 | + | |
| 4360 | + | |
| 4361 | + | |
| 4362 | + | |
| 4363 | + | |
| 4364 | + | |
| 4365 | + | |
| 4366 | + | |
| 4367 | + | |
| 4368 | + | |
| 4369 | + | |
| 4370 | + | |
| 4371 | + | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
4370 | 4387 | | |
4371 | 4388 | | |
4372 | 4389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
74 | 92 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
891 | 901 | | |
892 | 902 | | |
893 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
894 | 909 | | |
895 | | - | |
896 | | - | |
897 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
898 | 919 | | |
899 | 920 | | |
900 | 921 | | |
| |||
942 | 963 | | |
943 | 964 | | |
944 | 965 | | |
945 | | - | |
| 966 | + | |
946 | 967 | | |
947 | 968 | | |
948 | 969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
506 | 513 | | |
507 | 514 | | |
508 | 515 | | |
| |||
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | | - | |
| 563 | + | |
557 | 564 | | |
558 | 565 | | |
559 | 566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
| |||
178 | 172 | | |
179 | 173 | | |
180 | 174 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 175 | + | |
| 176 | + | |
188 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
0 commit comments