-
-
Notifications
You must be signed in to change notification settings - Fork 47
Description
This isn't a bug but it's something security-relevant that rodauth-rails could address.
Rails will route /foo.html and /foo.json to the same controller as /foo. However, Roda doesn't consider /foo.html or /foo.json to be part of the /foo routing tree. If rodauth_app.rb sets up authentication with r.on instead of r.path.start_with? then it's possible to bypass require_account.
# If you visit `/foo` then account handling works,
# but visiting `/foo.html` goes through to the page
# without checking for an account.
r.on "foo" do
rodauth.require_account
endThose who ignore rodauth-rails's authentication example (with r.path.start_with?) because r.on looks cleaner may end up exposing private sections of their application without knowing.
Maybe this routing difference could be bridged in the rodauth-rails integration? If not, the rodauth_app.rb template already recommends start_with?, but it may be good to add a more explicit warning about this unintuitive behavior.