gitlab-secret_detection 0.1.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/gitlab.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'gitlab/secret_detection'
4
+
5
+ module GitLab
6
+ end
@@ -0,0 +1,76 @@
1
+ syntax = "proto3";
2
+
3
+ package gitlab.secret_detection;
4
+
5
+ /* We keep generated files within grpc namespace i.e GitLab::SecretDetection::GRPC
6
+ * so that these files are exported too in the Ruby Gem along with Core and GRPC logic.
7
+ */
8
+ option ruby_package="GitLab::SecretDetection::GRPC";
9
+
10
+ /* Request arg for triggering Scan/ScanStream method */
11
+ message ScanRequest {
12
+ message Payload {
13
+ string id = 1;
14
+ string data = 2;
15
+ }
16
+
17
+ // Either provide rule type or a particular value to allow during the scan
18
+ message Exclusion {
19
+ ExclusionType exclusion_type = 1;
20
+ string value = 2;
21
+ }
22
+
23
+ enum ExclusionType {
24
+ EXCLUSION_TYPE_UNSPECIFIED = 0;
25
+ EXCLUSION_TYPE_RULE = 1; // Rule ID to exclude
26
+ EXCLUSION_TYPE_RAW_VALUE = 2; // Raw value to exclude
27
+ }
28
+
29
+ repeated Payload payloads = 1; // Array of payloads to scan
30
+ // Scan timeout on the entire request. Value is represented in seconds, accepts float values to represent
31
+ // smaller unit values. Default is 180 seconds.
32
+ optional float timeout_secs = 2;
33
+ // Scan timeout on each payload . Value is represented in seconds, accepts float values to represent smaller
34
+ // unit values. Default is 30 seconds.
35
+ optional float payload_timeout_secs = 3;
36
+ repeated Exclusion exclusions = 4; // Optional. Array of rule-types/raw-values to exclude from being considered during scan.
37
+ repeated string tags = 5; // Optional. Array of rule tags to consider for scan. Ex: ["gitlab_blocking"]
38
+ }
39
+
40
+ /* Response from Scan/ScanStream method */
41
+ message ScanResponse {
42
+ // Represents a secret finding identified within a payload
43
+ message Finding {
44
+ string payload_id = 1;
45
+ Status status = 2;
46
+ optional string type = 3;
47
+ optional string description = 4;
48
+ optional int32 line_number = 5;
49
+ optional string error = 6;
50
+ }
51
+
52
+ // Return status code in sync with ::SecretDetection::Status
53
+ enum Status {
54
+ STATUS_UNSPECIFIED = 0;
55
+ STATUS_FOUND = 1; // one or more findings
56
+ STATUS_FOUND_WITH_ERRORS = 2; // one or more findings along with some errors
57
+ STATUS_SCAN_TIMEOUT = 3; // whole scan timeout
58
+ STATUS_PAYLOAD_TIMEOUT = 4; // single payload timeout
59
+ STATUS_SCAN_ERROR = 5; // internal scan failure
60
+ STATUS_INPUT_ERROR = 6; // invalid input failure
61
+ STATUS_NOT_FOUND = 7; // zero findings
62
+ }
63
+
64
+ optional string error = 1;
65
+ repeated Finding results = 2;
66
+ Status status = 3;
67
+ }
68
+
69
+ /* Scanner service that scans given payloads and returns findings */
70
+ service Scanner {
71
+ // Runs secret detection scan for the given request
72
+ rpc Scan(ScanRequest) returns (ScanResponse) { }
73
+
74
+ // Runs bi-directional streaming of scans for the given stream of requests with a stream of responses
75
+ rpc ScanStream(stream ScanRequest) returns (stream ScanResponse) { }
76
+ }
metadata CHANGED
@@ -1,76 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-secret_detection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
- - group::static analysis
7
+ - group::secret detection
8
+ - Stan Hu
9
+ - gitlab_rubygems
8
10
  autorequire:
9
- bindir: exe
11
+ bindir: bin
10
12
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
13
+ date: 2024-10-01 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
- name: rspec
16
+ name: grpc
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - "~>"
19
+ - - '='
18
20
  - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :development
21
+ version: 1.63.0
22
+ type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - "~>"
26
+ - - '='
25
27
  - !ruby/object:Gem::Version
26
- version: '3.0'
28
+ version: 1.63.0
27
29
  - !ruby/object:Gem::Dependency
28
- name: rubocop
30
+ name: grpc-tools
29
31
  requirement: !ruby/object:Gem::Requirement
30
32
  requirements:
31
33
  - - "~>"
32
34
  - !ruby/object:Gem::Version
33
- version: '1.50'
34
- type: :development
35
+ version: '1.66'
36
+ type: :runtime
35
37
  prerelease: false
36
38
  version_requirements: !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - - "~>"
