mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-19 04:57:14 +03:00
✨ Included security.rst as SecurityPolicy
* Included security.rst as name check for security policy.
This commit is contained in:
parent
68dc079b79
commit
aeead94680
@ -34,6 +34,9 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult {
|
||||
if strings.EqualFold(name, "security.md") {
|
||||
logf("security policy : %s", name)
|
||||
return true, nil
|
||||
} else if isSecurityrstFound(name) {
|
||||
logf("security policy : %s", name)
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
@ -57,3 +60,12 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult {
|
||||
}
|
||||
return CheckIfFileExists(CheckSecurityPolicy, dotGitHub, onFile)
|
||||
}
|
||||
|
||||
func isSecurityrstFound(name string) bool {
|
||||
if strings.EqualFold(name, "doc/security.rst") {
|
||||
return true
|
||||
} else if strings.EqualFold(name, "docs/security.rst") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//nolint: dupl // repeating test cases that are slightly different is acceptable
|
||||
package e2e
|
||||
|
||||
import (
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//nolint:dupl // repeating test cases that are slightly different is acceptable
|
||||
package e2e
|
||||
|
||||
import (
|
||||
@ -47,5 +48,25 @@ var _ = Describe("E2E TEST:SecurityPolicy", func() {
|
||||
Expect(result.Error).Should(BeNil())
|
||||
Expect(result.Pass).Should(BeTrue())
|
||||
})
|
||||
It("Should return valid security policy for rust repositories", func() {
|
||||
l := log{}
|
||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), ghClient)
|
||||
err := repoClient.InitRepo("randombit", "botan")
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
checkRequest := checker.CheckRequest{
|
||||
Ctx: context.Background(),
|
||||
Client: ghClient,
|
||||
HTTPClient: httpClient,
|
||||
RepoClient: repoClient,
|
||||
Owner: "randombit",
|
||||
Repo: "botan",
|
||||
GraphClient: graphClient,
|
||||
Logf: l.Logf,
|
||||
}
|
||||
result := checks.SecurityPolicy(&checkRequest)
|
||||
Expect(result.Error).Should(BeNil())
|
||||
Expect(result.Pass).Should(BeTrue())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user