Sha256: 4a0a1c8d141492f03c1da3d97334458dc61505a3565bb6a1b1f1aaf34716d31c

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

require 'pathname'

module Aws
  module Log
    class ParamFilter

      # A managed list of sensitive parameters that should be filtered from
      # logs. This is updated automatically as part of each release. See the
      # `tasks/sensitive.rake` for more information.
      #
      # ** DO NOT EDIT THE FOLLOWING LINE OF CODE **
      #
      SENSITIVE = [:admin_contact, :artifact_credentials, :auth_code, :base_32_string_seed, :copy_source_sse_customer_key, :new_password, :old_password, :password, :plaintext, :private_key, :qr_code_png, :registrant_contact, :secret_access_key, :shared_secret, :sse_customer_key, :ssekms_key_id, :tech_contact]

      def initialize(options = {})
        @filters = Set.new(SENSITIVE + Array(options[:filter]))
      end

      def filter(value)
        case value
        when Struct, Hash then filter_hash(value)
        when Array then filter_array(value)
        else value
        end
      end

      private

      def filter_hash(values)
        filtered = {}
        values.each_pair do |key, value|
          filtered[key] = @filters.include?(key) ? '[FILTERED]' : filter(value)
        end
        filtered
      end

      def filter_array(values)
        values.map { |value| filter(value) }
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
aws-sdk-core-2.1.27 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.26 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.25 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.24 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.23 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.22 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.21 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.20 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.19 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.18 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.17 lib/aws-sdk-core/log/param_filter.rb
aws-sdk-core-2.1.16 lib/aws-sdk-core/log/param_filter.rb