Skip to content

Believe this is an issue ... findings change with each scan of same SBOM  #2519

Closed

Description

@charbl

Current Behavior

So, we have a program using our Jenkins. They produce an SBOM using CycloneDX integrated into their build process. Actually, it's 3 SBOMS and then they use the ClycloneDX CLI to merge into one SBOM. Long story but they report the results into a parent project in DependencyTrack and we asked them to report the results into a child project. They did rerun the job and pointed to the child project. The rerun created an SBOM it was submitted to the child project. The child project reported diff results (components and vulnerabilities) ... this raised the question ... why? We ran the Jenkins job again (publishing to the child project) and the numbers changed again ... they started to align closer to the parent project numbers (still have not removed the parent analysis yet). We started to question the SBOM that were generated from the two different builds, we pulled them and did a compare .... identical aside from the metadata which had different serial numbers.

So, to really test this out, we created a dummy Jenkins job that just report the same SBOM to two different test jobs in DependencyTrack (two projects under parent project). Ran test for project one, sending over the SBOM to test project one and looked in DependencyTrack. The project one was now visible, and we compared the reported numbers to the original project ...
This is what we expected:
Components - 1749
Vulnerabilities: Crti: 11, High: 33, Med 28
Risk Score: 364

This is waht we got on first submission:
Components - 2498
Vulnerabilities: Crti: 23, High: 48, Med 37
Risk Score: 725

Now this was kind of shocking, we poked around and double checked settings and the SBOM diff.
We decided to run our test job and report to test job two .... here are the results we got:

This is waht we got on first submission:
Components - 2312
Vulnerabilities: Crti: 28, High: 43, Med 35
Risk Score: 745

Again, shocking that these two were different. And again, double check all .... same conclusion .... config looks good.
We then decided to run our two jobs and re-report the same SBOM to their DependencyTrack projects ... that already had data!

both runs now reported new numbers below for the second submission:

Job 1
Components - 1764
Vulnerabilities: Crti: 12, High: 35, Med 29
Risk Score: 387

Job 2

Components - 1754
Vulnerabilities: Crti: 11, High: 33, Med 28
Risk Score: 364

They pulled closer to the expected but still different .... I can't explain. Same SBOM ....

Thoughts? Have read all the documentation and are we doing something wrong?

Steps to Reproduce

  1. Create job in Jenkins and use the DepTrack plugin to publish SBOM (use Sync publish)
  2. Create another job in Jenkins and use the DepTrack plugin to publish SAME SBOM (use Sync publish)
  3. after success, log into Dependency Track and view findings
  4. you will note the findings .... we refreshed to ensure the background analysis was complete - We had two different results
  5. Re-run the two Jenkins jobs as is .... should be a republish of the same SBOM (use Sync publish)
  6. Again, go check DepTrack .... compare first results and you might be surprised to find them different

Expected Behavior

See above

Dependency-Track Version

4.7.1

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

RDS 13.7

Browser

Microsoft Edge

Checklist

