Sha256: f88fd06098525b2f7a6976328dad3b42f140a3b23e89bd2107d10bee333c07a5

Contents?: true

Size: 616 Bytes

Versions: 21

Compression:

Stored size: 616 Bytes

Contents

module SecureHeaders
  class ContentSecurityPolicy
    class ScriptHashMiddleware
      def initialize(app)
        @app = app
      end

      def call(env)
        status, headers, response = @app.call(env)
        metadata = env[ContentSecurityPolicy::ENV_KEY]
        if !metadata.nil?
          config, options = metadata.values_at(:config, :options)
          config.merge!(:script_hashes => env[HASHES_ENV_KEY])
          csp_header = ContentSecurityPolicy.new(config, options)
          headers[csp_header.name] = csp_header.value
        end

        [status, headers, response]
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
secure_headers-2.5.3 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.5.2 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.5.1 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.5.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.4.4 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.4.3 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.4.2 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.4.1 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.4.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.3.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.2.4 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.2.3 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.2.2 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.2.1 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.2.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.1.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.0.2 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.0.1 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.0.0 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb
secure_headers-2.0.0.pre2 lib/secure_headers/headers/content_security_policy/script_hash_middleware.rb