Skip to content

Commit 8131133

Browse files
committed
fix: not recommended patterns are now included in semgrep config CF-1809
1 parent ee1b0e6 commit 8131133

File tree

9 files changed

+57
-12
lines changed

9 files changed

+57
-12
lines changed

cmd/init_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestConfigFileTemplate(t *testing.T) {
2525
"node@22.2.0",
2626
"python@3.11.11",
2727
"eslint@8.57.0",
28-
"trivy@0.65.0",
28+
"trivy@0.66.0",
2929
"pylint@3.3.6",
3030
"pmd@7.11.0",
3131
},

integration-tests/config-discover/expected/codacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ tools:
1010
- pmd@7.11.0
1111
- pylint@3.3.6
1212
- semgrep@1.78.0
13-
- trivy@0.65.0
13+
- trivy@0.66.0

integration-tests/init-with-token/expected/codacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ tools:
88
- pmd@6.55.0
99
- pylint@3.3.7
1010
- semgrep@1.78.0
11-
- trivy@0.65.0
11+
- trivy@0.66.0

integration-tests/init-without-token/expected/codacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ tools:
1212
- pylint@3.3.6
1313
- revive@1.7.0
1414
- semgrep@1.78.0
15-
- trivy@0.65.0
15+
- trivy@0.66.0

integration-tests/init-without-token/expected/tools-configs/semgrep.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,24 @@ rules:
149149
(.setFeature "http://xml.org/sax/features/external-general-entities" false)
150150
...)
151151
severity: ERROR
152+
- id: bash.lang.correctness.unquoted-expansion.unquoted-variable-expansion-in-command
153+
languages:
154+
- bash
155+
message: Variable expansions must be double-quoted so as to prevent being split into multiple pieces according to whitespace or whichever separator is specified by the IFS variable. If you really wish to split the variable's contents, you may use a variable that starts with an underscore e.g. $_X instead of $X, and semgrep will ignore it. If what you need is an array, consider using a proper bash array.
156+
metadata:
157+
category: correctness
158+
technology:
159+
- bash
160+
patterns:
161+
- pattern-either:
162+
- pattern: |
163+
... ${$VAR} ...
164+
- pattern: |
165+
... ...${$VAR}... ...
166+
- metavariable-regex:
167+
metavariable: $VAR
168+
regex: '[*@0-9]|[A-Za-z].*'
169+
severity: INFO
152170
- id: clojure.lang.security.use-of-md5.use-of-md5
153171
languages:
154172
- clojure

plugins/tools/trivy/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: trivy
22
description: Trivy is a comprehensive security scanner for containers and other artifacts.
3-
default_version: 0.65.0
3+
default_version: 0.66.0
44
download:
55
url_template: "https://github.com/aquasecurity/trivy/releases/download/v{{.Version}}/trivy_{{.Version}}_{{.OS}}-{{.Arch}}.{{.Extension}}"
66
file_name_template: "trivy_{{.Version}}_{{.OS}}_{{.Arch}}"

plugins/tools/trivy/test/expected.sarif

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"text": "Package: brace-expansion\nInstalled Version: 1.1.11\nVulnerability CVE-2025-5889\nSeverity: LOW\nFixed Version: 2.0.2, 1.1.12, 3.0.1, 4.0.1\nLink: [CVE-2025-5889](https://avd.aquasec.com/nvd/cve-2025-5889)"
3535
},
3636
"ruleId": "CVE-2025-5889",
37-
"ruleIndex": 0
37+
"ruleIndex": 4
3838
},
3939
{
4040
"level": "error",
@@ -115,7 +115,7 @@
115115
"text": "Package: django\nInstalled Version: 1.11.29\nVulnerability CVE-2021-33203\nSeverity: MEDIUM\nFixed Version: 2.2.24, 3.1.12, 3.2.4\nLink: [CVE-2021-33203](https://avd.aquasec.com/nvd/cve-2021-33203)"
116116
},
117117
"ruleId": "CVE-2021-33203",
118-
"ruleIndex": 3
118+
"ruleIndex": 5
119119
},
120120
{
121121
"level": "warning",
@@ -142,7 +142,34 @@
142142
"text": "Package: django\nInstalled Version: 1.11.29\nVulnerability CVE-2024-45231\nSeverity: MEDIUM\nFixed Version: 5.1.1, 5.0.9, 4.2.16\nLink: [CVE-2024-45231](https://avd.aquasec.com/nvd/cve-2024-45231)"
143143
},
144144
"ruleId": "CVE-2024-45231",
145-
"ruleIndex": 4
145+
"ruleIndex": 6
146+
},
147+
{
148+
"level": "error",
149+
"locations": [
150+
{
151+
"message": {
152+
"text": "requirements.txt: django@1.11.29"
153+
},
154+
"physicalLocation": {
155+
"artifactLocation": {
156+
"uri": "requirements.txt",
157+
"uriBaseId": "ROOTPATH"
158+
},
159+
"region": {
160+
"endColumn": 1,
161+
"endLine": 1,
162+
"startColumn": 1,
163+
"startLine": 1
164+
}
165+
}
166+
}
167+
],
168+
"message": {
169+
"text": "Package: django\nInstalled Version: 1.11.29\nVulnerability CVE-2025-57833\nSeverity: HIGH\nFixed Version: 4.2.24, 5.1.12, 5.2.6\nLink: [CVE-2025-57833](https://avd.aquasec.com/nvd/cve-2025-57833)"
170+
},
171+
"ruleId": "CVE-2025-57833",
172+
"ruleIndex": 3
146173
},
147174
{
148175
"level": "warning",
@@ -178,10 +205,10 @@
178205
"informationUri": "https://github.com/aquasecurity/trivy",
179206
"name": "Trivy",
180207
"rules": null,
181-
"version": "0.65.0"
208+
"version": "0.66.0"
182209
}
183210
}
184211
}
185212
],
186213
"version": "2.1.0"
187-
}
214+
}

tools/semgrepConfigCreator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func FilterRulesFromFile(rulesData []byte, config []domain.PatternConfiguration)
3535
// Create a map of enabled pattern IDs for faster lookup
3636
enabledPatterns := make(map[string]bool)
3737
for _, pattern := range config {
38-
if pattern.Enabled && pattern.PatternDefinition.Enabled {
38+
if pattern.Enabled {
3939
// Extract rule ID from pattern ID
4040
parts := strings.SplitN(pattern.PatternDefinition.Id, "_", 2)
4141
if len(parts) == 2 {

tools/testdata/repositories/trivy/expected.sarif

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
}
3939
],
40-
"version": "0.65.0"
40+
"version": "0.66.0"
4141
}
4242
},
4343
"results": [

0 commit comments

Comments
 (0)