diff --git a/config/config.go b/config/config.go index 3cbe82b2..c9ea7ad1 100644 --- a/config/config.go +++ b/config/config.go @@ -23,6 +23,7 @@ import ( "gopkg.in/yaml.v3" sce "github.com/ossf/scorecard/v5/errors" + "github.com/ossf/scorecard/v5/internal/checknames" ) var ( @@ -45,19 +46,19 @@ func parseFile(c *Config, content []byte) error { return nil } -func isValidCheck(check string, checks []string) bool { - for _, validCheck := range checks { - if strings.EqualFold(check, validCheck) { +func isValidCheck(check string) bool { + for _, c := range checknames.AllValidChecks { + if strings.EqualFold(c, check) { return true } } return false } -func validate(c Config, checks []string) error { +func validate(c Config) error { for _, annotation := range c.Annotations { for _, check := range annotation.Checks { - if !isValidCheck(check, checks) { + if !isValidCheck(check) { return fmt.Errorf("%w: %s", errInvalidCheck, check) } } @@ -71,7 +72,7 @@ func validate(c Config, checks []string) error { } // Parse reads the configuration file from the repo, stored in scorecard.yml, and returns a `Config`. -func Parse(r io.Reader, checks []string) (Config, error) { +func Parse(r io.Reader) (Config, error) { c := Config{} // Find scorecard.yml file in the repository's root content, err := io.ReadAll(r) @@ -84,7 +85,7 @@ func Parse(r io.Reader, checks []string) (Config, error) { return Config{}, fmt.Errorf("fail to parse configuration file: %w", err) } - err = validate(c, checks) + err = validate(c) if err != nil { return Config{}, fmt.Errorf("configuration file is not valid: %w", err) } diff --git a/config/config_test.go b/config/config_test.go index a2167807..05528808 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -12,18 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Warning: config cannot import checks. This is why we declare a different package here -// and import both config and checks to test config. -package config_test +package config import ( "os" "testing" "github.com/google/go-cmp/cmp" - - "github.com/ossf/scorecard/v5/checks" - "github.com/ossf/scorecard/v5/config" ) func Test_Parse_Checks(t *testing.T) { @@ -31,17 +26,17 @@ func Test_Parse_Checks(t *testing.T) { tests := []struct { name string configPath string - want config.Config + want Config wantErr bool }{ { name: "Annotation on a single check", configPath: "testdata/single_check.yml", - want: config.Config{ - Annotations: []config.Annotation{ + want: Config{ + Annotations: []Annotation{ { Checks: []string{"binary-artifacts"}, - Reasons: []config.ReasonGroup{{Reason: "test-data"}}, + Reasons: []ReasonGroup{{Reason: "test-data"}}, }, }, }, @@ -49,8 +44,8 @@ func Test_Parse_Checks(t *testing.T) { { name: "Annotation on all checks", configPath: "testdata/all_checks.yml", - want: config.Config{ - Annotations: []config.Annotation{ + want: Config{ + Annotations: []Annotation{ { Checks: []string{ "binary-artifacts", @@ -72,7 +67,7 @@ func Test_Parse_Checks(t *testing.T) { "token-permissions", "vulnerabilities", }, - Reasons: []config.ReasonGroup{{Reason: "test-data"}}, + Reasons: []ReasonGroup{{Reason: "test-data"}}, }, }, }, @@ -80,11 +75,11 @@ func Test_Parse_Checks(t *testing.T) { { name: "Annotating all reasons", configPath: "testdata/all_reasons.yml", - want: config.Config{ - Annotations: []config.Annotation{ + want: Config{ + Annotations: []Annotation{ { Checks: []string{"binary-artifacts"}, - Reasons: []config.ReasonGroup{ + Reasons: []ReasonGroup{ {Reason: "test-data"}, {Reason: "remediated"}, {Reason: "not-applicable"}, @@ -98,15 +93,15 @@ func Test_Parse_Checks(t *testing.T) { { name: "Multiple annotations", configPath: "testdata/multiple_annotations.yml", - want: config.Config{ - Annotations: []config.Annotation{ + want: Config{ + Annotations: []Annotation{ { Checks: []string{"binary-artifacts"}, - Reasons: []config.ReasonGroup{{Reason: "test-data"}}, + Reasons: []ReasonGroup{{Reason: "test-data"}}, }, { Checks: []string{"pinned-dependencies"}, - Reasons: []config.ReasonGroup{{Reason: "not-applicable"}}, + Reasons: []ReasonGroup{{Reason: "not-applicable"}}, }, }, }, @@ -124,17 +119,13 @@ func Test_Parse_Checks(t *testing.T) { } for _, tt := range tests { tt := tt // Re-initializing variable so it is not changed while executing the closure below - allChecks := []string{} - for check := range checks.GetAll() { - allChecks = append(allChecks, check) - } t.Run(tt.name, func(t *testing.T) { t.Parallel() r, err := os.Open(tt.configPath) if err != nil { t.Fatalf("Could not open config test file: %s", tt.configPath) } - result, err := config.Parse(r, allChecks) + result, err := Parse(r) if (err != nil) != tt.wantErr { t.Fatalf("Unexpected error during Parse: got %v, wantErr %v", err, tt.wantErr) } diff --git a/internal/checknames/checknames.go b/internal/checknames/checknames.go new file mode 100644 index 00000000..aaf6bd48 --- /dev/null +++ b/internal/checknames/checknames.go @@ -0,0 +1,64 @@ +// Copyright 2024 OpenSSF Scorecard Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package checknames + +type CheckName = string + +// Redefining check names here to avoid circular imports. +const ( + BinaryArtifacts CheckName = "Binary-Artifacts" + BranchProtection CheckName = "Branch-Protection" + CIIBestPractices CheckName = "CII-Best-Practices" + CITests CheckName = "CI-Tests" + CodeReview CheckName = "Code-Review" + Contributors CheckName = "Contributors" + DangerousWorkflow CheckName = "Dangerous-Workflow" + DependencyUpdateTool CheckName = "Dependency-Update-Tool" + Fuzzing CheckName = "Fuzzing" + License CheckName = "License" + Maintained CheckName = "Maintained" + Packaging CheckName = "Packaging" + PinnedDependencies CheckName = "Pinned-Dependencies" + SAST CheckName = "SAST" + SBOM CheckName = "SBOM" + SecurityPolicy CheckName = "Security-Policy" + SignedReleases CheckName = "Signed-Releases" + TokenPermissions CheckName = "Token-Permissions" + Vulnerabilities CheckName = "Vulnerabilities" + Webhooks CheckName = "Webhooks" +) + +var AllValidChecks []string = []string{ + BinaryArtifacts, + BranchProtection, + CIIBestPractices, + CITests, + CodeReview, + Contributors, + DangerousWorkflow, + DependencyUpdateTool, + Fuzzing, + License, + Maintained, + Packaging, + PinnedDependencies, + SAST, + SBOM, + SecurityPolicy, + SignedReleases, + TokenPermissions, + Vulnerabilities, + Webhooks, +} diff --git a/internal/probes/probes.go b/internal/probes/probes.go index bc125256..437f5c87 100644 --- a/internal/probes/probes.go +++ b/internal/probes/probes.go @@ -20,39 +20,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/errors" "github.com/ossf/scorecard/v5/finding" -) - -type CheckName string - -// Redefining check names here to avoid circular imports. -const ( - BinaryArtifacts CheckName = "Binary-Artifacts" - BranchProtection CheckName = "Branch-Protection" - CIIBestPractices CheckName = "CII-Best-Practices" - CITests CheckName = "CI-Tests" - CodeReview CheckName = "Code-Review" - Contributors CheckName = "Contributors" - DangerousWorkflow CheckName = "Dangerous-Workflow" - DependencyUpdateTool CheckName = "Dependency-Update-Tool" - Fuzzing CheckName = "Fuzzing" - License CheckName = "License" - Maintained CheckName = "Maintained" - Packaging CheckName = "Packaging" - PinnedDependencies CheckName = "Pinned-Dependencies" - SAST CheckName = "SAST" - SBOM CheckName = "SBOM" - SecurityPolicy CheckName = "Security-Policy" - SignedReleases CheckName = "Signed-Releases" - TokenPermissions CheckName = "Token-Permissions" - Vulnerabilities CheckName = "Vulnerabilities" - Webhooks CheckName = "Webhooks" + "github.com/ossf/scorecard/v5/internal/checknames" ) type Probe struct { Name string Implementation ProbeImpl IndependentImplementation IndependentProbeImpl - RequiredRawData []CheckName + RequiredRawData []checknames.CheckName } type ProbeImpl func(*checker.RawResults) ([]finding.Finding, string, error) @@ -62,7 +37,7 @@ type IndependentProbeImpl func(*checker.CheckRequest) ([]finding.Finding, string // registered is the mapping of all registered probes. var registered = map[string]Probe{} -func MustRegister(name string, impl ProbeImpl, requiredRawData []CheckName) { +func MustRegister(name string, impl ProbeImpl, requiredRawData []checknames.CheckName) { err := register(Probe{ Name: name, Implementation: impl, diff --git a/internal/probes/probes_test.go b/internal/probes/probes_test.go index 800c7219..74b57d93 100644 --- a/internal/probes/probes_test.go +++ b/internal/probes/probes_test.go @@ -21,6 +21,7 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + . "github.com/ossf/scorecard/v5/internal/checknames" ) func emptyImpl(r *checker.RawResults) ([]finding.Finding, string, error) { diff --git a/pkg/scorecard.go b/pkg/scorecard.go index 819194d1..bf13c246 100644 --- a/pkg/scorecard.go +++ b/pkg/scorecard.go @@ -180,11 +180,7 @@ func runScorecard(ctx context.Context, if r != nil { defer r.Close() logger.Info(fmt.Sprintf("using maintainer annotations: %s", path)) - checks := []string{} - for check := range checksToRun { - checks = append(checks, check) - } - c, err := config.Parse(r, checks) + c, err := config.Parse(r) if err != nil { logger.Info(fmt.Sprintf("couldn't parse maintainer annotations: %v", err)) } diff --git a/pkg/scorecard_result.go b/pkg/scorecard_result.go index 3cf90f54..84ba8f89 100644 --- a/pkg/scorecard_result.go +++ b/pkg/scorecard_result.go @@ -402,7 +402,7 @@ func populateRawResults(request *checker.CheckRequest, probesToRun []string, ret return fmt.Errorf("getting probe %q: %w", probeName, err) } for _, checkName := range p.RequiredRawData { - checkName := string(checkName) + checkName := checkName if !seen[checkName] { err := assignRawData(checkName, request, ret) if err != nil { diff --git a/probes/archived/impl.go b/probes/archived/impl.go index ecb6bcf3..c70ea2b5 100644 --- a/probes/archived/impl.go +++ b/probes/archived/impl.go @@ -20,12 +20,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Maintained}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Maintained}) } //go:embed *.yml diff --git a/probes/blocksDeleteOnBranches/impl.go b/probes/blocksDeleteOnBranches/impl.go index 065da42e..c86a9298 100644 --- a/probes/blocksDeleteOnBranches/impl.go +++ b/probes/blocksDeleteOnBranches/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/blocksForcePushOnBranches/impl.go b/probes/blocksForcePushOnBranches/impl.go index 73724cc9..30ea3268 100644 --- a/probes/blocksForcePushOnBranches/impl.go +++ b/probes/blocksForcePushOnBranches/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/branchProtectionAppliesToAdmins/impl.go b/probes/branchProtectionAppliesToAdmins/impl.go index ff20bd01..b8cd21c3 100644 --- a/probes/branchProtectionAppliesToAdmins/impl.go +++ b/probes/branchProtectionAppliesToAdmins/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/branchprotection" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/branchesAreProtected/impl.go b/probes/branchesAreProtected/impl.go index 33a01652..159020ed 100644 --- a/probes/branchesAreProtected/impl.go +++ b/probes/branchesAreProtected/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/codeApproved/impl.go b/probes/codeApproved/impl.go index d3dfff5e..fe9f0eac 100644 --- a/probes/codeApproved/impl.go +++ b/probes/codeApproved/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.CodeReview}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.CodeReview}) } //go:embed *.yml diff --git a/probes/codeReviewOneReviewers/impl.go b/probes/codeReviewOneReviewers/impl.go index e68bffd7..8176f19b 100644 --- a/probes/codeReviewOneReviewers/impl.go +++ b/probes/codeReviewOneReviewers/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/clients" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/utils" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.CodeReview}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.CodeReview}) } var ( diff --git a/probes/contributorsFromOrgOrCompany/impl.go b/probes/contributorsFromOrgOrCompany/impl.go index a5172e8a..0bed128e 100644 --- a/probes/contributorsFromOrgOrCompany/impl.go +++ b/probes/contributorsFromOrgOrCompany/impl.go @@ -21,6 +21,7 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) @@ -30,7 +31,7 @@ const ( ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Contributors}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Contributors}) } //go:embed *.yml diff --git a/probes/createdRecently/impl.go b/probes/createdRecently/impl.go index 5b87a817..b846b611 100644 --- a/probes/createdRecently/impl.go +++ b/probes/createdRecently/impl.go @@ -23,12 +23,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Maintained}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Maintained}) } //go:embed *.yml diff --git a/probes/dependencyUpdateToolConfigured/impl.go b/probes/dependencyUpdateToolConfigured/impl.go index 67e94acc..98d508e8 100644 --- a/probes/dependencyUpdateToolConfigured/impl.go +++ b/probes/dependencyUpdateToolConfigured/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.DependencyUpdateTool}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.DependencyUpdateTool}) } //go:embed *.yml diff --git a/probes/dismissesStaleReviews/impl.go b/probes/dismissesStaleReviews/impl.go index a955bec8..fea575ca 100644 --- a/probes/dismissesStaleReviews/impl.go +++ b/probes/dismissesStaleReviews/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/branchprotection" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/fuzzed/impl.go b/probes/fuzzed/impl.go index de4c40a4..53736056 100644 --- a/probes/fuzzed/impl.go +++ b/probes/fuzzed/impl.go @@ -20,12 +20,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Fuzzing}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Fuzzing}) } //go:embed *.yml diff --git a/probes/hasBinaryArtifacts/impl.go b/probes/hasBinaryArtifacts/impl.go index be2b3860..7013b043 100644 --- a/probes/hasBinaryArtifacts/impl.go +++ b/probes/hasBinaryArtifacts/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BinaryArtifacts}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BinaryArtifacts}) } //go:embed *.yml diff --git a/probes/hasDangerousWorkflowScriptInjection/impl.go b/probes/hasDangerousWorkflowScriptInjection/impl.go index f368b73a..1ec39da9 100644 --- a/probes/hasDangerousWorkflowScriptInjection/impl.go +++ b/probes/hasDangerousWorkflowScriptInjection/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.DangerousWorkflow}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.DangerousWorkflow}) } //go:embed *.yml diff --git a/probes/hasDangerousWorkflowUntrustedCheckout/impl.go b/probes/hasDangerousWorkflowUntrustedCheckout/impl.go index 0e5fa884..83727cc9 100644 --- a/probes/hasDangerousWorkflowUntrustedCheckout/impl.go +++ b/probes/hasDangerousWorkflowUntrustedCheckout/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.DangerousWorkflow}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.DangerousWorkflow}) } //go:embed *.yml diff --git a/probes/hasFSFOrOSIApprovedLicense/impl.go b/probes/hasFSFOrOSIApprovedLicense/impl.go index cbe0360f..1a53dc14 100644 --- a/probes/hasFSFOrOSIApprovedLicense/impl.go +++ b/probes/hasFSFOrOSIApprovedLicense/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.License}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.License}) } //go:embed *.yml diff --git a/probes/hasLicenseFile/impl.go b/probes/hasLicenseFile/impl.go index 0fb7e9e3..f3de9b1d 100644 --- a/probes/hasLicenseFile/impl.go +++ b/probes/hasLicenseFile/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.License}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.License}) } //go:embed *.yml diff --git a/probes/hasOSVVulnerabilities/impl.go b/probes/hasOSVVulnerabilities/impl.go index 49da22e2..61f36639 100644 --- a/probes/hasOSVVulnerabilities/impl.go +++ b/probes/hasOSVVulnerabilities/impl.go @@ -25,12 +25,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Vulnerabilities}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Vulnerabilities}) } //go:embed *.yml diff --git a/probes/hasOpenSSFBadge/impl.go b/probes/hasOpenSSFBadge/impl.go index 71f43357..7124d9a5 100644 --- a/probes/hasOpenSSFBadge/impl.go +++ b/probes/hasOpenSSFBadge/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/clients" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.CIIBestPractices}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.CIIBestPractices}) } //go:embed *.yml diff --git a/probes/hasPermissiveLicense/impl.go b/probes/hasPermissiveLicense/impl.go index ac80f0cd..b7c7cf9a 100644 --- a/probes/hasPermissiveLicense/impl.go +++ b/probes/hasPermissiveLicense/impl.go @@ -21,6 +21,7 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) @@ -29,7 +30,7 @@ import ( var fs embed.FS func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.License}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.License}) } const Probe = "hasPermissiveLicense" diff --git a/probes/hasRecentCommits/impl.go b/probes/hasRecentCommits/impl.go index f92f54e4..fe63cd95 100644 --- a/probes/hasRecentCommits/impl.go +++ b/probes/hasRecentCommits/impl.go @@ -23,12 +23,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Maintained}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Maintained}) } //go:embed *.yml diff --git a/probes/hasReleaseSBOM/impl.go b/probes/hasReleaseSBOM/impl.go index ecf3d49c..239b26d2 100644 --- a/probes/hasReleaseSBOM/impl.go +++ b/probes/hasReleaseSBOM/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SBOM}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SBOM}) } //go:embed *.yml diff --git a/probes/hasSBOM/impl.go b/probes/hasSBOM/impl.go index 5ce606ff..c4acfaf3 100644 --- a/probes/hasSBOM/impl.go +++ b/probes/hasSBOM/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SBOM}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SBOM}) } //go:embed *.yml diff --git a/probes/hasUnverifiedBinaryArtifacts/impl.go b/probes/hasUnverifiedBinaryArtifacts/impl.go index 4ea74027..697fa8d5 100644 --- a/probes/hasUnverifiedBinaryArtifacts/impl.go +++ b/probes/hasUnverifiedBinaryArtifacts/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BinaryArtifacts}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BinaryArtifacts}) } //go:embed *.yml diff --git a/probes/issueActivityByProjectMember/impl.go b/probes/issueActivityByProjectMember/impl.go index d97ae1eb..39a2bda2 100644 --- a/probes/issueActivityByProjectMember/impl.go +++ b/probes/issueActivityByProjectMember/impl.go @@ -24,12 +24,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/clients" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Maintained}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Maintained}) } //go:embed *.yml diff --git a/probes/packagedWithAutomatedWorkflow/impl.go b/probes/packagedWithAutomatedWorkflow/impl.go index 88bd2ba2..2de64040 100644 --- a/probes/packagedWithAutomatedWorkflow/impl.go +++ b/probes/packagedWithAutomatedWorkflow/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Packaging}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Packaging}) } //go:embed *.yml diff --git a/probes/pinsDependencies/impl.go b/probes/pinsDependencies/impl.go index d8a6a1a1..b3930502 100644 --- a/probes/pinsDependencies/impl.go +++ b/probes/pinsDependencies/impl.go @@ -23,12 +23,13 @@ import ( "github.com/ossf/scorecard/v5/checks/fileparser" sce "github.com/ossf/scorecard/v5/errors" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.PinnedDependencies}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.PinnedDependencies}) } //go:embed *.yml diff --git a/probes/releasesAreSigned/impl.go b/probes/releasesAreSigned/impl.go index 217f50af..66efdbae 100644 --- a/probes/releasesAreSigned/impl.go +++ b/probes/releasesAreSigned/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SignedReleases}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SignedReleases}) } //go:embed *.yml diff --git a/probes/releasesHaveProvenance/impl.go b/probes/releasesHaveProvenance/impl.go index 8a87696f..6fbf4fb5 100644 --- a/probes/releasesHaveProvenance/impl.go +++ b/probes/releasesHaveProvenance/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SignedReleases}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SignedReleases}) } //go:embed *.yml diff --git a/probes/releasesHaveVerifiedProvenance/impl.go b/probes/releasesHaveVerifiedProvenance/impl.go index f73b20fc..7839fb93 100644 --- a/probes/releasesHaveVerifiedProvenance/impl.go +++ b/probes/releasesHaveVerifiedProvenance/impl.go @@ -21,11 +21,12 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SignedReleases}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SignedReleases}) } //go:embed *.yml diff --git a/probes/requiresApproversForPullRequests/impl.go b/probes/requiresApproversForPullRequests/impl.go index 3c307df5..4d16e945 100644 --- a/probes/requiresApproversForPullRequests/impl.go +++ b/probes/requiresApproversForPullRequests/impl.go @@ -23,12 +23,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/requiresCodeOwnersReview/impl.go b/probes/requiresCodeOwnersReview/impl.go index 2e7ae0da..68e9e638 100644 --- a/probes/requiresCodeOwnersReview/impl.go +++ b/probes/requiresCodeOwnersReview/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/requiresLastPushApproval/impl.go b/probes/requiresLastPushApproval/impl.go index 97ab18e2..0cedbeac 100644 --- a/probes/requiresLastPushApproval/impl.go +++ b/probes/requiresLastPushApproval/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/branchprotection" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/requiresPRsToChangeCode/impl.go b/probes/requiresPRsToChangeCode/impl.go index 589e4d37..8d7bcf1b 100644 --- a/probes/requiresPRsToChangeCode/impl.go +++ b/probes/requiresPRsToChangeCode/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/requiresUpToDateBranches/impl.go b/probes/requiresUpToDateBranches/impl.go index 228c0e6c..8c86839f 100644 --- a/probes/requiresUpToDateBranches/impl.go +++ b/probes/requiresUpToDateBranches/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/branchprotection" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/runsStatusChecksBeforeMerging/impl.go b/probes/runsStatusChecksBeforeMerging/impl.go index 7eae9673..a1d4fcdd 100644 --- a/probes/runsStatusChecksBeforeMerging/impl.go +++ b/probes/runsStatusChecksBeforeMerging/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.BranchProtection}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.BranchProtection}) } //go:embed *.yml diff --git a/probes/sastToolConfigured/impl.go b/probes/sastToolConfigured/impl.go index fb5e8098..a549cf9b 100644 --- a/probes/sastToolConfigured/impl.go +++ b/probes/sastToolConfigured/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SAST}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SAST}) } //go:embed *.yml diff --git a/probes/sastToolRunsOnAllCommits/impl.go b/probes/sastToolRunsOnAllCommits/impl.go index e88b0f6f..69253859 100644 --- a/probes/sastToolRunsOnAllCommits/impl.go +++ b/probes/sastToolRunsOnAllCommits/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SAST}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SAST}) } //go:embed *.yml diff --git a/probes/securityPolicyContainsLinks/impl.go b/probes/securityPolicyContainsLinks/impl.go index 14a5979d..c5d9f486 100644 --- a/probes/securityPolicyContainsLinks/impl.go +++ b/probes/securityPolicyContainsLinks/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/secpolicy" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SecurityPolicy}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SecurityPolicy}) } //go:embed *.yml diff --git a/probes/securityPolicyContainsText/impl.go b/probes/securityPolicyContainsText/impl.go index 862b8adc..4399a5b8 100644 --- a/probes/securityPolicyContainsText/impl.go +++ b/probes/securityPolicyContainsText/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/secpolicy" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SecurityPolicy}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SecurityPolicy}) } //go:embed *.yml diff --git a/probes/securityPolicyContainsVulnerabilityDisclosure/impl.go b/probes/securityPolicyContainsVulnerabilityDisclosure/impl.go index 3847d048..daf03236 100644 --- a/probes/securityPolicyContainsVulnerabilityDisclosure/impl.go +++ b/probes/securityPolicyContainsVulnerabilityDisclosure/impl.go @@ -21,13 +21,14 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/secpolicy" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SecurityPolicy}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SecurityPolicy}) } //go:embed *.yml diff --git a/probes/securityPolicyPresent/impl.go b/probes/securityPolicyPresent/impl.go index c4200e9c..b0846533 100644 --- a/probes/securityPolicyPresent/impl.go +++ b/probes/securityPolicyPresent/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.SecurityPolicy}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.SecurityPolicy}) } //go:embed *.yml diff --git a/probes/testsRunInCI/impl.go b/probes/testsRunInCI/impl.go index 538bf353..dd77c424 100644 --- a/probes/testsRunInCI/impl.go +++ b/probes/testsRunInCI/impl.go @@ -22,12 +22,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.CITests}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.CITests}) } //go:embed *.yml diff --git a/probes/webhooksUseSecrets/impl.go b/probes/webhooksUseSecrets/impl.go index 4ef1778d..987e2b2d 100644 --- a/probes/webhooksUseSecrets/impl.go +++ b/probes/webhooksUseSecrets/impl.go @@ -21,12 +21,13 @@ import ( "github.com/ossf/scorecard/v5/checker" "github.com/ossf/scorecard/v5/finding" + "github.com/ossf/scorecard/v5/internal/checknames" "github.com/ossf/scorecard/v5/internal/probes" "github.com/ossf/scorecard/v5/probes/internal/utils/uerror" ) func init() { - probes.MustRegister(Probe, Run, []probes.CheckName{probes.Webhooks}) + probes.MustRegister(Probe, Run, []checknames.CheckName{checknames.Webhooks}) } //go:embed *.yml