Activity

  1. added
    defect
    on Feb 23, 2023
  2. rkg-mm commented on Feb 24, 2023

    @rkg-mm
    Contributor

    can you check if there is any error logged in the logfile after uploading (could be several minutes later as processing the content is asynchronous)? we saw similar stuff in #2131 when reuploading SBOMs to the same project. We fixed that in 4.7, but If the SBOM processing fails for your SBOM at some point that could be a reason.

  3. charbl commented on Feb 27, 2023

    @charbl
    Author

    The jobs we testes with had Synchronous turned on and all record successful.

    Here is the log for one of the jobs

    image

    All of them have same result in Jenkins

  4. rkg-mm commented on Feb 27, 2023

    @rkg-mm
    Contributor

    @charbl Those are Jenkins Logs, We would need the Dependency-Track logfiles.

    Also: After uploading the BOM it takes a while for it to process, in this time the amount of components will change several times as well, is it constant already when you check it?

  5. charbl commented on Feb 27, 2023

    @charbl
    Author

    as soon as I can get access, will check logs

  6. charbl commented on Feb 27, 2023

    @charbl
    Author

    see this when our job runs

    2023-02-27 18:24:13,172 INFO [BomUploadProcessingTask] Processing CycloneDX BOM uploaded to project: 3d127377-ffd6-4974-90dc-c58407cdc178
    2023-02-27 18:24:38,541 INFO [BomUploadProcessingTask] Identified 0 new components
    2023-02-27 18:24:38,541 INFO [BomUploadProcessingTask] Processing CycloneDX dependency graph for project: 3d127377-ffd6-4974-90dc-c58407cdc178
    2023-02-27 18:24:38,674 INFO [BomUploadProcessingTask] Processed 1767 components and 0 services uploaded to project 3d127377-ffd6-4974-90dc-c58407cdc178
    2023-02-27 18:24:38,675 INFO [RepositoryMetaAnalyzerTask] Performing component repository metadata analysis against 1767 components
    2023-02-27 18:24:38,704 ERROR [LoggableUncaughtExceptionHandler] An unknown error occurred in an asynchronous event or notification thread
    org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2023-02-25T21:54:15.762260036Z, (lock=NativeFSLock(path=/data/.dependency-track/index/servicecomponent/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],creationTime=2023-02-19T18:54:17.400019264Z))
    at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:191)
    at org.apache.lucene.store.LockValidatingDirectoryWrapper.syncMetaData(LockValidatingDirectoryWrapper.java:61)
    at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:802)
    at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:5084)
    at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3460)
    at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3770)
    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3728)
    at org.dependencytrack.search.IndexManager.commit(IndexManager.java:249)
    at org.dependencytrack.tasks.IndexTask.inform(IndexTask.java:65)
    at alpine.event.framework.BaseEventService.lambda$publish$0(BaseEventService.java:101)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
    2023-02-27 18:24:40,646 INFO [InternalAnalysisTask] Starting internal analysis task
    2023-02-27 18:24:40,646 INFO [InternalAnalysisTask] Analyzing 1767 component(s)
    [ec2-user@ip-10-101-0-241 ~]$

  7. charbl commented on Mar 1, 2023

    @charbl
    Author

    Any thoughts?

  8. charbl commented on Mar 10, 2023

    @charbl
    Author

    Any idea? Is this the issue?

  9. walterdeboer commented on Mar 11, 2023

    @walterdeboer
    Contributor

    Looks wrong to me. Any idea why "Underlying file changed by an external force"? Do you have two instances running at once? Or is it something in your SBOM? Maybe attach it to this issue?

  10. nscuro commented on Mar 11, 2023

    @nscuro
    Member

    The AlreadyClosedException is unrelated, but a fix will be shipped with 4.8.0. There's a workaround available that I mentioned here: #2379 (comment)

    I think the underlying issue is #2131, as pointed out by @rkg-mm. Until now there's only a workaround in place that prevents the SBOM processing to fail entirely, but the root cause is still unaddressed.

  11. charbl commented on Mar 14, 2023

    @charbl
    Author

    So, I redid our test and was watching logs. Did see the AlreadyClosedException on each BOM upload. Did capture the logs as each BOM was uploaded and processed. Will attach the document that has each log entries as the BOM was processed.
    Interesting was that both BOM's show same findings but both are wrong when compared to the original SBOM loaded. I have embeded screen captures of the tabs (in document) that show the numbers of the two test.

    this is the org (after all the number changing)
    image

    So, we are calling this a bug? Have a customer that is wanting answers to why the numbers are different for same SBOM and trying to answer them.

    DT-BASE.txt
    Could not imbed screen captures in doc so here are the two new results:

    SBOM 1
    image

    SBOM 2
    image

  12. rkg-mm commented on Mar 14, 2023

    @rkg-mm
    Contributor

    @charbl another shot: Does your BOM contain duplicates, in terms of multiple components with identical PURLs?
    On first upload all instances will be added, on following uploads some de-doubling happens due to the way existing components are identified, which may result in lower numbers too

  13. charbl commented on Mar 14, 2023

    @charbl
    Author

    would it be helpful if I uploaded an scrubbed copy of the SBOM? Masked the Application Name and some of the url paths related to local resolution.

  14. rkg-mm commented on Mar 14, 2023

    @rkg-mm
    Contributor

    @charbl yes, as long as PURLS remain the same. You can remove internal components (maybe double check if you can reproduce it in the end with the scrubbed BOM)

  15. 7 remaining items

  16. nscuro commented on Jul 5, 2023

    @nscuro
    Member

    Thinking about this more, I believe there are certain cases where one might want component identity matching to be "lax", e.g. when searching for components in the portfolio, and others where matching should be "strict", e.g. when importing BOMs.

    Any thoughts?

  17. rkg-mm commented on Jul 5, 2023

    @rkg-mm
    Contributor

    Import & Tree:
    If some of the "core" information really differs (e.g. PURL), I think it's fine to track it as 2 instances. Source needs to fix the data here. Deduplication only should trigger if the core information is really identical.
    I think changing a core information from an existing component is a very rare case.

    Search:
    For searching or similar I think the same logic would be fine. There might be rare cases where it would be nice to match them during search, but I don't think it's worth the effort

  18. melba-lopez commented on Jul 28, 2023

    @melba-lopez

    @nscuro has this been addressed per DependencyTrack/hyades-apiserver#218? and would this be a 4.10 potential fix?

  19. nscuro commented on Aug 2, 2023

    @nscuro
    Member

    @melba-lopez Yes, this should be fixed in the PR you linked (we have a regression test specifically for this issue). We're planning to backport it (and multiple other improvements we made for Hyades) to DT.

  20. added this to the 4.11 milestone on Jan 7, 2024
  21. github-actions commented on Mar 26, 2024

    @github-actions
    Contributor

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  22. locked as resolved and limited conversation to collaborators on Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

defectpending release

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions