Skip to content

Commit f740447

Browse files
chore(fp): use more conservative CPE 22 prefix suppression syntax to avoid false negatives (#8509)
Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com> Co-authored-by: Jeremy Long <jeremy.long@gmail.com>
1 parent 3904c96 commit f740447

2 files changed

Lines changed: 727 additions & 707 deletions

File tree

.github/workflows/false-positive-ops.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ jobs:
171171
}
172172
purl += '@.*$';
173173
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
174-
var matchCpe;
174+
var cpe22UriPrefix;
175175
if (cpe[1] == '2.3') {
176-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
176+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
177177
} else {
178-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
178+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
179179
}
180180
181181
await github.rest.issues.createComment({
@@ -189,7 +189,7 @@ jobs:
189189
' FP per issue #' + context.issue.number + '\n' +
190190
' ]]></notes>\n' +
191191
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
192-
' <cpe>' + matchcpe + '</cpe>\n' +
192+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
193193
'</suppress>\n```\n\n' +
194194
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
195195
})
@@ -218,11 +218,11 @@ jobs:
218218
purl += '@.*$';
219219
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
220220
console.log(cpe);
221-
var matchCpe;
221+
var cpe22UriPrefix;
222222
if (cpe[1] == '2.3') {
223-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
223+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
224224
} else {
225-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
225+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
226226
}
227227
228228
await github.rest.issues.createComment({
@@ -236,7 +236,7 @@ jobs:
236236
' FP per issue #' + context.issue.number + '\n' +
237237
' ]]></notes>\n' +
238238
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
239-
' <cpe>' + matchcpe + '</cpe>\n' +
239+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
240240
'</suppress>\n```\n\n' +
241241
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
242242
})
@@ -264,11 +264,11 @@ jobs:
264264
}
265265
purl += '@.*$';
266266
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
267-
var matchCpe;
267+
var cpe22UriPrefix;
268268
if (cpe[1] == '2.3') {
269-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
269+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
270270
} else {
271-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
271+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
272272
}
273273
274274
await github.rest.issues.createComment({
@@ -282,7 +282,7 @@ jobs:
282282
' FP per issue #' + context.issue.number + '\n' +
283283
' ]]></notes>\n' +
284284
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
285-
' <cpe>' + matchcpe + '</cpe>\n' +
285+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
286286
'</suppress>\n```\n\n' +
287287
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
288288
})

0 commit comments

Comments
 (0)