39
41
  - !ruby/object:Gem::Version
40
- version: '1.50'
42
+ version: '1.66'
43
+ - !ruby/object:Gem::Dependency
44
+ name: re2
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '='
48
+ - !ruby/object:Gem::Version
49
+ version: 2.7.0
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '='
55
+ - !ruby/object:Gem::Version
56
+ version: 2.7.0
41
57
  - !ruby/object:Gem::Dependency
42
- name: rubocop-rspec
58
+ name: toml-rb
43
59
  requirement: !ruby/object:Gem::Requirement
44
60
  requirements:
45
61
  - - "~>"
46
62
  - !ruby/object:Gem::Version
47
- version: '2.22'
48
- type: :development
63
+ version: 2.2.0
64
+ type: :runtime
49
65
  prerelease: false
50
66
  version_requirements: !ruby/object:Gem::Requirement
51
67
  requirements:
52
68
  - - "~>"
53
69
  - !ruby/object:Gem::Version
54
- version: '2.22'
55
- description: The gitlab-secret_detection gem accepts one or more git blobs, matches
56
- them against a defined ruleset of regular expressions (based on gitleaks.toml used
57
- by secrets analyzer), and returns scan results.
70
+ version: 2.2.0
71
+ description: |-
72
+ GitLab Secret Detection gem accepts text-based payloads, matches them against predefined secret
73
+ detection rules (based on the ruleset used by GitLab Secrets analyzer), and returns the scan results. The gem also
74
+ supports customization of the scan behaviour.
58
75
  email:
59
- - eng-dev-secure-static-analysis@gitlab.com
76
+ - eng-dev-secure-secret-detection@gitlab.com
77
+ - stan@gitlab.com
60
78
  executables: []
61
79
  extensions: []
62
80
  extra_rdoc_files: []
63
81
  files:
82
+ - LICENSE
83
+ - README.md
84
+ - config/log.rb
85
+ - lib/gitlab.rb
64
86
  - lib/gitlab/secret_detection.rb
87
+ - lib/gitlab/secret_detection/core.rb
88
+ - lib/gitlab/secret_detection/core/finding.rb
89
+ - lib/gitlab/secret_detection/core/gitleaks.toml
90
+ - lib/gitlab/secret_detection/core/response.rb
91
+ - lib/gitlab/secret_detection/core/ruleset.rb
92
+ - lib/gitlab/secret_detection/core/scanner.rb
93
+ - lib/gitlab/secret_detection/core/status.rb
94
+ - lib/gitlab/secret_detection/grpc.rb
95
+ - lib/gitlab/secret_detection/grpc/client/grpc_client.rb
96
+ - lib/gitlab/secret_detection/grpc/generated/.gitkeep
97
+ - lib/gitlab/secret_detection/grpc/generated/secret_detection_pb.rb
98
+ - lib/gitlab/secret_detection/grpc/generated/secret_detection_services_pb.rb
99
+ - lib/gitlab/secret_detection/grpc/scanner_service.rb
65
100
  - lib/gitlab/secret_detection/version.rb
66
- homepage: https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection
101
+ - proto/secret_detection.proto
102
+ homepage: https://gitlab.com/gitlab-org/security-products/secret-detection/secret-detection-service
67
103
  licenses:
68
104
  - MIT
69
105
  metadata:
70
106
  rubygems_mfa_required: 'true'
71
- homepage_uri: https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection
72
- source_code_uri: https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection
73
- changelog_uri: https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection/CHANGELOG.md
107
+ homepage_uri: https://gitlab.com/gitlab-org/security-products/secret-detection/secret-detection-service
108
+ source_code_uri: https://gitlab.com/gitlab-org/security-products/secret-detection/secret-detection-service
109
+ changelog_uri: https://gitlab.com/gitlab-org/security-products/secret-detection/secret-detection-service/-/blob/main/CHANGELOG.md
74
110
  post_install_message:
75
111
  rdoc_options: []
76
112
  require_paths:
@@ -79,16 +115,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
115
  requirements:
80
116
  - - ">="
81
117
  - !ruby/object:Gem::Version
82
- version: '3.0'
118
+ version: '3.2'
83
119
  required_rubygems_version: !ruby/object:Gem::Requirement
84
120
  requirements:
85
121
  - - ">="
86
122
  - !ruby/object:Gem::Version
87
123
  version: '0'
88
124
  requirements: []
89
- rubygems_version: 3.4.18
125
+ rubygems_version: 3.4.19
90
126
  signing_key:
91
127
  specification_version: 4
92
- summary: The gitlab-secret_detection gem performs regex matching on git blobs that
93
- may include secrets.
128
+ summary: GitLab Secret Detection gem scans for the secret leaks in the given text-based
129
+ payloads.
94
130
  test_files: []