diff --git a/checks/evaluation/webhooks_test.go b/checks/evaluation/webhooks_test.go index 67cfd81ad653..5f61d0d75621 100644 --- a/checks/evaluation/webhooks_test.go +++ b/checks/evaluation/webhooks_test.go @@ -112,77 +112,12 @@ func TestWebhooks(t *testing.T) { name: "Twelve webhooks none of which have secrets", findings: []finding.Finding{ { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "hasWebhooks", - Outcome: finding.OutcomePositive, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { - Probe: "webhooksWithoutTokenAuth", - Outcome: finding.OutcomeNegative, - }, { Probe: "webhooksWithoutTokenAuth", Outcome: finding.OutcomeNegative, + Values: map[string]int{ + "totalWebhooks": 12, + "webhooksWithoutSecret": 12, + }, }, }, result: scut.TestReturn{ diff --git a/probes/webhooksWithoutTokenAuth/impl.go b/probes/webhooksWithoutTokenAuth/impl.go index 629d376cafd0..65ae795f5596 100644 --- a/probes/webhooksWithoutTokenAuth/impl.go +++ b/probes/webhooksWithoutTokenAuth/impl.go @@ -40,9 +40,9 @@ func Run(raw *checker.RawResults) ([]finding.Finding, string, error) { var findings []finding.Finding - if totalWebhooks == 0 { + if len(r.Webhooks) == 0 { f, err := finding.NewWith(fs, Probe, - "Repository has webhook without token authorization.", nil, + "Repository does not have webhooks.", nil, finding.OutcomeNotApplicable) if err != nil { return nil, Probe, fmt.Errorf("create finding: %w", err)