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

feat(general): In toto output format #6488

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

Conversation

SaraWeinberg1234
Copy link
Contributor

@SaraWeinberg1234 SaraWeinberg1234 commented Jun 24, 2024

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

in-toto Attestation

fixes: #6208

Description

Added output of in-toto Attestation format

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@matansha
Copy link
Contributor

Hi @SaraWeinberg1234, Thanks for your contribution, please add some tests

@SaraWeinberg1234 SaraWeinberg1234 changed the title In toto output format feat(general): In toto output format Jul 15, 2024
@ChanochShayner
Copy link
Contributor

Looks good to me!
@tsmithv11 Could you please review it?
Thx.

Copy link
Collaborator

@tsmithv11 tsmithv11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good start, but a lot of fields are hard-coded but shouldn't be and there are more fields that could be used.

{
"name": "",
"digest": {
"sha256": "fe4fe40ac7250263c5dbe1cf3138912f3f416140aa248637a60d65fe22c47da4"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be calculated not static

for check in report.failed_checks:
in_toto_data["predicate"]["invocation"]["uri"] = "https://github.com/developer-guy/alpine/actions/runs/1071875574"
in_toto_data["predicate"]["invocation"]["event_id"] = "1071875574"
in_toto_data["predicate"]["invocation"]["builder.id"] = "GitHub Actions"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be based on the use of Checkov not static


for report in self.reports:
for check in report.failed_checks:
in_toto_data["predicate"]["invocation"]["uri"] = "https://github.com/developer-guy/alpine/actions/runs/1071875574"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should not be static

in_toto_data["predicate"]["invocation"]["uri"] = "https://github.com/developer-guy/alpine/actions/runs/1071875574"
in_toto_data["predicate"]["invocation"]["event_id"] = "1071875574"
in_toto_data["predicate"]["invocation"]["builder.id"] = "GitHub Actions"
in_toto_data["predicate"]["scanner"]["uri"] = "pkg:github/aquasecurity/trivy@244fd47e07d1004f0aed9"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Checkov not Trivy and the version should not be static

"id": check.check_id,
"severity": [
{
"method": "nvd",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"method": "nvd",
"method": "vendor",

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.

in-toto Attestation Framework Output
4 participants