Skip to content

Commit

Permalink
rename probe
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Korczynski <[email protected]>
  • Loading branch information
AdamKorcz committed Dec 4, 2023
1 parent 6ed0073 commit d407833
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions checks/evaluation/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ 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/webhooksWithoutSecret"
"github.com/ossf/scorecard/v4/probes/webhooksUseSecrets"
)

// Webhooks applies the score policy for the Webhooks check.
func Webhooks(name string,
findings []finding.Finding, dl checker.DetailLogger,
) checker.CheckResult {
expectedProbes := []string{
webhooksWithoutSecret.Probe,
webhooksUseSecrets.Probe,
}

if !finding.UniqueProbesEqual(findings, expectedProbes) {
Expand Down
38 changes: 19 additions & 19 deletions checks/evaluation/webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestWebhooks(t *testing.T) {
name: "no webhooks",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNotApplicable,
},
},
Expand All @@ -46,7 +46,7 @@ func TestWebhooks(t *testing.T) {
name: "1 webhook with no secret",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
},
},
Expand All @@ -58,7 +58,7 @@ func TestWebhooks(t *testing.T) {
name: "1 webhook with secret",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomePositive,
Values: map[string]int{
"totalWebhooks": 1,
Expand All @@ -73,7 +73,7 @@ func TestWebhooks(t *testing.T) {
name: "2 webhooks one of which has secret",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 2,
Expand All @@ -88,14 +88,14 @@ func TestWebhooks(t *testing.T) {
name: "Five webhooks three of which have secrets",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 5,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 5,
Expand All @@ -110,7 +110,7 @@ func TestWebhooks(t *testing.T) {
name: "One of 12 webhooks does not have secrets",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
Expand All @@ -125,84 +125,84 @@ func TestWebhooks(t *testing.T) {
name: "Score should not drop below min score",
findings: []finding.Finding{
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
},
},
{
Probe: "webhooksWithoutSecret",
Probe: "webhooksUseSecrets",
Outcome: finding.OutcomeNegative,
Values: map[string]int{
"totalWebhooks": 12,
Expand Down
4 changes: 2 additions & 2 deletions probes/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import (
"github.com/ossf/scorecard/v4/probes/toolDependabotInstalled"
"github.com/ossf/scorecard/v4/probes/toolPyUpInstalled"
"github.com/ossf/scorecard/v4/probes/toolRenovateInstalled"
"github.com/ossf/scorecard/v4/probes/webhooksWithoutSecret"
"github.com/ossf/scorecard/v4/probes/webhooksUseSecrets"
)

// ProbeImpl is the implementation of a probe.
Expand Down Expand Up @@ -123,7 +123,7 @@ var (
hasOpenSSFBadge.Run,
}
Webhook = []ProbeImpl{
webhooksWithoutSecret.Run,
webhooksUseSecrets.Run,
}
)

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

id: webhooksWithoutSecret
id: webhooksUseSecrets
short: This check determines whether the webhooks defined in the repository have secrets configured to authenticate the origins of requests.
motivation: >
Webhooks without secret authorization have the potential to make projects accessible to third-parties.
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 webhooksWithoutSecret
package webhooksUseSecrets

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

const Probe = "webhooksWithoutSecret"
const Probe = "webhooksUseSecrets"

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 webhooksWithoutSecret
package webhooksUseSecrets

import (
"testing"
Expand Down

0 comments on commit d407833

Please sign in to comment.