feat: adds custom scorecard certifier#2815
feat: adds custom scorecard certifier#2815shreyasHpandya wants to merge 1 commit intoguacsec:mainfrom
Conversation
Kusari Analysis Results:
No pinned version dependency changes, code issues or exposed secrets detected! Note View full detailed analysis result for more information on the output and the checks that were run.
Found this helpful? Give it a 👍 or 👎 reaction! |
| req.Header.Set("Accept", "application/json") | ||
|
|
||
| resp, err := httpClient.Do(req) | ||
| defer func() { |
There was a problem hiding this comment.
Issue: Fix nil pointer dereference in defer statement
Recommended Code Changes:
resp, err := httpClient.Do(req)
if err != nil {
return nil, fmt.Errorf("scorecard request failed: %w", err)
}
defer func() {
_ = resp.Body.Close()
}()
|
Kusari PR Analysis rerun based on - 81bb024 performed at: 2025-11-24T03:05:26Z - link to updated analysis |
0b3c224 to
e0151f0
Compare
845216e to
3f18d64
Compare
7becd0d to
15c5e84
Compare
Scorecard improvements description for better understandingWhen querying the Scorecard API with a specific commitSHA that returns 404, Design Decisions:
|
|
Hi @mihaimaruseac @pxp928, can you please review this PR when you get a chance. Thanks ! |
pkg/certifier/scorecard/scorecard.go
Outdated
| ghToken: s, | ||
| }, nil | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
The file should end with a newline
| // Log warning but allow initialization without token | ||
| // The API path will still work, only local computation will fail |
There was a problem hiding this comment.
This comment doesn't seem useful.
It looks like you used AI to generate the PR, but did not clean the output.
There was a problem hiding this comment.
Previously, a GitHub token was required for Scorecard to start. After this change, startup no longer depends on the token, so just logs a warning. Added these comments intentionally to make that behaviour change explicit and improve transparency for future readers. If there’s a clearer way to convey this, I’m happy to adjust the wording.
pkg/certifier/scorecard/scorecard.go
Outdated
|
|
||
| // CertifyComponent is a certifier that generates scorecard attestations | ||
| func (s scorecard) CertifyComponent(_ context.Context, rootComponent interface{}, docChannel chan<- *processor.Document) error { | ||
| func (s scorecard) CertifyComponent(ctx context.Context, rootComponent interface{}, docChannel chan<- *processor.Document) error { |
There was a problem hiding this comment.
ctx is still unused... Did you try to compile the code? The compiler would have given you an error.
There was a problem hiding this comment.
Yes. Did compile the code and test out the scorecard certifier. Since ctx was a function parameter here, it did not give any issues during compile-time.
Will revert back to _ since we are not using ctx in the function
9fc1125 to
188409c
Compare
Co-authored-by: Shreyas Pandya <pandyashreyas1@gmail.com> Co-authored-by: Abhisek Agrawal <abhishek.yours4@gmail.com> Co-authored-by: Anirudh Edpuganti <aniedpuganti@gmail.com> Co-authored-by: Jayashree O <jaishu138@gmail.com> Co-authored-by: Paul Joseph <k.paul.joseph@gmail.com> Co-authored-by: Gagan H R <hrgagan4@gmail.com> Signed-off-by: Gagan H R <hrgagan4@gmail.com>
188409c to
4fda643
Compare
Fixes #2783
Description of the PR
See comment #2815 (comment)
PR Checklist
-sflag togit commit.make generatehas been runmake generatehas been runmake generatehas been runcollectsubprotobuf has been changed,make protohas been run