We've moved discussions to Discord

12 year old Firefox bug widely affecting Rails apps - add "autocomplete" => "off" to all form hidden_field

This bug in Firefox will have you pulling your hair out.... hidden form fields somewhat randomly corrupted with a long string that looks liek some kind of hash. Goodbye data integrity.

TL;DR Firefox randomly but frequently corrupts a first hidden_field in forms. The fix seems to be to have "autocomplete" => "off" for ALL hidden_fields

Raised 12 years ago, closed without any action, reopened about a year ago
https://bugzilla.mozilla.org/show_bug.cgi?id=520561

Raised May '20 on Ruby forum:
https://discuss.rubyonrails.org/t/form-with-first-field-value-is-overriden-with-a-token-like-string/74861/9
In my routes.rb I added a "post" route for switch to mitigate the Forefox bug until it is fixed (but it's been 12 years so Mozilla ain't in a rush).

  resources :accounts do
    member do
      patch :switch
      post :switch ##### ADDED #####
      delete :remove_avatar
    end

Here is an example of Firefox "breaking" JSP's "switch accounts" feature by corrupting the value of the Rails-added hidden field "_method=patch" so Rails throws exception "ActionController::RoutingError (No route matches [POST] "/accounts/xxxxx/switch")" since there is no default "post" route

Same form, same user, two browsers, Firefox (corrupted) on left, Chrome on the right.


sidebyside.jpg 102 KB
Notifications
You’re not receiving notifications from this thread.