Skip to content

Commit cacbffc

Browse files
authored
(Fix): Update gitleaks test data (#900)
Gitleaks [v8.21.2](https://github.com/gitleaks/gitleaks/releases/tag/v8.21.2) added more stringent checking, removing some false positives. Updates our test data to provide more useful tests. "Secrets" are taken from gitleaks repo test data
1 parent bedf6e2 commit cacbffc

4 files changed

Lines changed: 118 additions & 7 deletions

File tree

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
aws_access_key_id = "AKIAIO5FODNN7EXAMPLE"
22

3+
aws_token = "AKIALALEMEL33243OLIA"
34

4-
aws_access_key_id = "AKIAIO5FODNN7EXAMPLE"
5+
private_key = """-----BEGIN OPENSSH PRIVATE KEY-----
6+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
7+
QyNTUxOQAAACA8YWKYztuuvxUIMomc3zv0OdXCT57Cc2cRYu3TMbX9XAAAAJDiKO3C4ijt
8+
wgAAAAtzc2gtZWQyNTUxOQAAACA8YWKYztuuvxUIMomc3zv0OdXCT57Cc2cRYu3TMbX9XA
9+
AAAECzmj8DGxg5YHtBK4AmBttMXDQHsPAaCyYHQjJ4YujRBTxhYpjO266/FQgyiZzfO/Q5
10+
1cJPnsJzZxFi7dMxtf1cAAAADHJvb3RAZGV2aG9zdAE=
11+
-----END OPENSSH PRIVATE KEY-----"""

‎linters/gitleaks/test_data/gitleaks_v8.1.3_basic.check.shot‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,36 @@ exports[`Testing linter gitleaks test basic 1`] = `
2323
},
2424
{
2525
"code": "aws-access-token",
26-
"column": "23",
26+
"column": "15",
2727
"file": "test_data/basic.py",
2828
"issueClass": "ISSUE_CLASS_EXISTING",
2929
"level": "LEVEL_HIGH",
30-
"line": "4",
30+
"line": "3",
3131
"linter": "gitleaks",
3232
"message": "aws-access-token has detected secret for file test_data/basic.py.",
3333
"ranges": [
3434
{
3535
"filePath": "test_data/basic.py",
3636
"length": "19",
37-
"offset": "67",
37+
"offset": "58",
38+
},
39+
],
40+
"targetType": "ALL",
41+
},
42+
{
43+
"code": "OPENSSH-PK",
44+
"column": "19",
45+
"file": "test_data/basic.py",
46+
"issueClass": "ISSUE_CLASS_EXISTING",
47+
"level": "LEVEL_HIGH",
48+
"line": "5",
49+
"linter": "gitleaks",
50+
"message": "OPENSSH-PK has detected secret for file test_data/basic.py.",
51+
"ranges": [
52+
{
53+
"filePath": "test_data/basic.py",
54+
"length": "34",
55+
"offset": "98",
3856
},
3957
],
4058
"targetType": "ALL",
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
// trunk-upgrade-validation:RELEASE
3+
4+
exports[`Testing linter gitleaks test basic 1`] = `
5+
{
6+
"issues": [
7+
{
8+
"code": "aws-access-token",
9+
"column": "15",
10+
"file": "test_data/basic.py",
11+
"issueClass": "ISSUE_CLASS_EXISTING",
12+
"level": "LEVEL_HIGH",
13+
"line": "3",
14+
"linter": "gitleaks",
15+
"message": "aws-access-token has detected secret for file test_data/basic.py.",
16+
"ranges": [
17+
{
18+
"filePath": "test_data/basic.py",
19+
"length": "20",
20+
"offset": "58",
21+
},
22+
],
23+
"targetType": "ALL",
24+
},
25+
{
26+
"code": "private-key",
27+
"column": "19",
28+
"file": "test_data/basic.py",
29+
"issueClass": "ISSUE_CLASS_EXISTING",
30+
"level": "LEVEL_HIGH",
31+
"line": "5",
32+
"linter": "gitleaks",
33+
"message": "private-key has detected secret for file test_data/basic.py.",
34+
"ranges": [
35+
{
36+
"filePath": "test_data/basic.py",
37+
"length": "397",
38+
"offset": "98",
39+
},
40+
],
41+
"targetType": "ALL",
42+
},
43+
],
44+
"lintActions": [
45+
{
46+
"command": "lint",
47+
"fileGroupName": "ALL",
48+
"linter": "gitleaks",
49+
"paths": [
50+
"test_data/basic.py",
51+
],
52+
"verb": "TRUNK_VERB_CHECK",
53+
},
54+
{
55+
"command": "lint",
56+
"fileGroupName": "ALL",
57+
"linter": "gitleaks",
58+
"paths": [
59+
"test_data/basic.py",
60+
],
61+
"upstream": true,
62+
"verb": "TRUNK_VERB_CHECK",
63+
},
64+
],
65+
"taskFailures": [],
66+
"unformattedFiles": [],
67+
}
68+
`;

‎linters/gitleaks/test_data/gitleaks_v8.8.7_basic.check.shot‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,36 @@ exports[`Testing linter gitleaks test basic 1`] = `
2323
},
2424
{
2525
"code": "aws-access-token",
26-
"column": "23",
26+
"column": "15",
2727
"file": "test_data/basic.py",
2828
"issueClass": "ISSUE_CLASS_EXISTING",
2929
"level": "LEVEL_HIGH",
30-
"line": "4",
30+
"line": "3",
3131
"linter": "gitleaks",
3232
"message": "aws-access-token has detected secret for file test_data/basic.py.",
3333
"ranges": [
3434
{
3535
"filePath": "test_data/basic.py",
3636
"length": "19",
37-
"offset": "67",
37+
"offset": "58",
38+
},
39+
],
40+
"targetType": "ALL",
41+
},
42+
{
43+
"code": "private-key",
44+
"column": "19",
45+
"file": "test_data/basic.py",
46+
"issueClass": "ISSUE_CLASS_EXISTING",
47+
"level": "LEVEL_HIGH",
48+
"line": "5",
49+
"linter": "gitleaks",
50+
"message": "private-key has detected secret for file test_data/basic.py.",
51+
"ranges": [
52+
{
53+
"filePath": "test_data/basic.py",
54+
"length": "396",
55+
"offset": "98",
3856
},
3957
],
4058
"targetType": "ALL",

0 commit comments

Comments
 (0)