Skip to content

Insecure use of skip_filter or skip_before_filter

Description

The application is disabling controller checks by setting `skip_filter` or `skip_before_filter` with an `:except` option, which can inadvertently open up parts of the application to unauthorized access. A safer method involves specifying exactly which controller actions should have checks applied using an `:only` option.

Examples

Insecure Code

ruby
skip_before_filter :authenticate_user!, :except => [:new, :create]

Secure Code

ruby
skip_before_action :authenticate_user!, only: [:new, :create]

Remediation

Replace `:except` with `:only` and specify the actions that should have checks applied.

Rule Details

FieldValue
IDCODE-0534
CategoryAccessControl
SeverityMEDIUM
CWECWE-749
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsrails, authorization
OWASPA5:2017-Broken Access Control, A01:2021-Broken Access Control

References