Skip to content

Proper feedback on BOM upload #3379

Open

Description

@savek-cc

Current Behavior

When uploading a BOM via the v1/bom endpoint, the user is given a "#/definitions/BomUploadResponse" containing a token as response.
This token can then be used in order to query the current processing status via the v1/bom/token/{uuid} endpoint. It only gives a boolean result though - either the BOM is currently being processed - or it isn't.

When uploading a BOM, a lot of stuff can go wrong though - leading to either no project being created - or even incomplete projects within DependencyTrack without any feedback to the user about any of those error states. The only possibility to see that (and what) something went wrong is to look at the server logs - which aren't accessible to the user.
See issues for examples:
#3371
#3324
#3274
#3081
#2821
... and more.

Proposed Behavior

The v1/bom/token/{uuid} endpoint shall include information about any errors encountered during the processing of a BOM. This includes stuff like "wrong format" - but also any exception that happened during processing.

Checklist

Activity

  1. added
    enhancement
    on Jan 15, 2024
  2. changed the title [-]Propper feedback on BOM upload[/-] [+]Proper feedback on BOM upload[/+] on Jan 15, 2024
  3. nscuro commented on Jan 15, 2024

    @nscuro
    Member

    Related:

  4. added
    p2
    on Jan 15, 2024
  5. savek-cc commented on Jan 15, 2024

    @savek-cc
    Author

    That looks a lot like what we're currently trying to integrate...

  6. cmboling commented on Jan 19, 2024

    @cmboling

    Looking forward to #3218 as this will help me understand formatting issues of SBOMs 🚀

  7. savek-cc commented on Jan 19, 2024

    @savek-cc
    Author
  8. duderoot commented on Nov 15, 2026

    @duderoot

    Since the las commit there was a huge progress. So here is the

    Current Behavior

    Since #7127, GET /api/v1/bom/token/{uuid} and GET /api/v1/event/token/{uuid} return { processing, status } with PENDING / RUNNING / COMPLETED / FAILED. The frontend is starting to use this to show the processing state after an upload (DependencyTrack/frontend#FRONTEND_ISSUE). Three gaps remain that the frontend cannot fill on its own:

    • No failure reason. A FAILED status says nothing about why. Users who hit BOM upload fails without feedback due to field max length #1665 (field too long), BOM import fails silently when a purl contains non-ASCII characters (packageurl-java 1.5.0 corrupts percent-encoding, overflowing PURLCOORDINATES) #7314 (purl encoding) or a malformed file can only find the cause in the server log, which most of them cannot see.
    • No phase. One token covers two runs: the BOM import, then the project analysis (vulnerability analysis, policy evaluation, metrics). The status reports only the most recently started one. So clients cannot tell "components are being imported" from "components are in, analysis is running". They also cannot tell "analysis is waiting for a slot" (PENDING again after the import finished, because of the per-project analysis concurrency limit) from "the upload has not started yet". And when processing fails, they cannot tell whether the import or the analysis failed, which needs a different reaction from the user.
    • Status only by token. The token exists only in the client that uploaded the BOM. Users who open a project while a CI pipeline, a colleague or another browser has an upload processing see nothing. Most large BOMs arrive that way.

    Related: #1665, #3379, #2890, #5809, #7314.

    Proposed Behavior

    1. Phase and failure reason on the token response. Extend the existing response with two optional fields, following the pattern of #7127 (dedicated enums, no workflow internals):

    {
      "processing": false,
      "status": "FAILED",
      "phase": "IMPORTING",
      "failure": {
        "reason": "BOM_INVALID",
        "message": "Unexpected end of JSON input at line 48213"
      }
    }
    • phase: IMPORTING or ANALYZING, derived from which of the runs labelled with the token is current.
    • failure: a curated, user-facing reason and message, set where the BOM import and the analysis fail. Raw exception messages and stack traces would not be exposed. Reasons could be e.g. BOM_INVALID, BOM_PROCESSING or ANALYSIS. Examples of the message: "field publisher exceeds 255 characters" (BOM upload fails without feedback due to field max length #1665), or "unexpected end of JSON input".

    2. Processing status per project (REST API v2). An endpoint such as GET /api/v2/projects/{uuid}/bom-processing would return the status, phase, failure, start time and origin of the project's latest BOM upload. The runs are already labelled with the project UUID. It would follow portfolio access control like the other project endpoints.

    Questions

    1. For (1), extend the v1 token response as in Expose workflow run status on BOM token polling endpoint #7127, or add the fields only to a v2 resource?
    2. For (2), is a project-level endpoint the preferred shape, or should the status be part of the v2 project representation?
    3. Finished workflow runs are deleted after 1 day (dt.dex-engine.maintenance.run-retention-ms), so a failure is only visible for that long. Is that acceptable for now, or should the outcome of the latest import be persisted on the project (as asked in Failed parsing of file should be flagged in the project #2890)? Persisting it would mean a schema change.
    4. Should the curated failure message also be carried by the existing BOM_PROCESSING_FAILED notification?

    I'm happy to contribute (1) and (2) based on the answers.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions