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

fix: Add invocation startTime and endTime to SARIF output #8255

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anupamme
Copy link

@anupamme anupamme commented Jan 20, 2025

Fixes #3226

Add invocation startTimeUtc and endTimeUtc properties to SARIF output report.

  • pkg/report/sarif.go

    • Import time package.
    • Add StartTime and EndTime fields to SarifWriter struct.
    • Set startTimeUtc and endTimeUtc properties in the Write method.
  • pkg/report/writer.go

    • Import time package.
    • Add StartTime and EndTime fields to SarifWriter initialization in the Write method.
  • pkg/report/sarif_test.go

    • Add test TestSarifWriter_Write_WithInvocationTimes to verify startTimeUtc and endTimeUtc properties in SARIF report.
    • Ensure test covers various scenarios for startTimeUtc and endTimeUtc.

For more details, open the Copilot Workspace session.

Fixes aquasecurity#3226

Add invocation `startTimeUtc` and `endTimeUtc` properties to SARIF output report.

* **pkg/report/sarif.go**
  - Import `time` package.
  - Add `StartTime` and `EndTime` fields to `SarifWriter` struct.
  - Set `startTimeUtc` and `endTimeUtc` properties in the `Write` method.

* **pkg/report/writer.go**
  - Import `time` package.
  - Add `StartTime` and `EndTime` fields to `SarifWriter` initialization in the `Write` method.

* **pkg/report/sarif_test.go**
  - Add test `TestSarifWriter_Write_WithInvocationTimes` to verify `startTimeUtc` and `endTimeUtc` properties in SARIF report.
  - Ensure test covers various scenarios for `startTimeUtc` and `endTimeUtc`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/aquasecurity/trivy/issues/3226?shareId=XXXX-XXXX-XXXX-XXXX).
@anupamme anupamme requested a review from knqyf263 as a code owner January 20, 2025 04:49
…in Options struct - to fix integration tests
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ anupamme
❌ Anupam Mediratta


Anupam Mediratta seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@knqyf263
Copy link
Collaborator

Hi @anupamme, thanks for your contribution. It looks like you added a commit authored by another email address, which leads to CLA failure. Can you please re-commit it with the correct address or sign the CLA with the address as well?

CleanShot 2025-01-21 at 11 39 40

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

Successfully merging this pull request may close these issues.

Including invocation startTime and endTime in SARIF output
3 participants