Skip to content

Commit 57d8f9e

Browse files
fix: fix unit tests with cassettes to add a call to api_tokens/
1 parent b09b779 commit 57d8f9e

32 files changed

+2050
-954
lines changed

src/ggshield/__init__.py

Whitespace-only changes.

tests/unit/cassettes/multiline_secret.yaml

Lines changed: 80 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- pygitguardian/1.20.0 (Linux;py3.11.10)
12+
- pygitguardian/1.23.0 (Linux;py3.11.9)
1313
method: GET
1414
uri: https://api.gitguardian.com/v1/metadata
1515
response:
1616
body:
1717
string:
18-
'{"version":"v2.193.0","preferences":{"marketplaces__aws_product_url":"http://aws.amazon.com/marketplace/pp/prodview-mrmulzykamba6","on_premise__restrict_signup":true,"on_premise__is_email_server_configured":true,"on_premise__default_sso_config_api_id":null,"on_premise__default_sso_config_force_sso":null,"onboarding__segmentation_v1_enabled":true,"general__maximum_payload_size":26214400,"general__mutual_tls_mode":"disabled","general__signup_enabled":true},"secret_scan_preferences":{"maximum_documents_per_scan":20,"maximum_document_size":1048576},"remediation_messages":{"pre_commit":">
18+
'{"version":"v2.240.0","preferences":{"marketplaces__aws_product_url":"http://aws.amazon.com/marketplace/pp/prodview-mrmulzykamba6","on_premise__restrict_signup":true,"on_premise__is_email_server_configured":true,"on_premise__default_sso_config_api_id":null,"on_premise__default_sso_config_force_sso":null,"onboarding__segmentation_v1_enabled":true,"general__maximum_payload_size":26214400,"general__mutual_tls_mode":"disabled","general__signup_enabled":true},"secret_scan_preferences":{"maximum_documents_per_scan":20,"maximum_document_size":1048576},"remediation_messages":{"pre_commit":">
1919
How to remediate\n\n Since the secret was detected before the commit was
2020
made:\n 1. replace the secret with its reference (e.g. environment variable).\n 2.
2121
commit again.\n\n> [Apply with caution] If you want to bypass ggshield (false
@@ -42,42 +42,94 @@ interactions:
4242
- GET, HEAD, OPTIONS
4343
content-length:
4444
- '2198'
45+
content-security-policy:
46+
- frame-ancestors 'none'
4547
content-type:
4648
- application/json
4749
cross-origin-opener-policy:
4850
- same-origin
4951
date:
50-
- Tue, 22 Apr 2025 13:27:58 GMT
52+
- Thu, 03 Jul 2025 14:25:54 GMT
5153
referrer-policy:
5254
- strict-origin-when-cross-origin
5355
server:
5456
- istio-envoy
5557
strict-transport-security:
5658
- max-age=31536000; includeSubDomains
57-
transfer-encoding:
58-
- chunked
5959
vary:
60-
- Accept-Encoding,Cookie
60+
- Cookie
6161
x-app-version:
62-
- v2.193.0
62+
- v2.240.0
6363
x-content-type-options:
6464
- nosniff
65+
x-envoy-upstream-service-time:
66+
- '29'
67+
x-frame-options:
68+
- DENY
69+
x-secrets-engine-version:
70+
- 2.141.1
71+
x-xss-protection:
72+
- 1; mode=block
73+
status:
74+
code: 200
75+
message: OK
76+
- request:
77+
body: null
78+
headers:
79+
Accept:
80+
- '*/*'
81+
Accept-Encoding:
82+
- gzip, deflate
83+
Connection:
84+
- keep-alive
85+
User-Agent:
86+
- pygitguardian/1.23.0 (Linux;py3.11.9)
87+
method: GET
88+
uri: https://api.gitguardian.com/v1/api_tokens/self
89+
response:
90+
body:
91+
string: '{"id":"b6cec120-cde4-41b8-a59e-1ca2eedb3c13","name":"scan","type":"personal_access_token","scopes":["scan","scan:create-incidents"],"member_id":304824,"workspace_id":295980,"created_at":"2025-07-03T13:10:37.610471Z","last_used_at":"2025-07-03T14:25:00Z","expire_at":null,"revoked_at":null,"status":"active","creator_id":304824}'
92+
headers:
93+
access-control-expose-headers:
94+
- X-App-Version
95+
allow:
96+
- GET, DELETE, HEAD, OPTIONS
97+
content-length:
98+
- '327'
99+
content-security-policy:
100+
- frame-ancestors 'none'
101+
content-type:
102+
- application/json
103+
cross-origin-opener-policy:
104+
- same-origin
105+
date:
106+
- Thu, 03 Jul 2025 14:25:55 GMT
107+
referrer-policy:
108+
- strict-origin-when-cross-origin
109+
server:
110+
- istio-envoy
111+
strict-transport-security:
112+
- max-age=31536000; includeSubDomains
113+
vary:
114+
- Cookie
115+
x-app-version:
116+
- v2.240.0
117+
x-content-type-options:
65118
- nosniff
66119
x-envoy-upstream-service-time:
67-
- '64'
120+
- '25'
68121
x-frame-options:
69122
- DENY
70-
- SAMEORIGIN
71123
x-secrets-engine-version:
72-
- 2.136.1
124+
- 2.141.1
73125
x-xss-protection:
74126
- 1; mode=block
75127
status:
76128
code: 200
77129
message: OK
78130
- request:
79131
body:
80-
'[{"filename": "/tmp/pytest-of-salomevoltz/pytest-8/test_json_output_for_patch__MU0/file",
132+
'[{"filename": "/tmp/pytest-of-alinatuholukova/pytest-105/test_json_output_for_patch__MU1/file",
81133
"document": "-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAIIRkYjxjE3KIZiEc8k4sWWGNsPYRNE0u0bl5oFVApPLm+uXQ/4l\nbKO9LFtMiVPy700oMWLScwAN5OAiqVLMvHUCAwEAAQJANLr8nmEWuV6t2hAwhK5I\nNNmBkEo4M/xFxEtl9J7LKbE2gtNrlCQiJlPP1EMhwAjDOzQcJ3lgFB28dkqH5rMW\nTQIhANrCE7O+wlCKe0WJqQ3lYlHG91XWyGVgfExJwBDsAD9LAiEAmDY5OSsH0n2A\n22tthkAvcN1s66lG+0DztOVJ4QLI2z8CIBPeDGwGpx8pdIicN/5LFuLWbyAcoZaT\nbLaA/DCNPniBAiA0l//bzg+M3srIhm04xzLdR9Vb9IjPRlkvN074zdKDVwIhAKJb\nRF3C+CMFb0wXme/ovcDeM1+3W/UmSHYUW4b3WYq4\n-----END
82134
RSA PRIVATE KEY-----"}]'
83135
headers:
@@ -88,29 +140,30 @@ interactions:
88140
Connection:
89141
- keep-alive
90142
Content-Length:
91-
- '606'
143+
- '612'
92144
Content-Type:
93145
- application/json
94146
GGShield-Command-Id:
95-
- 2160e3a2-c12b-40f3-83de-f610ed3a643b
147+
- 060cd63a-aa13-4ca0-a4cc-ac7d65aa4b12
96148
GGShield-Command-Path:
97149
- external
98150
GGShield-OS-Name:
99151
- ubuntu
100152
GGShield-OS-Version:
101-
- '24.04'
153+
- '22.04'
102154
GGShield-Python-Version:
103-
- 3.11.10
155+
- 3.11.9
104156
GGShield-Version:
105-
- 1.38.1
157+
- 1.41.0
106158
User-Agent:
107-
- pygitguardian/1.20.0 (Linux;py3.11.10)
159+
- pygitguardian/1.23.0 (Linux;py3.11.9)
108160
mode:
109161
- path
110162
scan_options:
111163
- '{"show_secrets": false, "ignored_detectors_count": 0, "ignored_matches_count":
112164
0, "ignored_paths_count": 0, "ignore_known_secrets": false, "with_incident_details":
113-
false, "has_prereceive_remediation_message": false, "all_secrets": false}'
165+
false, "has_prereceive_remediation_message": false, "all_secrets": false,
166+
"source_uuid": null}'
114167
method: POST
115168
uri: https://api.gitguardian.com/v1/multiscan?all_secrets=True
116169
response:
@@ -119,42 +172,40 @@ interactions:
119172
'[{"policy_break_count":1,"policies":["Secrets detection"],"policy_breaks":[{"type":"RSA
120173
Private Key","detector_name":"private_key_rsa","detector_group_name":"private_key_rsa","documentation_url":"https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/private_key_rsa","policy":"Secrets
121174
detection","matches":[{"type":"apikey","match":"-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAIIRkYjxjE3KIZiEc8k4sWWGNsPYRNE0u0bl5oFVApPLm+uXQ/4l\nbKO9LFtMiVPy700oMWLScwAN5OAiqVLMvHUCAwEAAQJANLr8nmEWuV6t2hAwhK5I\nNNmBkEo4M/xFxEtl9J7LKbE2gtNrlCQiJlPP1EMhwAjDOzQcJ3lgFB28dkqH5rMW\nTQIhANrCE7O+wlCKe0WJqQ3lYlHG91XWyGVgfExJwBDsAD9LAiEAmDY5OSsH0n2A\n22tthkAvcN1s66lG+0DztOVJ4QLI2z8CIBPeDGwGpx8pdIicN/5LFuLWbyAcoZaT\nbLaA/DCNPniBAiA0l//bzg+M3srIhm04xzLdR9Vb9IjPRlkvN074zdKDVwIhAKJb\nRF3C+CMFb0wXme/ovcDeM1+3W/UmSHYUW4b3WYq4\n-----END
122-
RSA PRIVATE KEY-----","index_start":0,"index_end":491,"line_start":1,"line_end":9}],"is_excluded":false,"exclude_reason":null,"incident_url":"https://dashboard.gitguardian.com/workspace/518431/incidents/9787731","known_secret":true,"validity":"no_checker","diff_kind":null}],"is_diff":false}]'
175+
RSA PRIVATE KEY-----","index_start":0,"index_end":491,"line_start":1,"line_end":9}],"is_excluded":false,"exclude_reason":null,"diff_kind":null,"is_vaulted":false,"known_secret":false,"incident_url":"","validity":"no_checker"}],"is_diff":false}]'
123176
headers:
124177
access-control-expose-headers:
125178
- X-App-Version
126179
allow:
127180
- POST, OPTIONS
128181
content-length:
129-
- '1143'
182+
- '1095'
183+
content-security-policy:
184+
- frame-ancestors 'none'
130185
content-type:
131186
- application/json
132187
cross-origin-opener-policy:
133188
- same-origin
134189
date:
135-
- Tue, 22 Apr 2025 13:27:58 GMT
190+
- Thu, 03 Jul 2025 14:25:55 GMT
136191
referrer-policy:
137192
- strict-origin-when-cross-origin
138193
server:
139194
- istio-envoy
140195
strict-transport-security:
141196
- max-age=31536000; includeSubDomains
142-
transfer-encoding:
143-
- chunked
144197
vary:
145-
- Accept-Encoding,Cookie
198+
- Cookie
146199
x-app-version:
147-
- v2.193.0
200+
- v2.240.0
148201
x-content-type-options:
149202
- nosniff
150-
- nosniff
151203
x-envoy-upstream-service-time:
152-
- '84'
204+
- '76'
153205
x-frame-options:
154206
- DENY
155-
- SAMEORIGIN
156207
x-secrets-engine-version:
157-
- 2.136.1
208+
- 2.141.1
158209
x-xss-protection:
159210
- 1; mode=block
160211
status:

0 commit comments

Comments
 (0)