Skip to content

Secord ignore rule with a PURL not taken into account when snippet-matching an Open Source project #120

Closed

Description

@sschuberth

Hi @mscasso-scanoss! As discussed, here's the summary of the issue in written form:

We are using ORT Server to run snippet scans via SCANOSS. When scanning the https://github.com/nordic-institute/X-Road Open Source project ( the develop branch), we get several snippet findings that point to the X-Road project itself, which we'd like to filter out / ignore, in order to only get snippet findings from third-party projects.

One of the findings we get is for the file deployment/security-server/images/base-images/auxiliary-service/files/usr/share/xroad/scripts/containerised/autobackup.sh, which in line 12-18 contains code from src/packages/src/xroad/common/proxy/usr/share/xroad/scripts/get_security_server_id.sh in the same project:

Image

To filter out such findings, we are adding the PURL pkg:github/nordic-institute/x-road to the ignore rules of the SCANOSS Java client API. That works for this first PURL, but a new scan still shows findings from the X-Road project, this time e.g. for deployment/central-server/k8s/charts/central-server/templates/_configmap.tpl, which now is a full-file match:

Image

So we are adding a second PURL pkg:golang/github.com/nordic-institute/x-road to the list of PURLs to ignore, but this time adding that PURL has no effect, we still get the same number of snippet findings.

To verify that the PURLs are correctly passed from the ORT Server UI to the SCANOSS API Java client, I've checked the logs, and it seem that the PURL to ignore do get recognized:

time=2026-10-13T18:14:33.193 thread=virtual-274 traceId=e5c26006-a514-4c3f-bc7f-2ff777741c89 ortRunId=2107 component=scanner-worker scannerJobId=1417 level=INFO  logger=com.scanoss.rest.ScanApi message="ignore rules detected. Converting to legacy rules {\"components\":[{\"purl\":\"pkg:github/nordic-institute/x-road\"},{\"purl\":\"pkg:golang/github.com/nordic-institute/x-road\"}]}"

Could you please investigate if this could be a bug on the SCANOSS side? Thanks in advance!

