contrast-agent-lib 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c11ea8c56731ecddea31d1a313c89d255a29d92b6402eb9b8bafb87d4e99eb1e
4
- data.tar.gz: 8061ccf26b37af4f38b31c7dfa0de84140cacde4b93aa5021ae26619c5d9b00f
3
+ metadata.gz: 6c48f5ba49fc4230ebce12b9ac7b9cd5e3821d9443ed26c990845ea435b17876
4
+ data.tar.gz: 302b23aae1691c39ae6e4b1b09e88d61442ec859ec4b3ef56792f9fc3e32e496
5
5
  SHA512:
6
- metadata.gz: e14c613abf66b81c95016f6b51ac3910007acc22d374678e9c06577c05cab0e15751a00aad2beea990d220532def48b45ee69b52cb15ce02ba30e3f9cb91d89b
7
- data.tar.gz: d8daefc635c0e5fc4c655235e5e9a999610a755f5d542151cc85e06056c7d4f8e2fa89fdd2ee54f61a0fb055e5f2e87f1b234d4389dba4725b6f210daec32478
6
+ metadata.gz: b2f22e6e14cd583bd3660d754e5ac5473b654a6a59891d3dd4d27f4a3dd6c1d3f37b59a1e698dd26d819118580775dca0825a7860840afbd444a2204d6bbd201
7
+ data.tar.gz: b38273a663ad3bc522a7390444c709f5dee5401387a27dd22a2fbbbfa0e0cfc50248c40b82b11ec6dad6c88cdc20cc2e7ff2073c3b79c54137dca2d0a69b8f29
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.0.0
@@ -14,6 +14,38 @@ def self.add_authors spec
14
14
  ]
15
15
  end
16
16
 
17
+ # Adds files to the gemspec required for the agent lib.
18
+ # It is best to call the build of the gem inside the sdks/ruby dir.
19
+ def self.add_files spec
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ # Directories used for testing:
22
+ f.match(%r{^(spec|test)/}) ||
23
+ f.match(%r{^(\.github|bin|sig|vendor|docs|crates|ci_scripts|raw-protect-rules|scripts|target|utils)/}) ||
24
+ # Configuration and other files that don't belong to one directory
25
+ f.match(/(Dockerfile)/) ||
26
+ f.match(/(CODEOWNERS)/) ||
27
+ f.match(/(.*\.csv)/) ||
28
+ f.match(/(.*\.md)/) ||
29
+ f.match(/(.*\.sh)/) ||
30
+ f.match(/(.*\.xml)/) ||
31
+ f.match(/(.*\.toml)/) ||
32
+ f.match(/(.*\.lock)/) ||
33
+ f.match(/(.*\.json)/) ||
34
+ f.match(%r{^(spec|test)/}) ||
35
+ f.match(/(.*\.ya?ml)/)
36
+ end
37
+
38
+ # exclude . files:
39
+ spec.files -= `git ls-files -- .??*`.split("\n")
40
+
41
+ spec.files += Dir['lib/**/*.rb']
42
+ spec.files += Dir['scripts/**/*.sh']
43
+ spec.files += %w[LICENSE.txt Gemfile contrast-agent-lib.gemspec .ruby-version]
44
+ # add the binary files created.
45
+ spec.files += Dir['usage_files/**/*.dylib']
46
+ spec.files += Dir['usage_files/**/*.so']
47
+ end
48
+
17
49
  # Add dev dependencies
18
50
  def self.add_development_dependencies spec
19
51
  spec.add_development_dependency('ffi', '~> 1.15', '>= 1.15.5')
@@ -25,15 +57,12 @@ Gem::Specification.new do |spec|
25
57
  spec.summary = "This is the Ruby Interface for Rust Agent Library"
26
58
  spec.description = "Gem including the interface for the Rust Agent Library, which will be used within the Ruby-Agent"
27
59
  spec.email = %w[ruby@contrastsecurity.com]
28
- spec.files = %w[lib/utils/os.rb lib/contrast-agent-lib.rb usage_files/libcontrast_c.dylib
29
- usage_files/libcontrast_c.so usage_files/libcontrast_c_musl.so scripts/build_gem.sh
30
- .ruby-version contrast-agent-lib.gemspec Gemfile LICENSE.txt
31
- ]
32
60
  spec.require_paths = ['lib']
33
61
  spec.homepage = 'https://www.contrastsecurity.com'
34
62
  spec.license = 'CONTRAST SECURITY (see license file)'
35
63
  spec.required_ruby_version = ['>= 2.7.0', '< 3.2.0']
36
64
 
37
65
  add_authors(spec)
66
+ add_files(spec)
38
67
  add_development_dependencies(spec)
39
68
  end
data/lib/consts.rb ADDED
@@ -0,0 +1,49 @@
1
+
2
+ # this file generated by c-bindings' build.rs file.
3
+ # DO NOT EDIT
4
+
5
+
6
+ module ContrastAgentLib
7
+ module EvalOptions
8
+ PREFER_WORTH_WATCHING = 1
9
+ end
10
+
11
+ module RuleType
12
+ UNSAFE_FILE_UPLOAD = 1
13
+ PATH_TRAVERSAL = 2
14
+ REFLECTED_XSS = 4
15
+ SQL_INJECTION = 8
16
+ CMD_INJECTION = 16
17
+ NOSQL_INJECTION_MONGO = 32
18
+ BOT_BLOCKER = 64
19
+ SSJS_INJECTION = 128
20
+ METHOD_TAMPERING = 256
21
+ PROTOTYPE_POLLUTION = 512
22
+ end
23
+
24
+ module InputType
25
+ COOKIE_NAME = 1
26
+ COOKIE_VALUE = 2
27
+ HEADER_KEY = 3
28
+ HEADER_VALUE = 4
29
+ JSON_KEY = 5
30
+ JSON_VALUE = 6
31
+ METHOD = 7
32
+ PARAMETER_KEY = 8
33
+ PARAMETER_VALUE = 9
34
+ URI_PATH = 10
35
+ URL_PARAMETER = 11
36
+ MULTIPART_NAME = 12
37
+ XML_VALUE = 13
38
+ end
39
+
40
+ module DbType
41
+ DB2 = 1
42
+ MYSQL = 2
43
+ ORACLE = 3
44
+ POSTGRES = 4
45
+ SQLITE = 5
46
+ SQLSERVER = 6
47
+ UNKNOWN = 7
48
+ end
49
+ end
@@ -3,6 +3,8 @@
3
3
 
4
4
  require 'ffi'
5
5
  require 'utils/os'
6
+ # Load the constants
7
+ require_relative 'consts'
6
8
 
7
9
  module ContrastAgentLib
8
10
  include ContrastAgentLib::OS
data/lib/utils/os.rb CHANGED
@@ -26,11 +26,10 @@ module ContrastAgentLib
26
26
  end
27
27
 
28
28
  def alpine?
29
- os_release = File.open("./etc/os-release")
30
- linux? && os_release.include?("alpine")
31
- rescue
29
+ return true if File.exist?("/etc/alpine-release")
30
+
32
31
  false
33
32
  end
34
33
  end
35
34
  end
36
- end
35
+ end
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ module ContrastAgentLib
5
+ module Version
6
+ VERSION='0.1.3'
7
+ end
8
+ end
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contrast-agent-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - teodor.raychev@contrastsecurity.com
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2022-07-14 00:00:00.000000000 Z
15
+ date: 2022-10-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ffi
@@ -46,8 +46,10 @@ files:
46
46
  - Gemfile
47
47
  - LICENSE.txt
48
48
  - contrast-agent-lib.gemspec
49
+ - lib/consts.rb
49
50
  - lib/contrast-agent-lib.rb
50
51
  - lib/utils/os.rb
52
+ - lib/utils/version.rb
51
53
  - scripts/build_gem.sh
52
54
  - usage_files/libcontrast_c.dylib
53
55
  - usage_files/libcontrast_c.so
@@ -74,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  - !ruby/object:Gem::Version
75
77
  version: '0'
76
78
  requirements: []
77
- rubygems_version: 3.2.33
79
+ rubygems_version: 3.2.3
78
80
  signing_key:
79
81
  specification_version: 4
80
82
  summary: This is the Ruby Interface for Rust Agent Library