diff --git a/.github/vet/policy.yml b/.github/vet/policy.yml new file mode 100644 index 0000000..dcaeca5 --- /dev/null +++ b/.github/vet/policy.yml @@ -0,0 +1,42 @@ +name: General Purpose OSS Best Practices +description: | + This filter suite contains rules for implementing general purpose OSS + consumption best practices for an organization. +tags: + - general + - safedep-managed +filters: + - name: critical-or-high-vulns + check_type: CheckTypeVulnerability + summary: Critical or high risk vulnerabilities were found + value: | + vulns.critical.exists(p, true) || vulns.high.exists(p, true) + - name: low-popularity + check_type: CheckTypePopularity + summary: Component popularity is low by Github stars count + value: | + projects.exists(p, (p.type == "GITHUB") && (p.stars < 10)) + - name: risky-oss-licenses + check_type: CheckTypeLicense + summary: Risky OSS license was detected + value: | + licenses.exists(p, p == "GPL-2.0") || + licenses.exists(p, p == "GPL-2.0-only") || + licenses.exists(p, p == "GPL-3.0") || + licenses.exists(p, p == "GPL-3.0-only") || + licenses.exists(p, p == "BSD-3-Clause OR GPL-2.0") + - name: ossf-unmaintained + check_type: CheckTypeMaintenance + summary: Component appears to be unmaintained + value: | + scorecard.scores["Maintained"] == 0 + - name: osv-malware + check_type: CheckTypeMalware + summary: Malicious (malware) component detected + value: | + vulns.all.exists(v, v.id.startsWith("MAL-")) + - name: ossf-dangerous-workflow + check_type: CheckTypeSecurityScorecard + summary: Component release pipeline appear to use dangerous workflows + value: | + scorecard.scores["Dangerous-Workflow"] == 0 diff --git a/.github/workflows/vet-ci.yml b/.github/workflows/vet-ci.yml new file mode 100644 index 0000000..37e9eff --- /dev/null +++ b/.github/workflows/vet-ci.yml @@ -0,0 +1,46 @@ +name: vet OSS Components + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + issues: write + pull-requests: write + security-events: write + +jobs: + vet: + name: vet + runs-on: ubuntu-latest + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + + - name: Enable Cloud Mode + run: echo "SAFEDEP_CLOUD_MODE=true" >> $GITHUB_ENV + + - name: Override Cloud Mode if Actor is Dependabot + if: github.actor == 'dependabot[bot]' + run: echo "SAFEDEP_CLOUD_MODE=false" >> $GITHUB_ENV + + - name: Override Cloud Mode if PR is from External Repository + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository + run: echo "SAFEDEP_CLOUD_MODE=false" >> $GITHUB_ENV + + - name: Run vet + uses: safedep/vet-action@01f547ee95dfd4f8f11fa64b399e5e00f22b0801 + with: + policy: .github/vet/policy.yml + cloud: ${{ env.SAFEDEP_CLOUD_MODE }} + cloud-key: ${{ secrets.SAFEDEP_CLOUD_API_KEY }} + cloud-tenant: ${{ secrets.SAFEDEP_CLOUD_TENANT_DOMAIN }} + enable-comments-proxy: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SAFEDEP_CLOUD_MODE: ${{ env.SAFEDEP_CLOUD_MODE }}