Activity

  1. mscasso-scanoss commented on Oct 23, 2026

    @mscasso-scanoss
    Contributor

    Hi @sschuberth, thanks for the detailed report. We tried to reproduce it, but on our side the second ignore rule works as expected, both in the engine and in the SCANOSS Java client.

    What we tested

    We used the develop branch of X-Road (e98798e; both files you mentioned are unchanged since well before your scan) against our production API, with the same ignore rules as in your log:

    • pkg:github/nordic-institute/x-road
    • pkg:golang/github.com/nordic-institute/x-road

    We scanned through the engine directly, through scanoss-py, and through scanoss-java 0.13.1. For the Java client we built the settings the same way ORT's ScanOss.buildSettings() does.

    Unmodified, both files are full-file matches. Your first example was a snippet match, so we also forced snippet matching by adding a comment line at the top of every file. That changes the file hash, so the engine has to resolve the files through snippets. In both cases the ignore rules work:

    Files Ignored PURLs autobackup.sh _configmap.tpl
    unmodified none file → pkg:golang/…/x-road file → pkg:golang/…/x-road
    unmodified GitHub only file → pkg:golang/…/x-road file → pkg:golang/…/x-road
    unmodified both none none
    modified (snippets) none snippet, lines 6-26 → pkg:golang/…/x-road none
    modified (snippets) GitHub only snippet, lines 6-26 → pkg:golang/…/x-road none
    modified (snippets) both none none

    (_configmap.tpl is too small to produce a snippet match once modified.)

    We got the same result for the whole repository (about 5,450 files) against production:

    Ignored PURLs Findings (unmodified) Findings (modified → snippets)
    none 5183 4676
    GitHub only 5178 4593
    both 354 469

    The remaining findings point to older copies and forks of X-Road, such as pkg:github/ria-ee/x-road (the original repository), pkg:github/rrojasintexus/xroad-co and pkg:github/bthj/x-road. You may want to add those to the ignore list as well.

    Since we can't reproduce it, our guess is that the ignore list didn't reach the API in your second run. One possible cause is scanoss/scanoss.java#47: if the scan settings also contain include rules (in ORT these come from snippet choices with reason ORIGINAL_FINDING), the client drops the ignore rules entirely. To narrow it down, could you share:

    1. whether the ignore rules detected ... log line in that run is followed by include rules detected. Converting to legacy rules ...;
    2. whether the repository configuration has any snippet choices;
    3. the ORT Server / ORT and scanoss-java versions;
    4. the raw result (or at least the PURLs) of the findings that remain after adding the second rule, e.g. for _configmap.tpl.
  2. sschuberth commented on Oct 23, 2026

    @sschuberth
    Author

    Thanks for the testing. I meanwhile got reports from @willebra that it also started to work on our side, and we were assuming that you did some fixes on your end. Can you confirm @willebra?

  3. willebra commented on Oct 25, 2026

    @willebra

    Thanks @mscasso-scanoss for the thorough reproduction. Yes, I can confirm that the ignore rules work on our side now, but they did not on October 13/14, with identical input on our side.

    I've used my AI agent to collect data:

    Before and after

    All runs scan X-Road develop through ORT Server with the SCANOSS plugin as a project scanner, chosenSnippetModel: LICENSE_AND_COPYRIGHT_FINDING,SNIPPET_FINDING.

    ORT run Date ORT Server / ORT ignorePurls Snippet findings Matches to pkg:github/nordic-institute/x-road
    2113 2026-10-14 0.95.1-RC.023 / 96.0.0 pkg:golang/github.com/nordic-institute/x-road, pkg:github/nordic-institute/x-road 1024 1013
    2187 2026-10-22 0.97.0-RC.036 / 97.0.0 same two 24 0
    2190 2026-10-22 0.97.0-RC.036 / 97.0.0 same two 25 0
    2194 2026-10-22 0.98.0-RC.044 / 97.1.0 + pkg:github/ria-ee/x-road, pkg:github/bthj/x-road, pkg:github/rrojasintexus/xroad-co 23 0
    2208 2026-10-25 0.98.0-RC.061 / 97.2.0 + pkg:github/andcolombia/xroad-co 9 0

    Note that in run 2113 even the GitHub PURL, the first rule, had no effect: 1013 of the 1024 findings had pkg:github/nordic-institute/x-road as their primary PURL.

    Answers to your questions

    1. Log lines. Each of the runs above logs ignore rules detected. Converting to legacy rules {...} with the configured PURLs, and none logs include rules detected. Ignore list was sent as type=blacklist.
    2. Snippet choices. The X-Road .ort.yml has no snippet_choices. Also, for project scans ORT runs SCANOSS as a path scanner whose ScanContext has no coveredPackages, so ScanOss.buildSettings() produces no include rules at all.
    3. Versions. See the table. scanoss-java is 0.13.1 in ORT 96.0.0 through 97.2.0, and the SCANOSS plugin code (buildSettings(), the ignorePurls option) is unchanged in that range.
    4. Remaining findings. For run 2113, 1013 findings matched pkg:github/nordic-institute/x-road, 918 of them full-file matches. The remaining 11 were third-party (eclipse-edc, BouncyCastle, etcd-io/jetcd, jonapoul/atlas-gradle-plugin).

    Since the client sent the same request in runs 2113 and 2187, our assumption is that something changed on the API / engine / knowledge base side between October 14 and 22. Can you confirm whether anything was deployed in that window? That would help us document which behavior to expect.

    Follow-up: ignoring forks one at a time

    As you suggested, we added pkg:github/ria-ee/x-road, pkg:github/bthj/x-road and pkg:github/rrojasintexus/xroad-co (run 2194). Those three PURLs disappeared, but 10 of the 12 files they matched were then attributed to yet another fork, pkg:github/andcolombia/xroad-co:

    File in X-Road Run 2190 Run 2194
    src/common/common-admin-api/.../audit/RestApiAuditEvent.java:4-214 rrojasintexus/xroad-co andcolombia/xroad-co (98%)
    src/common/common-admin-api/.../audit/AuditEventLoggingFacadeImpl.java:4-252 rrojasintexus/xroad-co andcolombia/xroad-co (98%)
    src/common/common-core/.../util/MimeUtils.java:5-172 rrojasintexus/xroad-co andcolombia/xroad-co (97%)
    src/common/common-message/.../util/HttpSender.java:5-155 rrojasintexus/xroad-co andcolombia/xroad-co (96%)
    src/lib/globalconf-core/.../util/FISubjectClientIdDecoder.java:4-156 rrojasintexus/xroad-co andcolombia/xroad-co (97%)
    src/security-server/admin-service/.../service/ServiceService.java:6-277 rrojasintexus/xroad-co andcolombia/xroad-co (97%)
    src/security-server/admin-service/ui/src/global.ts:5-229 rrojasintexus/xroad-co andcolombia/xroad-co (97%)
    src/service/proxy/proxy-core/.../ProxyMonitorServiceHandlerImpl.java ria-ee/x-road andcolombia/xroad-co (97%)
    src/service/message-log-archiver/scripts/demo-upload.pl (full file) ria-ee/x-road, MIT andcolombia/xroad-co, NOASSERTION
    src/service/proxy/proxy-dsp-core/.../AgreementGrant.java:4-8 bthj/x-road andcolombia/xroad-co (9%)
    src/security-server/admin-service/.../service/ClientService.java:5-1060 bthj/x-road no match
    src/service/proxy/proxy-monitoring-api/src/main/resources/monitoring.wsdl (full file) ria-ee/x-road no match

    The upstream paths in the forks use X-Road's older layout, e.g. RestApiAuditEvent.java matches src/proxy-ui-api/src/main/java/org/niis/xroad/restapi/config/audit/RestApiAuditEvent.java in andcolombia/XROAD-CO. (The X-Road revisions differ slightly between the runs since develop moved, but the matched files and line ranges are nearly identical.)

    Adding pkg:github/andcolombia/xroad-co as well (run 2208) removed all 10 of its matches, and this time no other fork took over. So for X-Road it took one run per fork, four forks in total, to get rid of the self-matches. For a project with many forks, ignoring by PURL becomes a trial-and-error loop, since each ignored component can be replaced by the next-ranked copy of the same file. Questions:

    1. Is this fallback to the next-ranked component the intended semantics of ignore?
    2. Is there a way to ignore by origin rather than by component? For example: drop a match if the matched file (by file hash or URL hash) also exists in an ignored component, or treat forks of an ignored GitHub repository as ignored.
    3. Why are these files attributed to forks rather than to pkg:github/nordic-institute/x-road itself, which contains the same code? Would declaring X-Road as an included (identify) component help, and is that compatible with ignore rules once Ignore rules are silently dropped when include rules are also present scanoss.java#47 is fixed?
    4. For demo-upload.pl, the same full-file match reports MIT under ria-ee/x-road and NOASSERTION under andcolombia/xroad-co. Is the reported license that of the component rather than the file?

    Third-party matches also changed between October 22 and 25

    Between runs 2194 and 2208, matches to components that are not on the ignore list also changed, for files that are unchanged in X-Road between the two scanned revisions (67046f6c and 38cd99ec). Our side was unchanged as well: same SCANOSS options apart from the added fork, scanoss-java 0.13.1, no SCANOSS plugin changes between ORT 97.1.0 and 97.2.0, and the log again shows only the ignore rules and no include rules.

    File in X-Road (unchanged) Run 2194 (Oct 22) Run 2208 (Oct 25)
    src/service/ds-identity-hub/.../provisioning/ParticipantCredentialRecordsPurger.java:30-98 pkg:maven/org.eclipse.edc/identity-hub-credentials-store-sql, Apache-2.0, 69% (SqlCredentialStore.java:18-86) no match
    src/lib/rpc-core/.../rpc/client/DeadlineInterceptor.java:31-34 pkg:golang/github.com/etcd-io/jetcd, 5% no match
    src/service/ds-control-plane/.../policy/PolicySubjectMatcher.java:31-36 pkg:maven/org.eclipse.edc/policy-engine-lib, 5% no match
    src/service/ds-control-plane/.../provisioning/ParticipantContextConfigDeleter.java:32-36 pkg:maven/org.eclipse.edc/identity-hub-keypair-store-sql, 5% no match
    src/common/common-core/.../util/X500Names.java pkg:maven/org.bouncycastle/bcprov-jdk14, LicenseRef-scanoss-bouncy-castle-licence-10684, 18%, lines 31-36 and 75-86 pkg:github/bcgit/bc-java, MIT, 20%, lines 29-36 and 75-86

    The eclipse-edc matches to other files (ReusableAgreementLookup.java, ConsumerDataFlowCompletionListener.java, RecordingEdcHttpClient.java, the ServiceExtension file) and build.gradle.kts → jonapoul/atlas-gradle-plugin are unchanged.

    Did something change in the engine, ranking or knowledge base between October 22 and 25 that explains why it is no longer reported? Or could the added ignore rule for pkg:github/andcolombia/xroad-co affect matches to unrelated components?

  4. mscasso-scanoss commented on Oct 28, 2026

    @mscasso-scanoss
    Contributor

    Hi @sschuberth, a follow-up on the ignore feature: we changed how the engine applies the ignore list. The change is released in engine v5.4.28 (#126).

    What changed

    1. Related PURLs are now honored. Until now, an ignore rule was only compared against the primary PURL of each matched URL record. A project indexed under several PURLs, like X-Road (pkg:github/nordic-institute/x-road and pkg:golang/github.com/nordic-institute/x-road), only gets its other PURLs at report time, so ignoring one of those related PURLs had no effect. The engine now drops a candidate component if its primary or any related PURL is in the ignore list, before choosing the best match.
    2. Snippet fallback when a full-file match is fully ignored. If a file was a full-file match and every candidate component was removed by the ignore list, the result collapsed to none. The engine now retries that file once as a snippet scan, honoring the same ignore list, so a legitimate third-party snippet match can still show up.

    Both changes only apply when an ignore list is sent; scans without one are unaffected.

    What this means for your ignore rules

    • One rule per project is enough: ignoring any of its PURLs suppresses the whole component, including its related PURLs.
    • Ignoring still works per component, not per origin. When a component is ignored, the engine falls back to the next-ranked candidate for that file, so forks and older copies (such as pkg:github/ria-ee/x-road or pkg:github/andcolombia/xroad-co) can still show up and need their own rules.

    Let us know if you see anything unexpected with the new behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions