Sha256: 48dc60939f12820ce2c0183062cce2acc4d7f2b2184a1ed6998567f81991ed2f

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

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

cs__scoped_require 'contrast/components/interface'

if defined?(Rack) && defined?(Rack::Session) && defined?(Rack::Session::Cookie)
  module Rack
    module Session
      # Our patch into the Rack::Session::Cookie Class, allowing for the
      # runtime detection of insecure configurations on individual cookies
      # within the application
      class Cookie
        include Contrast::Utils::InvalidConfigurationUtil
        include Contrast::Components::Interface

        access_component :scope

        alias_method :cs__patched_initialize, :initialize
        def initialize app, options = {}
          Contrast::Utils::RackAssessSessionCookie.analyze_cookie_initialization(options)
          cs__patched_initialize(app, options)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-3.8.5 lib/contrast/sinatra_extensions/assess/cookie.rb
contrast-agent-3.8.4 lib/contrast/sinatra_extensions/assess/cookie.rb