Skip to content

feat(rust-ci-reusable): real owned coverage gate (llvm-cov + ratchete… #459

feat(rust-ci-reusable): real owned coverage gate (llvm-cov + ratchete…

feat(rust-ci-reusable): real owned coverage gate (llvm-cov + ratchete… #459

# SPDX-License-Identifier: MPL-2.0
# Prevention workflow - runs OpenSSF Scorecard and fails on low scores
name: OpenSSF Scorecard Enforcer
on:
push:
branches: [main]
schedule:
- cron: '0 6 * * 1' # Weekly on Monday
workflow_dispatch:
permissions:
contents: read
jobs:
scorecard:
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write # For OIDC
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Run Scorecard
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.json
results_format: json
publish_results: true
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: scorecard-results
path: results.json
retention-days: 5
check-score:
needs: scorecard
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: scorecard-results
- name: Check minimum score
run: |
# Parse score from results.json
SCORE=$(jq -r '.score // 0' results.json 2>/dev/null || echo "0")
echo "OpenSSF Scorecard Score: $SCORE"
# Minimum acceptable score (0-10 scale)
MIN_SCORE=5
if [ "$(echo "$SCORE < $MIN_SCORE" | bc -l)" = "1" ]; then
echo "::error::Scorecard score $SCORE is below minimum $MIN_SCORE"
exit 1
fi
check-critical:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Check SECURITY.md exists
run: |
if [ ! -f "SECURITY.md" ]; then
echo "::error::SECURITY.md is required"
exit 1
fi
- name: Check for pinned dependencies
run: |
# Check workflows for unpinned actions
unpinned=$(grep -r "uses:.*@v[0-9]" .github/workflows/*.yml 2>/dev/null | grep -v "#" | head -5 || true)
if [ -n "$unpinned" ]; then
echo "::warning::Found unpinned actions:"
echo "$unpinned"
fi