contrast-agent 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +3 -3
- data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -2
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/config/service_configuration.rb +66 -11
- data/service_executables/VERSION +1 -1
- data/service_executables/linux/contrast-service +0 -0
- data/service_executables/mac/contrast-service +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfca6df4def9f2366f7a92651aa9cd2fc40f3ced6784228844d8025cee5a4850
|
4
|
+
data.tar.gz: b66b10e1d892adee985f070963e08945fd9dd4faf641f4f06a8372683129facd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a6989482a82249d3fb906b2f79788e03d5c5ffa03973beabe591292fa780cd2bd3a6f459e8b7eedf58181a729720da0e95b1afa069e8869511b6ff4338625d'
|
7
|
+
data.tar.gz: b460cad0b10b3355bfafa3be8c49ba41d0174e5a5d0524bbab273cf51c3d9fed6348027b9658dd3dadddcace9012f0ce119566f46899ee71f8712aebf56a98bf
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require 'rails'
|
5
|
-
|
6
4
|
module Contrast
|
7
5
|
module Agent
|
8
6
|
module Assess
|
@@ -10,11 +8,13 @@ module Contrast
|
|
10
8
|
module Response
|
11
9
|
module Framework
|
12
10
|
# Rails 7 supports managing potential unsafe Headers
|
13
|
-
# this module contains methods for checking if Rails 7
|
11
|
+
# this module contains methods for checking if Rails 7 supersedes our rules
|
14
12
|
module RailsSupport
|
15
13
|
RAILS_VERSION = Gem::Version.new('7.0.0')
|
16
14
|
|
17
15
|
def framework_supported?
|
16
|
+
return false unless defined?(::Rails)
|
17
|
+
|
18
18
|
rails_version = ::Rails.version
|
19
19
|
return false unless !!rails_version
|
20
20
|
|
@@ -1,10 +1,9 @@
|
|
1
1
|
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require 'contrast/agent/assess/rule/response/framework/rails_support'
|
4
5
|
require 'contrast/agent/assess/rule/response/header_rule'
|
5
6
|
require 'contrast/utils/string_utils'
|
6
|
-
require 'contrast/agent/assess/rule/response/framework/rails_support'
|
7
|
-
require 'rails'
|
8
7
|
|
9
8
|
module Contrast
|
10
9
|
module Agent
|
@@ -13,17 +13,72 @@ module Contrast
|
|
13
13
|
DEFAULT_HOST = '127.0.0.1'
|
14
14
|
DEFAULT_PORT = '30555'
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
attr_writer :enable, :logger, :bypass
|
17
|
+
# @return [String, nil]
|
18
|
+
attr_accessor :socket
|
19
|
+
# @return [String, nil]
|
20
|
+
attr_accessor :port
|
21
|
+
# @return [String, nil]
|
22
|
+
attr_accessor :host
|
23
|
+
|
24
|
+
def initialize hsh = {}
|
25
|
+
@enable = traverse_config(hsh, :enable)
|
26
|
+
@host = traverse_config(hsh, :host)
|
27
|
+
@port = traverse_config(hsh, :port)
|
28
|
+
@socket = traverse_config(hsh, :socket)
|
29
|
+
@logger = Contrast::Config::LoggerConfiguration.new(traverse_config(hsh, :logger))
|
30
|
+
@bypass = traverse_config(hsh, :bypass)
|
31
|
+
@configuration_map = {}
|
32
|
+
build_configuration_map
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Boolean, false]
|
36
|
+
def enable
|
37
|
+
!!@enable
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Contrast::Config::LoggerConfiguration]
|
41
|
+
def logger
|
42
|
+
@logger ||= Contrast::Config::LoggerConfiguration.new
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Boolean, false]
|
46
|
+
def bypass
|
47
|
+
!!@bypass
|
48
|
+
end
|
49
|
+
|
50
|
+
# TODO: RUBY-1493 MOVE TO BASE CONFIG
|
51
|
+
|
52
|
+
def []= key, value
|
53
|
+
instance_variable_set("@#{ key }".to_sym, value)
|
54
|
+
@configuration_map[key] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
def [] key
|
58
|
+
send(key.to_sym)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Traverse the given entity to build out the configuration graph.
|
62
|
+
#
|
63
|
+
# The values will be either a hash, indicating internal nodes to
|
64
|
+
# traverse, or a value to set or the EMPTY_VALUE symbol, indicating a
|
65
|
+
# leaf node.
|
66
|
+
#
|
67
|
+
# The spec_key are the Contrast defined keys based on the instance variables of
|
68
|
+
# a given configuration.
|
69
|
+
def traverse_config values, spec_key
|
70
|
+
internal_nodes = values.cs__respond_to?(:has_key?)
|
71
|
+
val = internal_nodes ? value_from_key_config(spec_key, values) : nil
|
72
|
+
val == EMPTY_VALUE ? nil : val
|
73
|
+
end
|
74
|
+
|
75
|
+
def build_configuration_map
|
76
|
+
instance_variables.each do |key|
|
77
|
+
str_key = key.to_s.tr('@', '')
|
78
|
+
next if str_key == 'configuration_map'
|
79
|
+
|
80
|
+
@configuration_map[str_key] = send(str_key.to_sym)
|
81
|
+
end
|
27
82
|
end
|
28
83
|
end
|
29
84
|
end
|
data/service_executables/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.28.
|
1
|
+
2.28.14
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contrast-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- galen.palmer@contrastsecurity.com
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: exe
|
15
15
|
cert_chain: []
|
16
|
-
date: 2022-
|
16
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|