fossas / fossa-cli

Fast, portable and reliable dependency analysis for any codebase. Supports license & vulnerability scanning for large monoliths. Language-agnostic; integrates with 20+ build systems.
https://fossa.com
Other
1.26k stars 173 forks source link

Fix: Treat issue summary targets optional #1422

Closed jssblck closed 4 months ago

jssblck commented 4 months ago

Overview

Companion PR to https://github.com/fossas/FOSSA/pull/12559, fixes https://fossa.atlassian.net/browse/ANE-1738 but in a different way.

Updates the issue summary datatype to treat targets as optional.

Note: I put this in "unreleased" because, since we're also doing the Core-side change, I don't think this is worth the time of going through the release process on its own, and can just go in the next release we perform.

Mostly I just integrated this change on this end for on-premise users and for completeness (if we consider it optional, we should consider it optional on the client side too).

Acceptance criteria

fossa test and fossa report are able to work on first-party-license-scanned builds, without the changes in the linked Core PR.

Testing plan

I tested manually against the current production version of FOSSA:

; fossa test -p {project} --revision {revision} --debug
[DEBUG] Loading configuration file from "/Users/jessica/projects/fossa-cli/"

Using project name: {project}
Using revision: {revision}

[DEBUG] [ Checking build completion for {revision}... ]
[DEBUG] [ Waiting for issue scan completion... ]
[DEBUG] An issue occurred

  *** Relevant Errors ***

      Error: An error occurred when deserializing a response from the FOSSA API:Error in $.summary: key "targets" not found

      Traceback:
        - Calling FOSSA API

[ERROR] An issue occurred

  *** Relevant Errors ***

      Error: An error occurred when deserializing a response from the FOSSA API:Error in $.summary: key "targets" not found

After this change:

; cabal run fossa -- test -p {project} --revision {revision} --debug
[DEBUG] Loading configuration file from "/Users/jessica/projects/fossa-cli/"

Using project name: `{project}`
Using revision: `{revision}`

[DEBUG] [ Checking build completion for {revision}... ]
[DEBUG] [ Waiting for issue scan completion... ]
[DEBUG]

[ERROR]

  ========================================================================
  Tested Following Project:
  ========================================================================

  Project Title: {project}
  Project Revision: {revision}
  Project Visibility: public

  COMPLIANCE ISSUES (Total 4)

  ========================================================================
  Flagged by Policy (Total 4)
  ========================================================================
  { ... omitted project specific details ... }

[DEBUG] An issue occurred

  *** Relevant Errors ***

      Error: The scan has revealed issues. Number of issues found: 4

      Traceback:
        (none)

[ERROR] An issue occurred

  *** Relevant Errors ***

      Error: The scan has revealed issues. Number of issues found: 4

Risks

None

Metrics

None

References

Fixes https://fossa.atlassian.net/browse/ANE-1738

Checklist