Skip to content

Commit

Permalink
amend text in def.yml
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <[email protected]>
  • Loading branch information
AdamKorcz committed Sep 28, 2023
1 parent c53f5a4 commit c66893b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 25 deletions.
21 changes: 5 additions & 16 deletions checks/evaluation/packaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
sce "github.com/ossf/scorecard/v4/errors"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/packagedWithGithubActions"
"github.com/ossf/scorecard/v4/probes/packagedNpmWithGitHubWorkflow"
)

// Packaging applies the score policy for the Packaging check.
Expand All @@ -27,12 +27,12 @@ func Packaging(name string,
dl checker.DetailLogger,
) checker.CheckResult {
expectedProbes := []string{
packagedWithGithubActions.Probe,
packagedNpmWithGitHubWorkflow.Probe,
}

err := validateFindings(findings, expectedProbes)
if err != nil {
return checker.CreateRuntimeErrorResult(name, err)
if !finding.UniqueProbesEqual(findings, expectedProbes) {
e := sce.WithMessage(sce.ErrScorecardInternal, "invalid probe results")
return checker.CreateRuntimeErrorResult(name, e)
}

// Currently there is only a single packaging probe that returns
Expand All @@ -50,14 +50,3 @@ func Packaging(name string,
checker.LogFindings(nonNegativeFindings(findings), dl)
return checker.CreateMinScoreResult(name, "project is not published as package")
}

func validateFindings(findings []finding.Finding, expectedProbes []string) error {
if !finding.UniqueProbesEqual(findings, expectedProbes) {
return sce.WithMessage(sce.ErrScorecardInternal, "invalid probe results")
}

if len(findings) == 0 {
return sce.WithMessage(sce.ErrScorecardInternal, "found 0 findings. Should not happen")
}
return nil
}
4 changes: 2 additions & 2 deletions checks/evaluation/packaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestPackaging(t *testing.T) {
name: "test positive outcome",
findings: []finding.Finding{
{
Probe: "packagedWithGithubActions",
Probe: "packagedNpmWithGitHubWorkflow",
Outcome: finding.OutcomePositive,
},
},
Expand All @@ -59,7 +59,7 @@ func TestPackaging(t *testing.T) {
name: "test negative outcome",
findings: []finding.Finding{
{
Probe: "packagedWithGithubActions",
Probe: "packagedNpmWithGitHubWorkflow",
Outcome: finding.OutcomeNegative,
},
},
Expand Down
4 changes: 2 additions & 2 deletions probes/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/ossf/scorecard/v4/probes/fuzzedWithPropertyBasedHaskell"
"github.com/ossf/scorecard/v4/probes/fuzzedWithPropertyBasedJavascript"
"github.com/ossf/scorecard/v4/probes/fuzzedWithPropertyBasedTypescript"
"github.com/ossf/scorecard/v4/probes/packagedWithGithubActions"
"github.com/ossf/scorecard/v4/probes/packagedNpmWithGitHubWorkflow"
"github.com/ossf/scorecard/v4/probes/securityPolicyContainsLinks"
"github.com/ossf/scorecard/v4/probes/securityPolicyContainsText"
"github.com/ossf/scorecard/v4/probes/securityPolicyContainsVulnerabilityDisclosure"
Expand Down Expand Up @@ -67,7 +67,7 @@ var (
fuzzedWithPropertyBasedJavascript.Run,
}
Packaging = []ProbeImpl{
packagedWithGithubActions.Run,
packagedNpmWithGitHubWorkflow.Run,
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

id: packagedWithGithubActions
id: packagedNpmWithGitHubWorkflow
short: Check that the project is fuzzed using OSS-Fuzz
motivation: >
Packages give users of a project an easy way to download, install, update, and uninstall the software by a package manager. In particular, they make it easy for users to receive security patches as updates.
implementation: >
The implementation checks all the packages of the project. If one of these packages do not have a debug message, then it is considered a release package and the probe returns a positive outcome.
The implementation checks whether a project uses common patterns for packaging across multiple ecosystems. Scorecard gets this by checking the projects workflows for specific uses of actions and build commands such as `docker push` or `mvn deploy`.
outcome:
- If the project has a package without a debug message, the outcome is positive.
- If the project has a package with a debug message, the outcome is negative.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

// nolint:stylecheck
package packagedWithGithubActions
package packagedNpmWithGitHubWorkflow

import (
"embed"
Expand All @@ -27,7 +27,7 @@ import (
//go:embed *.yml
var fs embed.FS

const Probe = "packagedWithGithubActions"
const Probe = "packagedNpmWithGitHubWorkflow"

func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

// nolint:stylecheck
package packagedWithGithubActions
package packagedNpmWithGitHubWorkflow

import (
"testing"
Expand Down

0 comments on commit c66893b

Please sign in to comment.