Skip to content

Commit 9488552

Browse files
committed
draft
1 parent 4d084c5 commit 9488552

File tree

8 files changed

+570
-171
lines changed

8 files changed

+570
-171
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
3+
"runs": [
4+
{
5+
"automationDetails": {
6+
"id": "Snyk/Open Source/*"
7+
},
8+
"results": [
9+
{
10+
"level": "unmapped",
11+
"locations": [
12+
{
13+
"logicalLocations": [
14+
{
15+
"fullyQualifiedName": "@*"
16+
}
17+
],
18+
"physicalLocation": {
19+
"artifactLocation": {
20+
"uri": "package.json"
21+
},
22+
"region": {
23+
"startLine": 1
24+
}
25+
}
26+
}
27+
],
28+
"message": {
29+
"text": "This file introduces a vulnerable package with a severity vulnerability."
30+
},
31+
"ruleId": "00000000-0000-0000-0000-000000000001"
32+
}
33+
],
34+
"tool": {
35+
"driver": {
36+
"informationUri": "https://docs.snyk.io/",
37+
"name": "Snyk Open Source",
38+
"rules": [
39+
{
40+
"fullDescription": {
41+
"text": "@"
42+
},
43+
"help": {
44+
"markdown": "some description",
45+
"text": ""
46+
},
47+
"id": "00000000-0000-0000-0000-000000000001",
48+
"properties": {
49+
"cvssv3_baseScore": 0,
50+
"security-severity": "0.0",
51+
"tags": [
52+
"security",
53+
"CWE-798"
54+
]
55+
},
56+
"shortDescription": {
57+
"text": " severity - AWS Access Key vulnerability in "
58+
}
59+
}
60+
],
61+
"semanticVersion": "1.1301.0",
62+
"version": "1.1301.0"
63+
}
64+
}
65+
}
66+
],
67+
"version": "2.1.0"
68+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
[
2+
{
3+
"testId": "f216306e-842c-429b-aa94-57893e516cdd",
4+
"testConfiguration": {
5+
"local_policy": {
6+
"fail_on_upgradable": false,
7+
"ignores": [],
8+
"severity_threshold": "none",
9+
"suppress_pending_ignores": false
10+
},
11+
"timeout": {
12+
"outcome": "fail",
13+
"seconds": 1200
14+
}
15+
},
16+
"createdAt": "2025-10-28T15:42:29.689452Z",
17+
"testSubject": {
18+
"locator": {
19+
"paths": [
20+
"package-lock.json"
21+
],
22+
"type": "local_path"
23+
},
24+
"type": "dep_graph"
25+
},
26+
"executionState": "finished",
27+
"passFail": "fail",
28+
"outcomeReason": "policy_breach",
29+
"effectiveSummary": {
30+
"count": 13,
31+
"count_by": {
32+
"result_type": {
33+
"dast": 0,
34+
"other": 0,
35+
"sast": 0,
36+
"sca": 13
37+
},
38+
"severity": {
39+
"critical": 0,
40+
"high": 2,
41+
"low": 1,
42+
"medium": 10,
43+
"none": 0,
44+
"other": 0
45+
}
46+
}
47+
},
48+
"rawSummary": {
49+
"count": 13,
50+
"count_by": {
51+
"result_type": {
52+
"dast": 0,
53+
"other": 0,
54+
"sast": 0,
55+
"sca": 13
56+
},
57+
"severity": {
58+
"critical": 0,
59+
"high": 2,
60+
"low": 1,
61+
"medium": 10,
62+
"none": 0,
63+
"other": 0
64+
}
65+
}
66+
},
67+
"findings": [
68+
{
69+
"attributes": {
70+
"cause_of_failure": false,
71+
"description": "some description",
72+
"finding_type": "secrets",
73+
"key": "00000000-0000-0000-0000-000000000001",
74+
"locations": [
75+
{
76+
"region": {
77+
"filePath": "test.tf",
78+
"fromLine": 20,
79+
"fromColumn": 20,
80+
"toLine": 20,
81+
"toColumn": 20
82+
},
83+
"type": "source"
84+
},
85+
{
86+
"region": {
87+
"filePath": "test.tf",
88+
"fromLine": 30,
89+
"fromColumn": 30,
90+
"toLine": 30,
91+
"toColumn": 30
92+
},
93+
"type": "source"
94+
}
95+
],
96+
"policy_modifications": [],
97+
"problems": [
98+
{
99+
"id": "aws-access-token",
100+
"source": "snyk"
101+
},
102+
{
103+
"id": "CWE-798",
104+
"source": "cwe"
105+
}
106+
],
107+
"title": "AWS Access Key"
108+
},
109+
"links": {},
110+
"relationships": {},
111+
"type": "findings"
112+
}
113+
],
114+
"findingsComplete": true
115+
}
116+
]
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[
2+
{
3+
"testId": "c7da999e-131a-4490-ab3a-23f74c185d2d",
4+
"testConfiguration": {
5+
"local_policy": {}, // same
6+
"timeout": { "outcome": "fail", "seconds": 1200 }
7+
},
8+
"metadata": {}, //??? probably similar to OS or empty
9+
"createdAt": "2025-11-06T14:45:12.489805Z",
10+
"resources": [
11+
{
12+
"contentType": "source",
13+
"repositoryURL": "github.com/test",
14+
"revisionID": "some-uuid",
15+
"type": "upload"
16+
}
17+
], // this is new, we wont work with subjects at all
18+
"executionState": "finished",
19+
"passFail": "fail",
20+
"outcomeReason": "policy_breach",
21+
"effectiveSummary": {
22+
"count": 1,
23+
"count_by": {
24+
"result_type": { "dast": 0, "other": 0, "sast": 0, "sca": 0, "secrets": 0 },
25+
"severity": {
26+
"critical": 1,
27+
"high": 0,
28+
"low": 0,
29+
"medium": 0,
30+
"none": 0,
31+
"other": 0
32+
}
33+
}
34+
},
35+
"rawSummary": {
36+
"count": 1,
37+
"count_by": {
38+
"result_type": { "dast": 0, "other": 0, "sast": 0, "sca": 0, "secrets": 0 },
39+
"severity": {
40+
"critical": 1,
41+
"high": 0,
42+
"low": 0,
43+
"medium": 0,
44+
"none": 0,
45+
"other": 0
46+
}
47+
}
48+
},
49+
"findings": [
50+
{
51+
"attributes": {
52+
"cause_of_failure": false,
53+
"description": "Leaked AWS secret",
54+
"evidence": [], // no evidence for secrets atm
55+
"finding_type": "secrets",
56+
"key": "00000000-0000-0000-0000-000000000001",
57+
"locations": [
58+
{
59+
"filePath": "config.json",
60+
"fromColumn": 1,
61+
"toColumn": 10,
62+
"fromLine": 1,
63+
"toLine": 1,
64+
"type": "source"
65+
},
66+
{
67+
"filePath": "config.json",
68+
"fromColumn": 1,
69+
"toColumn": 10,
70+
"fromLine": 3,
71+
"toLine": 3,
72+
"type": "source"
73+
}
74+
],
75+
"policy_modifications": [],
76+
"problems": [
77+
{ "id": "aws-key-id", "source": "snyk" },
78+
{ "id": "CWE-502", "source": "cwe" }
79+
],
80+
"rating": { "severity": "critical" },
81+
"risk": {},
82+
"title": "Leaked AWS secret"
83+
},
84+
"id": "085fd753-c0ff-43b2-b354-27ef7ef0ceb9",
85+
"links": {},
86+
"relationships": {}, // no relationships for secrets atm, we don't have fix suggestions
87+
"type": "findings"
88+
}
89+
],
90+
"findingsComplete": true
91+
}
92+
]

