-
Notifications
You must be signed in to change notification settings - Fork 508
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
🌱 Add dependency remediation in raw results instead of at log time #3632
Conversation
1ecd0b6
to
8a33ad5
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3632 +/- ##
==========================================
- Coverage 76.13% 70.45% -5.68%
==========================================
Files 206 206
Lines 14053 14065 +12
==========================================
- Hits 10699 9910 -789
- Misses 2726 3578 +852
+ Partials 628 577 -51 |
Ah surfacing the error is causing the e2e to fail.
Maybe something like this? We used to ignore the unsupported features like this. diff --git a/remediation/remediations.go b/remediation/remediations.go
index b5713f7f..ab1dcd4d 100644
--- a/remediation/remediations.go
+++ b/remediation/remediations.go
@@ -22,6 +22,7 @@ import (
"github.com/google/go-containerregistry/pkg/crane"
"github.com/ossf/scorecard/v4/checker"
+ "github.com/ossf/scorecard/v4/clients"
"github.com/ossf/scorecard/v4/rule"
)
@@ -49,6 +50,9 @@ func New(c *checker.CheckRequest) (*RemediationMetadata, error) {
// Get the branch for remediation.
branch, err := c.RepoClient.GetDefaultBranchName()
if err != nil {
+ if errors.Is(err, clients.ErrUnsupportedFeature) {
+ return nil, nil
+ }
return &RemediationMetadata{}, fmt.Errorf("GetDefaultBranchName: %w", err)
}
@@ -63,6 +67,9 @@ func New(c *checker.CheckRequest) (*RemediationMetadata, error) {
// CreateWorkflowPinningRemediation create remediaiton for pinninn GH Actions.
func (r *RemediationMetadata) CreateWorkflowPinningRemediation(filepath string) *rule.Remediation {
+ if r == nil {
+ return nil
+ }
return r.createWorkflowRemediation(filepath, "pin")
} This causes other e2e test(s) to fail. Up to you if you want to deal with it or maybe we just say "oops" and revert the error checking and tackle it in another PR |
7ffc987
to
ebadc14
Compare
ebadc14
to
5e285f3
Compare
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
Signed-off-by: AdamKorcz <[email protected]>
1bc71ad
to
1fcc17a
Compare
Signed-off-by: Spencer Schrock <[email protected]>
…ssf#3632) * 🌱 Add dependency remediation in raw results instead of at log time Signed-off-by: AdamKorcz <[email protected]> * add unit test Signed-off-by: AdamKorcz <[email protected]> * add unit test Signed-off-by: AdamKorcz <[email protected]> * return error Signed-off-by: AdamKorcz <[email protected]> * use pointer to dependency Signed-off-by: AdamKorcz <[email protected]> * check for errors in test Signed-off-by: AdamKorcz <[email protected]> * Return nil if repo client returns an error from unsupported feature Signed-off-by: AdamKorcz <[email protected]> * revert error checking Signed-off-by: AdamKorcz <[email protected]> * revert returning nil is unsupported feature Signed-off-by: AdamKorcz <[email protected]> * Fix wrong test name Signed-off-by: AdamKorcz <[email protected]> * only create remediation when required Signed-off-by: AdamKorcz <[email protected]> * remove remediation helper function Signed-off-by: AdamKorcz <[email protected]> --------- Signed-off-by: AdamKorcz <[email protected]> Signed-off-by: Spencer Schrock <[email protected]> Signed-off-by: Diogo Teles Sant'Anna <[email protected]>
…ssf#3632) * 🌱 Add dependency remediation in raw results instead of at log time Signed-off-by: AdamKorcz <[email protected]> * add unit test Signed-off-by: AdamKorcz <[email protected]> * add unit test Signed-off-by: AdamKorcz <[email protected]> * return error Signed-off-by: AdamKorcz <[email protected]> * use pointer to dependency Signed-off-by: AdamKorcz <[email protected]> * check for errors in test Signed-off-by: AdamKorcz <[email protected]> * Return nil if repo client returns an error from unsupported feature Signed-off-by: AdamKorcz <[email protected]> * revert error checking Signed-off-by: AdamKorcz <[email protected]> * revert returning nil is unsupported feature Signed-off-by: AdamKorcz <[email protected]> * Fix wrong test name Signed-off-by: AdamKorcz <[email protected]> * only create remediation when required Signed-off-by: AdamKorcz <[email protected]> * remove remediation helper function Signed-off-by: AdamKorcz <[email protected]> --------- Signed-off-by: AdamKorcz <[email protected]> Signed-off-by: Spencer Schrock <[email protected]> Signed-off-by: Allen Shearin <[email protected]>
What kind of change does this PR introduce?
This moves the creation of remediation for dependencies to the part where the raw results get created instead of in the evaluation.
This is an intermediary PR to prepare the pinned dependencies check for being migrated to probes; for that purpose, client calls should not be in the evaluation phase.
(Is it a bug fix, feature, docs update, something else?)
What is the current behavior?
What is the new behavior (if this is a feature change)?**
Which issue(s) this PR fixes
NONE
Special notes for your reviewer
Does this PR introduce a user-facing change?
NONE