Commit e6100e1
committed
test: assert the passwordless rejection is indistinguishable, not just unworded
testInvalidOtpAgainstEnforcedUserDoesNotLeakMFAStatus only asserted that the
flash message lacked the phrase "two-factor authentication". Enumeration is
about distinguishability, so that assertion still passed if a future
enforced-only branch leaked a differently worded message.
It now drives the same invalid code through the same endpoint for the
MFA-enforced admin and for a non-enforced control user, and asserts the two
rejections are byte-identical. The stale flash is cleared between requests so
the comparison cannot read a value against itself. Verified by mutation:
restoring the pre-fix guard order with reworded text fails the new assertSame
and would have passed the old substring assertion.
Also records why testEnforcedUserCannotBypassMFAViaPasswordlessLogin adds no
separate "no login side effect" assertions. Both candidates were tried and
removed as change detectors that cannot fail: the DB-visible effects (OTP
redemption, sibling revocation) are rolled back by the AuthService transaction
regardless of where the guard sits, and the session-visible one (Auth::login()
and the Login event queuing PostLoginUser) is already caught first by the
existing Auth::check() assertion. Both confirmed by mutation.
Full file green: OK (58 tests, 380 assertions).1 parent 67043e3 commit e6100e1
1 file changed
Lines changed: 40 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
196 | 205 | | |
197 | 206 | | |
198 | 207 | | |
| |||
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
225 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
226 | 242 | | |
227 | | - | |
| 243 | + | |
| 244 | + | |
228 | 245 | | |
229 | 246 | | |
230 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
231 | 268 | | |
232 | 269 | | |
233 | | - | |
| 270 | + | |
234 | 271 | | |
235 | 272 | | |
236 | 273 | | |
| |||
0 commit comments