discourse/lib/middleware
David Taylor 64be371749
DEV: Improve handling of invalid requests (#15841)
Our discourse_public_exceptions middleware is designed to catch bubbled exceptions from lower in the stack, and then use `ApplicationController.rescue_with_handler` to render an appropriate error response.

When the request itself is invalid, we had an escape-hatch to skip re-dispatching the request to ApplicationController. However, it was possible to work around this by 'layering' the errors. For example, if you made a request which resulted in a 404, but **also** had some other invalidity, the escape hatch would not be triggered.

This commit ensures that these kind of 'layered' errors are properly handled, without logging warnings. It also adds detection for invalid JSON bodies and badly-formed multipart requests.

The user-facing behavior is unchanged. This commit simply prevents warnings being logged for invalid requests.
2022-02-07 13:16:57 +00:00
..
anonymous_cache.rb FEATURE: Apply rate limits per user instead of IP for trusted users (#14706) 2021-11-17 23:27:30 +03:00
discourse_public_exceptions.rb DEV: Improve handling of invalid requests (#15841) 2022-02-07 13:16:57 +00:00
enforce_hostname.rb DEV: Correct typos and spelling mistakes (#12812) 2021-05-21 11:43:47 +10:00
missing_avatars.rb
omniauth_bypass_middleware.rb FIX: Redirect to provided origin after auth (#12558) 2021-03-31 10:23:12 +01:00
request_tracker.rb FEATURE: Apply rate limits per user instead of IP for trusted users (#14706) 2021-11-17 23:27:30 +03:00
turbo_dev.rb