-
Notifications
You must be signed in to change notification settings - Fork 510
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
✨ Support results output as in-toto statement #4491
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4491 +/- ##
==========================================
+ Coverage 66.80% 68.47% +1.67%
==========================================
Files 230 247 +17
Lines 16602 18502 +1900
==========================================
+ Hits 11091 12670 +1579
- Misses 4808 5004 +196
- Partials 703 828 +125 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is neat, @puerco!
func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2ResultOption) error { | ||
// Attestatio subject | ||
subject := intoto.ResourceDescriptor{ | ||
Name: r.Repo.Name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this set the URI field by any chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it now populates the URi with an spdx-style downlaod locator (check the updated example above)
dcef5c1
to
f886846
Compare
OK, I've updated the patch with changes addressing the statement suggestions (and updated the example in the PR body) |
f886846
to
6757271
Compare
// FormatStatement specifies that results should be output in an in-toto statement. | ||
FormatStatement = "statement" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussion: any preference on statement
vs intoto
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also considered attestation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think intoto
would make it crystal clear what the output format would be.
pkg/scorecard/statement.go
Outdated
func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2ResultOption) error { | ||
// Attestatio subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we envision any configuration we'd want to do independent of the JSON where we should we define an AsStatementOption (or AsIntotoOption
depending on other comment)?
(also: typo in Attestation
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Right now, there is nothing to change, but I think we'll iterate the predicate or add other types, so specifying the predicate type will probably be the first option. I've wrapped the JSON2 options in a new AsStatement options set (which is empty for now).
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
6757271
to
a43c588
Compare
a43c588
to
60aac30
Compare
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
This adds an options set for the intoto statement output. It just wraps the json2 options for now. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
60aac30
to
05f6ed4
Compare
What kind of change does this PR introduce?
Feature
What is the current behavior?
Currently scorecard does not support generating in-toto statements.
What is the new behavior (if this is a feature change)?**
This PR adds support to generate the scorecard output in an in-toto statement. It introduces a new possible value for the format flag:
--format=statement
.The predicate format is open to discussion, right now is just a reformated version of
JSONScorecardResultV2
with the repo removed (as it is now in the statement's subject section):Which issue(s) this PR fixes
Fixes #3352
Special notes for your reviewer
Let me know if the predicate format should change (or if fields should be added or removed).
/cc @adityasaky as the original author of #3352
/cc @marcelamelara @mlieberman85
Does this PR introduce a user-facing change?