Performance: CSRF protection
LOW IMPACT
CSRF protection affects the security layer of web requests but has minimal direct impact on page load speed or rendering performance.
class ApplicationController < ActionController::Base protect_from_forgery with: :exception end <!-- Rails form helpers automatically include CSRF tokens --> <%= form_with url: "/submit" do |form| %> <%= form.text_field :data %> <%= form.submit "Send" %> <% end %>
class ApplicationController < ActionController::Base protect_from_forgery with: :null_session end <!-- Forms do not include CSRF tokens explicitly --> <form action="/submit" method="post"> <input type="text" name="data"> <button type="submit">Send</button> </form>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No CSRF token (insecure) | Minimal DOM nodes | 0 | 0 | [X] Bad |
| Rails form_with with CSRF token | One hidden input added | 0 | Negligible | [OK] Good |