Closed madmatt closed 4 years ago
Definitely belongs here @madmatt, thanks for raising this 👍
Dug into this today, and though I don't have a PR ready for review, here are some notes:
RateLimitMiddleware
has zero awareness of what content types are specified in the Accept
header of the request, and so responds with HTML every time. There are a lot of areas of the CMS where we get bizarro, unhelpful errors because we blindly try to parse responses as JSON.Content-Type
header in the response to work out whether it's valid JSON, and if not, wraps the body in an object in order to allow outputting the error message inline. I looked into making this apply across the whole module via the api
helper method, but applying rudimentary middleware to fetch()
is actually pretty tough going. There'll be other places in the codebase I need to patch this functionality in, but the WIP has been tested to make 429s successfully return to the code entry UI with a 'Rate limited' error.
If you trigger an HTTP 500 during the MFA verification (e.g. the HTTP POST to
/Security/login/default/mfa/verify/totp?SecurityID=<redacted>
) and the response is an HTTP 500 (generally because you're inlive
mode and there's an exception thrown), the site never refreshes and you just get stuck looking at the spinner forever.Acceptance Criteria
Resolving the root causes of these error responses is out of scope for this issue.
PRs
Note: not fixing this for SS3 as this is a non-critical issue