Code Monkey home page Code Monkey logo

blackduck-report-action's People

Contributors

bartgolsteijn avatar brend-smits avatar jeroenknoops avatar manjulasuryabhatla avatar phirk avatar rjaegers avatar ruijzndl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

blackduck-report-action's Issues

Script does not properly inform about report_status when that is not "COMPLETED".

While most of my attempts to use the get-blackduck-report.sh script failed due to 403 errors (see #19) one run went further, but still failed and did not properly output the report status (shows an empty string instead).

Command

./get-blackduck-report.sh https://blackduck.philips.com <MY-BD-TOKEN> "CCoE_connectivity application sdk" "release/28.0.0.0"

Output

==============================================================
                  Create Black Duck Report
==============================================================

INFO: No report-format supplied. Defaulting to JSON report-format
./get-blackduck-report.sh: line 163: [: missing `]'
./get-blackduck-report.sh: line 163: sbom_type: command not found
+ getting bearer
| got bearer

+ getting project api base url for project: CCoE_connectivity application sdk
| got project api base url: https://blackduck.philips.com/api/projects/1e398092-8fa5-4766-ade0-668a4353e9dc

+ getting version api base url
| got version api base url: VERSIONS:
https://blackduck.philips.com/api/projects/1e398092-8fa5-4766-ade0-668a4353e9dc/versions/4c06eb22-7015-4ae3-b4f8-94e29b4ace13

+ creating SBOM report
| triggered creating SBOM report

+ getting SBOM report api base url
| attempt 1 of 50 to get SDPX report
| - report_status:
 ERROR: report_status is not COMPLETED, it is .

Getting errors even after added project name and version name in the workflow

Originally posted by @HiteshDevaram-Philips in philips-labs/blackduck-scanner-action#13


Hi,

Thanks for your action but i am getting few errors even after adding project name and version name from Blackduck.
Here are the errors i got it when i execute my workflow:
i have passed my details as:

       blackduck-url: https://blackduck.my-company.com/
       blackduck-token: ${{ secrets.BLACKDUCK_TOKEN_HTH }}
       project: project-name
       version: version

and the errors are:

+ getting project api base url
/get-blackduck-report.sh: line 34: [: null: integer expression expected
| got project api base url: null

+ getting version api base url
/get-blackduck-report.sh: line 46: [: -eq: unary operator expected
| got version api base url: 

+ creating SBOM report
| triggered creating SBOM report

+ getting SBOM report api base url
| attempt 1 of 50 to get SDPX report
 ERROR: report_status is not COMPLETED, it is .
| - report_status: 
##[debug]Docker Action run completed with exit code 1

Many attempts result in 403 Forbidden; only one single attempt passed (with the same token!)

This might just be a Black Duck server issue, but when trying to execute the get-blackduck-report.sh script almost all attempts failed with error 403 Forbidden.

However, one single attempt with the same Black Duck access token (with read only access) did not result in error 403.

What can be wrong?

Command

./get-blackduck-report.sh https://blackduck.philips.com <MY-BD-TOKEN> "CCoE_connectivity application sdk" "release/28.0.0.0"

Output

==============================================================
                  Create Black Duck Report
==============================================================

INFO: No report-format supplied. Defaulting to JSON report-format
./get-blackduck-report.sh: line 161: [: missing `]'
./get-blackduck-report.sh: line 161: sbom_type: command not found
+ getting bearer
| got bearer

+ getting project api base url for project: CCoE_connectivity application sdk
| got project api base url: https://blackduck.philips.com/api/projects/1e398092-8fa5-4766-ade0-668a4353e9dc

+ getting version api base url
| got version api base url: https://blackduck.philips.com/api/projects/1e398092-8fa5-4766-ade0-668a4353e9dc/versions/4c06eb22-7015-4ae3-b4f8-94e29b4ace13

+ creating SBOM report
ERROR: error in creating sbom report
{"timestamp":"2023-09-15T09:37:31.506Z","status":403,"error":"Forbidden","message":"Forbidden","path":"/api/projects/1e398092-8fa5-4766-ade0-668a4353e9dc/versions/4c06eb22-7015-4ae3-b4f8-94e29b4ace13/sbom-reports"}

Fix shellcheck issues

Please fix all shellcheck issues:

โžœ shellcheck get-blackduck-report.sh

In get-blackduck-report.sh line 161:
if [ sbom_type == "CYCLONEDX_13" || sbom_type == "CYCLONEDX_14" ]
               ^-- SC2050 (warning): This expression is constant. Did you forget the $ on a variable?
                                 ^-- SC2109 (error): Instead of [ a || b ], use [ a ] || [ b ].
                                              ^-- SC2050 (warning): This expression is constant. Did you forget the $ on a variable?


In get-blackduck-report.sh line 163:
  echo "INFO: sbomType "CYCLONEDX_13" or "CYCLONEDX_14" allows reportFormat values of "JSON"."
                        ^----------^ SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
                                          ^----------^ SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
                                                                                       ^--^ SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?


In get-blackduck-report.sh line 210:
echo "sbom-file=report.zip" >> $GITHUB_OUTPUT
                               ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "sbom-file=report.zip" >> "$GITHUB_OUTPUT"


In get-blackduck-report.sh line 211:
echo "sbom-contents=${report_contents}" >> $GITHUB_OUTPUT
                                           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "sbom-contents=${report_contents}" >> "$GITHUB_OUTPUT"

For more information:
  https://www.shellcheck.net/wiki/SC2109 -- Instead of [ a || b ], use [ a ] ...
  https://www.shellcheck.net/wiki/SC2050 -- This expression is constant. Did ...
  https://www.shellcheck.net/wiki/SC2140 -- Word is of the form "A"B"C" (B in...

In particular SC2050 on line 161 looks like a real bug (2x).

Add example of storing the report

Add an example of storing the report in the right place.

Background

The Software-Bill-of-Material is a part of the complete Secure Software Supply Chain together with things like a provenance file.
In order to fetch the SBOM of any used package, there is a convention were to put the files. An OCI can be used for example. (See this blog.)

It would be nice to include an example in this repository how to use this end-to-end in a build-pipeline.

Self signed certificates are not authenticated

The existing github action fails to authenticate against self signed certificates and ends with the following failure.

+ getting bearer
ERROR: No bearer token found
| got bearer

+ getting project api base url for project: ***
/get-blackduck-report.sh: line 34: [: null: integer expression expected
| got project api base url: null

+ getting version api base url
/get-blackduck-report.sh: line 46: [: : integer expression expected
| got version api base url: 

+ creating SBOM report
| triggered creating SBOM report

+ getting SBOM report api base url
| attempt 1 of 50 to get SDPX report
 ERROR: report_status is not COMPLETED, it is .
| - report_status: 

Would it be possible update,

Replace all curl commands in get-blackduck-report.sh

curl  --silent

by

curl -k --silent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.