Skip to content

Investigate: RAILS_FILTER_CLASS is undefined or nil for some users #1574

Open
@hannahramadan

Description

To prevent the transmission and storage of potentially sensitive or otherwise unwanted content, the New Relic Ruby agent supports filtering web application request parameters that are processed by Rails and/or Rack.

When this filtering logic is applied to a web application running Rails v5+, the agent wraps the defining of a RAILS_FILTER_CLASS constant in a Rails.application.config.to_prepare block.

A bug was found that allows a Rails application to satisfy the "are you on version 5 or above of Rails?" check, but then fails to ever invoke the to_prepare block.

With this block left without invocation, the constant defined by the block would not be set and then attempts to access that constant would error out:

** [NewRelic][2022-10-27 18:02:45 +0000 15b5b0c06a5c (1516)] ERROR : NameError: uninitialized constant NewRelic::Agent::ParameterFiltering::RAILS_FILTER_CLASS

The buggy attempts to access an undefined constant were fixed by #1566. But we still need to get to the root of why a Rails 5+ app can be known to not invoke the to_prepare block and not set the constant in the first place. We should reproduce and investigate this error and add a fix. Tests should also be added.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions