Module: SecureKeys::Validation::Globals

Defined in:
lib/validation/globals/globals.rb

Class Method Summary collapse

Class Method Details

.api_key_lengthInteger

Returns the minimum length for an API key

Returns:

  • (Integer)

    The minimum length for an API key



12
13
14
# File 'lib/validation/globals/globals.rb', line 12

def api_key_length
  Services::Environment.integer(key: :api_key_length, default: 20)
end

.default_scan_excludesArray<String>

Returns the default directory and file names to exclude from scanning

Returns:

  • (Array<String>)

    The default exclude patterns



51
52
53
54
55
56
# File 'lib/validation/globals/globals.rb', line 51

def default_scan_excludes
  Services::Environment.fetch(
    key: :scan_excludes,
    default: '.git,node_modules,Pods,build,DerivedData,.build,vendor,.bundle,Carthage,.secure-keys,coverage'
  ).split(',')
end

.default_scan_extensionsArray<String>

Returns the default file extensions to scan

Returns:

  • (Array<String>)

    The default file extensions



42
43
44
45
46
47
# File 'lib/validation/globals/globals.rb', line 42

def default_scan_extensions
  Services::Environment.fetch(
    key: :scan_extensions,
    default: '.swift,.m,.mm,.h,.rb,.py,.js,.ts,.java,.kt,.yaml,.yml,.json,.env,.plist'
  ).split(',')
end

.key_lengthInteger

Returns the minimum length for a generic key

Returns:

  • (Integer)

    The minimum length for a key



36
37
38
# File 'lib/validation/globals/globals.rb', line 36

def key_length
  Services::Environment.integer(key: :key_length, default: 16)
end

.max_scan_depthInteger

Returns the maximum directory traversal depth for scanning

Returns:

  • (Integer)

    The maximum scan depth



60
61
62
# File 'lib/validation/globals/globals.rb', line 60

def max_scan_depth
  Services::Environment.integer(key: :max_scan_depth, default: 10)
end

.min_entropy_thresholdFloat

Returns the minimum Shannon entropy threshold for secret validation

Returns:

  • (Float)

    The minimum entropy threshold



66
67
68
# File 'lib/validation/globals/globals.rb', line 66

def min_entropy_threshold
  Services::Environment.decimal(key: :min_entropy_threshold, default: 3.0)
end

.password_lengthInteger

Returns the minimum length for a password

Returns:

  • (Integer)

    The minimum length for a password



30
31
32
# File 'lib/validation/globals/globals.rb', line 30

def password_length
  Services::Environment.integer(key: :password_length, default: 12)
end

.secret_lengthInteger

Returns the minimum length for a secret

Returns:

  • (Integer)

    The minimum length for a secret



24
25
26
# File 'lib/validation/globals/globals.rb', line 24

def secret_length
  Services::Environment.integer(key: :secret_length, default: 16)
end

.token_lengthInteger

Returns the minimum length for a token

Returns:

  • (Integer)

    The minimum length for a token



18
19
20
# File 'lib/validation/globals/globals.rb', line 18

def token_length
  Services::Environment.integer(key: :token_length, default: 20)
end