Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] Wrong date is assigned to creation of SPDX result #54

Open
bsoroushian opened this issue Jan 30, 2024 · 0 comments
Open

[🐛] Wrong date is assigned to creation of SPDX result #54

bsoroushian opened this issue Jan 30, 2024 · 0 comments

Comments

@bsoroushian
Copy link

  • node -v: v21.6.1
  • npm -v: 10.2.4
  • OS: (e.g. OSX, Linux, Windows, ...) MacOS
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant