Repository navigation
Description
Summary
When a scan has both bom.include and bom.ignore rules, ScanApi.scan() silently drops the ignore rules. The include block overwrites the assets and type form fields, so the API receives type=identify and the blacklist never reaches the engine.
Reported downstream in scanoss/engine#120 (ORT Server ignore PURLs not taken into account).
Where
src/main/java/com/scanoss/rest/ScanApi.java, scan() (v0.13.1):
if (settings != null && !settings.getBom().getIgnore().isEmpty()) {
...
data.put("assets", JsonUtils.toJson(legacyIgnore));
data.put("type", "blacklist");
}
if (settings != null && !settings.getBom().getInclude().isEmpty()) {
...
data.put("assets", JsonUtils.toJson(legacyInclude)); // overwrites the ignore assets
data.put("type", "identify"); // overwrites "blacklist"
}Ignore rules are not applied anywhere else. ScannerPostProcessor only handles remove and replace.
Impact
ORT's ScanOSS plugin always adds context.coveredPackages (and ORIGINAL_FINDING snippet choices) as include rules (ScanOss.buildSettings()). As a result, ignorePurls configured in ORT / ORT Server usually has no effect. The client logs ignore rules detected. Converting to legacy rules ... and then include rules detected ..., which hides the problem.
Reproduction
Engine 5.4.27 with the two X-Road files from engine#120:
| Engine args | Result |
|---|---|
-s include.json (what the API receives today when include + ignore are set) |
match pkg:golang/github.com/nordic-institute/x-road |
-b ignore.json |
none |
-s include.json -b ignore.json |
none |
The engine supports -s and -b together, but the API only accepts one assets + type pair per request. The bug is in the client, which overwrites the ignore list instead of handling both.
Proposed fix (client side, no API change needed)
When both include and ignore rules are present:
- keep sending the include list to the server (
type=identify), and - apply the ignore rules locally in
ScannerPostProcessor: drop results whose PURL matches an ignore rule, the same wayremoverules are applied today.
If only ignore rules are present, keep sending them as type=blacklist as today. At minimum, never drop a list silently: log a warning.
Optional, longer term: once the API accepts both lists in one request (scanoss/api.go#80), the client could send both and let the engine apply them (-s + -b).
Side note (same method)
addScanSettingsHeader(headers) is called after this.headers has been copied into postHeaders. The scanoss-settings header is therefore missing from the first request and only sent from the second request onwards, because it stays in this.headers. It should be added to postHeaders.
Activity
sschuberth commentedon Oct 20, 2026
Interesting, but out of curiosity, how does that explain that the first specified ignore rule does seem to be taken into account?