Module: Contrast::Agent::Assess::Rule::Response::Framework::RailsSupport

Included in:
XXssProtection
Defined in:
lib/contrast/agent/assess/rule/response/framework/rails_support.rb

Overview

Rails 7 supports managing potential unsafe Headers this module contains methods for checking if Rails 7 supersedes our rules

Constant Summary collapse

RAILS_VERSION =
Gem::Version.new('7.0.0')

Instance Method Summary collapse

Instance Method Details

#rails_seven?Boolean

Some rules have features or settings that make them unsupported, meaning unnecessary or unavailable in that framework. For now, the only distinction required is Rails 7 or not, so that’s what we’ll report here.

Returns:

  • (Boolean)

    if the rule is unsupported by the framework



20
21
22
23
24
25
26
27
# File 'lib/contrast/agent/assess/rule/response/framework/rails_support.rb', line 20

def rails_seven?
  return false unless defined?(::Rails)

  rails_version = ::Rails.version
  return false unless !!rails_version

  Gem::Version.new(rails_version) >= RAILS_VERSION
end