pkg/local_workflows/code_workflow/native_workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"errors"
7+
"github.com/snyk/go-application-framework/pkg/utils/file_filter"
78
"net/http"
89
"os"
910
"path"
@@ -25,7 +26,6 @@ import (
2526
"github.com/snyk/go-application-framework/pkg/local_workflows/local_models"
2627
"github.com/snyk/go-application-framework/pkg/networking"
2728
"github.com/snyk/go-application-framework/pkg/ui"
28-
"github.com/snyk/go-application-framework/pkg/utils"
2929
sarif2 "github.com/snyk/go-application-framework/pkg/utils/sarif"
3030
"github.com/snyk/go-application-framework/pkg/workflow"
3131
)
@@ -305,7 +305,7 @@ func determineAnalyzeInput(path string, config configuration.Configuration, logg
305305

306306
// Return a channel that notifies each file in the path that doesn't match the filter rules
307307
func getFilesForPath(path string, logger *zerolog.Logger, max_threads int) (<-chan string, error) {
308-
filter := utils.NewFileFilter(path, logger, utils.WithThreadNumber(max_threads))
308+
filter := file_filter.NewFileFilter(path, logger, file_filter.WithThreadNumber(max_threads))
309309
rules, err := filter.GetRules([]string{".gitignore", ".dcignore", ".snyk"})
310310
if err != nil {
311311
return nil, err

0 commit comments

Comments
 (0)