Skip to content

Commit bf9b526

Browse files
committed
feat: Add detector documentation to text output
1 parent 3e1503c commit bf9b526

File tree

5 files changed

+130
-52
lines changed

5 files changed

+130
-52
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Removed
9+
10+
- A bullet item for the Removed category.
11+
12+
-->
13+
14+
### Added
15+
16+
- Extra information in scan results (detector name, detector group name and documentation URL).
17+
- Link to detector documentation in text output.
18+
19+
<!--
20+
### Changed
21+
22+
- A bullet item for the Changed category.
23+
24+
-->
25+
<!--
26+
### Deprecated
27+
28+
- A bullet item for the Deprecated category.
29+
30+
-->
31+
<!--
32+
### Fixed
33+
34+
- A bullet item for the Fixed category.
35+
36+
-->
37+
<!--
38+
### Security
39+
40+
- A bullet item for the Security category.
41+
42+
-->

ggshield/verticals/secret/output/secret_text_output_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ def secret_header(
308308
{indent}Incident URL: {secrets[0].incident_url if known_secret and secret.incident_url else "N/A"}
309309
{indent}Secret SHA: {ignore_sha}
310310
"""
311+
if secret.documentation_url is not None:
312+
message += f"{indent}Detector documentation: {secret.documentation_url}#revoke-the-secret\n"
311313
if secret.ignore_reason is not None:
312314
message += f"{indent}Ignored: {secret.ignore_reason.to_human_readable()}\n"
313315

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ inline-quotes = double
44
max-line-length = 120
55
ignore = E203, E704, W503
66
exclude = **/snapshots/*.py, .venv, build
7+
per-file-ignores =
8+
tests/unit/conftest.py: E501

tests/unit/conftest.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def is_macos():
6464
"policy_breaks": [
6565
{
6666
"type": "MySQL Assignment",
67-
"detector_name": "mysql",
68-
"detector_group_name": "mysql",
69-
"documentation_url": None,
67+
"detector_name": "mysql_assignment",
68+
"detector_group_name": "mysql_credentials",
69+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/mysql_credentials",
7070
"policy": "Secrets detection",
7171
"matches": [
7272
{
@@ -173,8 +173,8 @@ def is_macos():
173173
{
174174
"type": "GitHub Token",
175175
"detector_name": "github_token",
176-
"detector_group_name": "github_token",
177-
"documentation_url": None,
176+
"detector_group_name": "github_access_token",
177+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/github_access_token",
178178
"policy": "Secrets Detection",
179179
"matches": [
180180
{
@@ -197,8 +197,8 @@ def is_macos():
197197
{
198198
"type": "GitHub Token",
199199
"detector_name": "github_token",
200-
"detector_group_name": "github_token",
201-
"documentation_url": None,
200+
"detector_group_name": "github_access_token",
201+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/github_access_token",
202202
"policy": "Secrets Detection",
203203
"matches": [
204204
{
@@ -240,10 +240,10 @@ def is_macos():
240240
"policies": ["File extensions", "Filenames", "Secrets detection"],
241241
"policy_breaks": [
242242
{
243-
"type": "Facebook Access Tokens",
244-
"detector_name": "facebook",
245-
"detector_group_name": "facebook",
246-
"documentation_url": None,
243+
"type": "Facebook Access Token",
244+
"detector_name": "facebook_access_token",
245+
"detector_group_name": "facebook_access_token",
246+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/facebook_access_token",
247247
"policy": "Secrets Detection",
248248
"matches": [
249249
{
@@ -276,10 +276,10 @@ def is_macos():
276276
"policies": ["File extensions", "Filenames", "Secrets detection"],
277277
"policy_breaks": [
278278
{
279-
"type": "Facebook Access Tokens",
280-
"detector_name": "facebook",
281-
"detector_group_name": "facebook",
282-
"documentation_url": None,
279+
"type": "Facebook Access Token",
280+
"detector_name": "facebook_access_token",
281+
"detector_group_name": "facebook_access_token",
282+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/facebook_access_token",
283283
"policy": "Secrets Detection",
284284
"matches": [
285285
{
@@ -312,10 +312,10 @@ def is_macos():
312312
"policies": ["File extensions", "Filenames", "Secrets detection"],
313313
"policy_breaks": [
314314
{
315-
"type": "Facebook Access Tokens",
316-
"detector_name": "facebook",
317-
"detector_group_name": "facebook",
318-
"documentation_url": None,
315+
"type": "Facebook Access Token",
316+
"detector_name": "facebook_access_token",
317+
"detector_group_name": "facebook_access_token",
318+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/facebook_access_token",
319319
"policy": "Secrets Detection",
320320
"matches": [
321321
{
@@ -353,9 +353,9 @@ def is_macos():
353353
"policy_breaks": [
354354
{
355355
"type": "RSA Private Key",
356-
"detector_name": "rsa_private_key",
357-
"detector_group_name": "rsa_private_key",
358-
"documentation_url": None,
356+
"detector_name": "private_key_rsa",
357+
"detector_group_name": "private_key_rsa",
358+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/private_key_rsa",
359359
"policy": "Secrets Detection",
360360
"matches": [
361361
{
@@ -383,10 +383,10 @@ def is_macos():
383383
{
384384
"policy_breaks": [
385385
{
386-
"type": "Facebook Access Tokens",
387-
"detector_name": "facebook",
388-
"detector_group_name": "facebook",
389-
"documentation_url": None,
386+
"type": "Facebook Access Token",
387+
"detector_name": "facebook_access_token",
388+
"detector_group_name": "facebook_access_token",
389+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/facebook_access_token",
390390
"policy": "Secrets Detection",
391391
"matches": [
392392
{
@@ -409,9 +409,9 @@ def is_macos():
409409
},
410410
{
411411
"type": "RSA Private Key",
412-
"detector_name": "rsa_private_key",
413-
"detector_group_name": "rsa_private_key",
414-
"documentation_url": None,
412+
"detector_name": "private_key_rsa",
413+
"detector_group_name": "private_key_rsa",
414+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/private_key_rsa",
415415
"policy": "Secrets detection",
416416
"matches": [
417417
{
@@ -427,8 +427,8 @@ def is_macos():
427427
{
428428
"type": "SendGrid Key",
429429
"detector_name": "sendgrid",
430-
"detector_group_name": "sendgrid",
431-
"documentation_url": None,
430+
"detector_group_name": "sendgrid_key",
431+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/sendgrid_key",
432432
"policy": "Secrets detection",
433433
"matches": [
434434
{
@@ -553,9 +553,9 @@ def is_macos():
553553
"policy_breaks": [
554554
{
555555
"type": "RSA Private Key",
556-
"detector_name": "rsa_private_key",
557-
"detector_group_name": "rsa_private_key",
558-
"documentation_url": None,
556+
"detector_name": "private_key_rsa",
557+
"detector_group_name": "private_key_rsa",
558+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/private_key_rsa",
559559
"policy": "Secrets detection",
560560
"matches": [
561561
{
@@ -570,9 +570,9 @@ def is_macos():
570570
},
571571
{
572572
"type": "SendGrid Key",
573-
"detector_name": "sendgrid_key",
573+
"detector_name": "sendgrid",
574574
"detector_group_name": "sendgrid_key",
575-
"documentation_url": None,
575+
"documentation_url": "https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/sendgrid_key",
576576
"policy": "Secrets detection",
577577
"matches": [
578578
{

0 commit comments

Comments
 (0)