Commit Graph

17 Commits

Author SHA1 Message Date
evazion
652db0cd9f post queries: show full error message on error page. 2022-04-17 23:20:22 -05:00
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
3a3d456bd2 html: standardize font sizes and heading tags.
Standardize font sizes and heading tags (<h1>-<h6>) to be more
consistent across the site.

Changes:

* Introduce font size CSS variables and start replacing hardcoded font
  sizes with standard sizes.
* Change header tags to use only one <h1> per page. One <h1> per page is
  recommended for SEO purposes. Usually this is for the page title, like
  in forum threads or wiki pages.
* Standardize on <h2> for section headers in sidebars and <h3> for
  smaller subsection headers. Don't use <h4>-<h6>.
* In DText, make h1-h4 headers all the same size. Standard wiki style is
  to ignore h1-h3 and start at h4.
* In DText, make h4-h6 the same size as the h1-h3 tags outside of DText.
* In the tag list, change the <h1> and <h2> tag category headers to <h3>.
* Make usernames in comments and forum posts smaller. Also change the
  <h4> tag for the commenter name to <div class="author-name">.
* Make the tag list, paginator, and nav menu smaller on mobile.
* Change h1#app-name-header to a#app-name-header.
2020-07-23 17:34:17 -05:00
evazion
6a984de3d5 views: refactor page titles.
Refactor `page_title` helper to automatically include site name.
2020-01-25 01:52:18 -06:00
evazion
f151285038 views: standardize page titles. 2019-08-24 22:55:35 -05: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
0d69c03249 Fix "undefined method `is_builder?' for nil:NilClass" in static/error.html.erb.
`CurrentUser.user` may be nil if an exception is raised before it's
initialized.
2017-12-23 18:27:04 -06:00
evazion
5f1b7da95d Fix "RuntimeError: can't modify frozen String" in static/error.html.erb.
Fixes a frequently occurring error in New Relic.
2017-12-23 18:23:41 -06:00
evazion
183a7e07e3 pixiv: fix failbooru when uploading bad pixiv id posts.
Fixes an "incompatible character encodings: UTF-8 and ASCII-8BIT"
exception when uploading a deleted Pixiv post.

Caused by the Pixiv API error message not having the encoding set to UTF-8.
2017-11-21 14:11:59 -06:00
r888888888
f62b49bbeb fixes #2484: Only show application trace for errors 2016-09-23 12:11:48 -07:00
Toks
c776ee567e Display more detailed error, only if it exists 2014-12-09 21:10:42 -05:00
Toks
90bca638bf fixes #2316 (and similar post error messages) 2014-11-30 14:48:51 -05:00
Toks
91270f4567 Fix 404/timeout errors not showing 2014-11-25 21:04:03 -05:00
r888888888
e362d73bb3 fixes #2312 2014-11-25 14:58:00 -08:00
r888888888
d5f575159f rename references of privileged to gold 2013-04-28 00:04:52 -07:00
albert
ae6e8fce30 unified error handling system 2013-02-22 14:45:39 -05:00