Repository navigation
Commit 7a9c4f5
Return 400 instead of reporting malformed requests as server errors (#8160)
## Rationale
Malformed requests, mostly from vulnerability scanners, are logged as
500s and reported to mothership as server errors. This PR returns a 4xx
for them instead, and stops reporting them.
Tomcat 11 throws on every parameter read once a query string or form
body fails to parse. Rendering the standard error page reads parameters
too, so even a 404 for such a request became a 500.
Triage notes for these mothership reports:
https://claude.ai/artifact/CtxKZANKRqfhZxs7PHEqBr
## Related Pull Requests
- LabKey/testAutomation#3247
## Changes
- Requests whose parameters can't be parsed get a plain 4xx response
using Tomcat's status code, without rendering an error page. They are
never reported to mothership.
- Multipart bodies that can't be parsed get a 400 on standard actions,
instead of being rethrown as a server error.
- WebDAV reports to mothership only for 5xx responses, and returns 400
for unparseable query strings.
- Added a unit test for the invalid-parameter handling.
Tested against a local server with probe-style requests: invalid UTF-8
and empty-name parameters, a forwarded image request, and broken
multipart POSTs to actions and WebDAV. All returned 400 with no errors
logged, and normal pages were unaffected.
## Tasks
- [x] Claude Code Review
- [x] Manual Testing - probably not needed
- [x] Test Automation
- [x] Code Review @labkey-adam
---------
Co-authored-by: Adam Rauch <adam@labkey.com>1 parent 6c45a37 commit 7a9c4f5
5 files changed
Lines changed: 2042 additions & 1789 deletions
File tree
- api/src/org/labkey/api
- action
- module
- util
- view
- core/src/org/labkey/core/webdav
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
370 | 378 | | |
371 | 379 | | |
372 | 380 | | |
| |||
379 | 387 | | |
380 | 388 | | |
381 | 389 | | |
382 | | - | |
| 390 | + | |
383 | 391 | | |
384 | 392 | | |
385 | 393 | | |
386 | 394 | | |
387 | 395 | | |
388 | | - | |
| 396 | + | |
389 | 397 | | |
390 | 398 | | |
391 | 399 | | |
| |||
397 | 405 | | |
398 | 406 | | |
399 | 407 | | |
400 | | - | |
| 408 | + | |
401 | 409 | | |
402 | 410 | | |
403 | 411 | | |
| |||
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
410 | | - | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
419 | | - | |
| 427 | + | |
420 | 428 | | |
421 | 429 | | |
422 | 430 | | |
| |||
538 | 546 | | |
539 | 547 | | |
540 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
541 | 566 | | |
542 | 567 | | |
543 | 568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1065 | 1075 | | |
1066 | 1076 | | |
1067 | 1077 | | |
| |||
0 commit comments