Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This follows on from #233 - it turns out the
message
val is now unused, so we can remove it, and simplify the code a little!PR #233 removed the exception message text from the error displayed to the end user, because the error message text is unconstrained and this corresponds to https://owasp.org/www-community/Improper_Error_Handling .
I was tempted to re-include the
desc
string in the error message displayed to the user, as it is just the string "anti-forgery-token-invalid" or the exception class name, which is more constrained, but re-reading the OWASP doc, this is also discouraged as it's very similar to an error code. ("internal error messages such as stack traces, database dumps, and error codes"). When getting error reports in the past, I've found it helpful if they have received an error with a bit more context in it, as surprisingly the error reports often don't include the user that saw the error, or when the error occurred, making it harder to search logs for them! Still, I do appreciate the guidance from OWASP is right.