Skip to content

Fix CSRF exception when updating theme

What does this MR do?

Properly trigger rails-ujs submit when changing themes.

Without this, clicking on a theme resulted in a CSRF error because the form wasn't submitted remotely and Rails doesn't insert the hidden field to the form if remote: true is set.

This wasn't caught by our specs because CSRF protection is disabled in test mode and the controller works fine with a regular submit and the result to the user looks the same so our assertions still passed.

This MR also enables CSRF protection for feature tests so that we catch these problems in the future.

Related to #254826 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Heinrich Lee Yu

Merge request reports