Commit Graph

8 Commits

Author SHA1 Message Date
evazion
7bed81812d Don't show error messages that could contain private information.
Fix a potential exploit where private information could be leaked if
it was contained in the error message of an unexpected exception.

For example, NoMethodError contains a raw dump of the object in the
error message, which could leak private user data if you could force a
User object to raise a NoMethodError.

Fix the error page to only show known-safe error messages from expected
exceptions, not unknown error messages from unexpected exceptions.

API changes:

* JSON errors now have a `message` param. The message will be blank for unknown exceptions.
* XML errors have a new format. This is a breaking change. They now look like this:

    <result>
      <success type="boolean">false</success>
      <error>PaginationExtension::PaginationError</error>
      <message>You cannot go beyond page 5000.</message>
      <backtrace type="array">
        <backtrace>app/logical/pagination_extension.rb:54:in `paginate'</backtrace>
        <backtrace>app/models/application_record.rb:17:in `paginate'</backtrace>
        <backtrace>app/logical/post_query_builder.rb:529:in `paginated_posts'</backtrace>
        <backtrace>app/logical/post_sets/post.rb:95:in `posts'</backtrace>
        <backtrace>app/controllers/posts_controller.rb:22:in `index'</backtrace>
      </backtrace>
    </result>

  instead of like this:

    <result success="false">You cannot go beyond page 5000.</result>
2022-02-06 18:09:54 -06:00
evazion
e70cae457d application controller: clean up exception handling.
* Simplify code.
* Show backtraces for all users, not just builders.
* Show backtraces only for unexpected server errors (status 5xx), not
  for normal client errors (status 4xx).
* Log expected errors at info level (reduce noise in production logs).
2019-08-13 21:30:20 -05:00
evazion
b4cf423058 Clean backtraces in uploads/show, static/error.json. 2018-09-23 20:08:13 -05:00
evazion
935cefd27e API: on error, include backtrace in json response.
Incidentally fixes issue with error responses inside /sources.json not
including the usual `{"success": false}`.
2017-03-16 18:11:43 -05:00
r888888888
fc7afd44ea refactor source pixiv test
refactor pixiv download tests
refactor upload test
refactor nico seiga test
refactor twitter tests
2016-09-28 11:25:29 -07:00
小太
24ef08dfc7 Fix typo in fix 2013-03-26 13:54:44 +11:00
albert
228cae2cb2 fixes #1072 2013-03-25 22:47:27 -04:00
albert
ae6e8fce30 unified error handling system 2013-02-22 14:45:39 -05:00