Command run: snyk test --json | snyk2spdx --output=spdx.json
Expected behaviour
A valid date be attributed to the resulting SPDX report
Actual behaviour
An Invalid date with month 0 was assigned to the SPDX report
Steps to reproduce
Scan any arbitrary image and convert its result using snyk2spdx.
Debug log
{
"id": "SPDXRef-docker-image|dev....",
"specVersion": "SPDX-3.0",
"creator": "Organization: Snyk Ltd",
"created": "2024-00-02T20:01:35Z",
"profile": [
"base",
"vulnerabilities"
],
"description": "Snyk test result for project docker-image|dev.registry....-my-apps in SPDX SBOM format",
The function getDate() in generate-date.ts uses d.getMonth().toString() which is converting a zero-based number to string therefore in January date is zero. The day also would be wrong since d.getDay() will return a number between 0 and 6 (0 for Sunday and 6 for Saturday). Alternative would be to use date.toISOString().
Screenshots
If applicable, add screenshots to help explain your problem.
node -v
: v21.6.1npm -v
: 10.2.4Expected behaviour
A valid date be attributed to the resulting SPDX report
Actual behaviour
An Invalid date with month 0 was assigned to the SPDX report
Steps to reproduce
Scan any arbitrary image and convert its result using snyk2spdx.
Debug log
The function
getDate()
in generate-date.ts usesd.getMonth().toString()
which is converting a zero-based number to string therefore in January date is zero. The day also would be wrong since d.getDay() will return a number between 0 and 6 (0 for Sunday and 6 for Saturday). Alternative would be to usedate.toISOString()
.Screenshots
If applicable, add screenshots to help explain your problem.