Skip to content
vetkitChecksChangelogDocumentation

vetkit.ruby.csrf.null-session

protect_from_forgery uses with: :null_session, so requests with a bad token run with an empty session instead of failing. Cookie-based authentication outside the session stays usable.

Last updated:

Suite: Security

ruby

protect_from_forgery uses with: :null_session, so requests with a bad token run with an empty session instead of failing. Cookie-based authentication outside the session stays usable.

Category: SECURITY · Engine rule severity: INFO

How to fix it

Use protect_from_forgery with: :exception for browser controllers; use ActionController::API for token APIs.

Rule pattern example

The engine’s matching pattern, not a confirmed exploit. Metavariables and ellipses describe matching syntax.

protect_from_forgery(..., with: :null_session, ...)

References

Source: packages/engine/rules/sast/ruby.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.