Why it matters
A page on another site can submit forms here with the user's session cookie.
How to fix it
Keep protect_from_forgery with: :exception. An API authenticated by a token header rather than a cookie should inherit from ActionController::API instead of skipping the check.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
class PaymentsController < ApplicationController
skip_before_action :verify_authenticity_token
endclass PaymentsController < ApplicationController
protect_from_forgery with: :exception
endWhat TrustIvan reads
Runs on repository scans of Ruby source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Mass assignment permit all (Ruby)
RubySeverity: High
trustivan-ruby-mass-assignment-permit-all - Weak hash (Ruby)
RubySeverity: Medium
trustivan-ruby-weak-hash - SQL string interpolation (Ruby)
RubySeverity: Medium
trustivan-ruby-sql-string-interpolation - Weak cipher (Ruby)
RubySeverity: High
trustivan-ruby-weak-cipher - XPath injection from request input (Ruby)
RubySeverity: High
trustivan-ruby-taint-xpath-injection - Insecure random secret (Ruby)
RubySeverity: Medium
trustivan-ruby-insecure-random-secret
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation