Sha256: 9bd0091b02608b40b9ef2c120166c8be9863f7fea30080f1c8ceaa06410f498b

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Agent
    module Assess
      module Rule
        module Response
          module Framework
            # Rails 7 supports managing potential unsafe Headers
            # this module contains methods for checking if Rails 7 supersedes our rules
            module RailsSupport
              RAILS_VERSION = Gem::Version.new('7.0.0')

              # 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.
              #
              # @return [Boolean] if the rule is unsupported by the framework
              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
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/assess/rule/response/framework/rails_support.rb
contrast-agent-6.10.0 lib/contrast/agent/assess/rule/response/framework/rails_support.rb
contrast-agent-6.9.0 lib/contrast/agent/assess/rule/response/framework/rails_support.rb
contrast-agent-6.8.0 lib/contrast/agent/assess/rule/response/framework/rails_support.rb
contrast-agent-6.7.0 lib/contrast/agent/assess/rule/response/framework/rails_support.rb