Class: Contrast::Agent::Reporting::Settings::SensitiveDataMasking

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/settings/sensitive_data_masking.rb

Overview

Protect level settings for the sensitive_data_masking_policy. Configuration of the masking parameters will be delivered dynamically from TeamServer during an ApplicationSettings response from requests to TS endpoints that return that structure. contrast.atlassian.net/wiki/spaces/~699189087/pages/807960614/Sensitive+Data+Masking+Design

Instance Method Summary collapse

Instance Method Details

#build_rules_form_settings(settings_rules) ⇒ Object

Build rules from hash

Parameters:

  • settings_rules (Array<Hash>)

    Response settings under Settings/sensitive_data_masking_policy/rules



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 68

def build_rules_form_settings settings_rules
  return if settings_rules.nil? || settings_rules.empty?

  settings_rules.each do |rule|
    instance = Contrast::Agent::Reporting::Settings::SensitiveDataMaskingRule.new
    instance.rule_id = rule[:id]
    instance.keywords = rule[:keywords]
    rules << instance
  end
  rules
end

#mask_attack_vector=(bool) ⇒ Object

Set the flag for using masking on attack vector

Parameters:

  • bool (Boolean)

Returns:

  • true | false



45
46
47
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 45

def mask_attack_vector= bool
  @_mask_attack_vector = !!bool
end

#mask_attack_vector?Boolean

Policy flag to enable the use of masking on attack vector. Here is set to defaults to false.

Returns:

  • (Boolean)

    true | false



37
38
39
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 37

def mask_attack_vector?
  @_mask_attack_vector
end

#mask_http_body=(bool) ⇒ Object

Set the flag for request body masking

Parameters:

  • bool (Boolean)

Returns:

  • true | false



29
30
31
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 29

def mask_http_body= bool
  @_mask_http_body = bool.nil? ? true : !!bool
end

#mask_http_body?Boolean

Policy flag to enable the use of masking on request body Here is set to defaults to true.

Returns:

  • (Boolean)

    true | false



21
22
23
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 21

def mask_http_body?
  @_mask_http_body
end

#rulesObject

Rules to follow when using the masking



52
53
54
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 52

def rules
  @_rules ||= Contrast::Agent::Reporting::Settings::RulesArray.new
end

#rules=(rules) ⇒ Object

Assign rules array



60
61
62
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 60

def rules= rules
  @_rules = rules if rules_array?(rules)
end

#to_controlled_hashObject



80
81
82
83
84
85
86
# File 'lib/contrast/agent/reporting/settings/sensitive_data_masking.rb', line 80

def to_controlled_hash
  {
      rules: rules.map(&:to_controlled_hash),
      mask_attack_vector: mask_attack_vector?,
      mask_http_body: mask_http_body?
  }
end