philips-software / blackduck-report-action Goto Github PK
View Code? Open in Web Editor NEWGitHub action to produce a SBOM report from a given Black Duck project
License: MIT License
GitHub action to produce a SBOM report from a given Black Duck project
License: MIT License
The sbom_type
argument is not supported yet.
Now it always generates an SPDX_22 report.
sbomType "SPDX_22" allows reportFormat values of "JSON", "RDF", "TAGVALUE" or "YAML".
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).
./get-blackduck-report.sh https://blackduck.philips.com <MY-BD-TOKEN> "CCoE_connectivity application sdk" "release/28.0.0.0"
==============================================================
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 .
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
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?
./get-blackduck-report.sh https://blackduck.philips.com <MY-BD-TOKEN> "CCoE_connectivity application sdk" "release/28.0.0.0"
==============================================================
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"}
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 an example of storing the report in the right place.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.