Padrino 0.18.3 release
Padrino 0.18.3 is a security release. Request paths are now compared the way the router matches them in before/after filters, protect_from_csrf except: entries and padrino-admin access rules, and form tokens written on CSRF-exempt pages are accepted again. Everyone on 0.18.x should upgrade. Thanks to @achiurizo for finding and fixing these with us. The advisories, GHSA-gxmf-3hr3-52rc (padrino-core) and GHSA-2v9v-xpxc-g5p4 (padrino-admin), have the details.
Changes
- Request paths in one place. Static files, filters,
protect_from_csrfexcept:entries and padrino-adminprotect/allowrules now share one tested helper and compare the request path in the forms the router matches; compiled routes match the whole path (#2492,@achiurizo). - Form tokens. With
disable :protection(or without:remote_token), the tokenform_tag,csrf_token_fieldandcsrf_meta_tagswrite on aprotect_from_csrf except:page is accepted by later POSTs instead of returning 403 (#2507).
Upgrading from 0.18.2
- In your Gemfile, change
gem 'padrino', '0.18.2'togem 'padrino', '~> 0.18.3', then runbundle update padrino(or, if it lists thepadrino-*gems, set each to~> 0.18.3and update them by name). - Check these, as listed in the changelog:
- Filter paths: write a filter's path decoded (
before('/café')). A filter that redirects to the same path with a format or a trailing slash can loop, so checkrequest.path_infofirst. A path filter also runs for forms of its path that other routes serve, so a filter that only sets state for a later check should name its route instead (before(:list)withget(:list)). except:entries: writeprotect_from_csrfand filterexcept:paths as exact decoded Strings. A Regexp entry such as/\.json\z/or%r{\A/hooks/}may no longer exempt a POST it used to; list that path as a String, or setcsrf_protection: falseon its route together withenable :allow_disabled_csrfin the app.- padrino-admin:
protectRegexps can deny more paths than before;allowa path to keep it allowed. - A request path that decodes to a newline gets 404.
- Filter paths: write a filter's path decoded (
Nothing else changes: Ruby 2.7.8 or later, Sinatra 4 and Rack 3 are still required.