AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
ci: add OpenSSF Scorecard workflow to track security-health drift (#555) (#557)
Aniruddh Jha36af50f1b676
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.ymlnew file mode 100644index 00000000..44f02c1a--- /dev/null+++ b/.github/workflows/scorecard.yml@@ -0,0 +1,69 @@+name: Scorecard++# OpenSSF Scorecard tracks broader repo security-health drift (branch+# protection, token permissions, pinned actions, dangerous workflows, CI+# tests, maintenance signals) on a schedule, complementing the per-diff+# dependency-audit and secret-scan jobs in security.yml.+#+# Advisory-first: this workflow only measures and publishes a score, and it+# never blocks merges. It runs on the default branch (Scorecard needs repo-level+# data and a token, so it is not meaningful on PR forks) plus a weekly schedule+# so regressions in security health surface even when no code changes.++on:+ branch_protection_rule:+ schedule:+ # Weekly, Mondays at 07:00 UTC.+ - cron: '0 7 * * 1'+ push:+ branches:+ - main+ workflow_dispatch:++# Top-level token is read-only; the analysis job widens only what it needs.+permissions: read-all++jobs:+ analysis:+ name: Scorecard analysis+ runs-on: ubuntu-latest+ # Job-level permissions fully replace the top-level block (unlisted scopes+ # default to none), so the reads checkout and Scorecard need are explicit.+ permissions:+ # Needed by actions/checkout to clone the repo, and by Scorecard to read+ # workflow files for its Dangerous-Workflow / Token-Permissions checks.+ contents: read+ actions: read+ # Needed to upload the SARIF results to the code-scanning dashboard.+ security-events: write+ # Needed to publish results and obtain a badge (uses OIDC, no secrets).+ id-token: write++ steps:+ - name: Checkout+ uses: actions/checkout@v4+ with:+ persist-credentials: false++ - name: Run OpenSSF Scorecard+ uses: ossf/[email protected]+ with:+ results_file: scorecard.sarif+ results_format: sarif+ # Publishes results to the OpenSSF REST API for the public badge and+ # trend tracking. Set to false if maintainers prefer to keep the+ # score private (the SARIF upload below still works either way).+ publish_results: true++ # Retain the raw SARIF as a build artifact for offline inspection.+ - name: Upload artifact+ uses: actions/upload-artifact@v4+ with:+ name: scorecard-sarif+ path: scorecard.sarif+ retention-days: 5++ - name: Upload SARIF to code-scanning+ uses: github/codeql-action/upload-sarif@v3+ with:+ sarif_file: scorecard.sarifdiff --git a/tests/test_scorecard_workflow.py b/tests/test_scorecard_workflow.pynew file mode 100644index 00000000..b861a56e--- /dev/null+++ b/tests/test_scorecard_workflow.py@@ -0,0 +1,53 @@+from pathlib import Path+++ROOT = Path(__file__).resolve().parents[1]+WORKFLOW = ROOT / ".github" / "workflows" / "scorecard.yml"+++def _workflow_text() -> str:+ return WORKFLOW.read_text(encoding="utf-8")+++def test_scorecard_workflow_exists() -> None:+ assert WORKFLOW.is_file()+++def test_scorecard_runs_ossf_action_and_uploads_sarif() -> None:+ text = _workflow_text()++ assert "ossf/scorecard-action" in text+ assert "github/codeql-action/upload-sarif" in text+ assert "results_format: sarif" in text+++def test_scorecard_runs_on_schedule_and_default_branch() -> None:+ text = _workflow_text()++ # A weekly schedule surfaces security-health regressions even with no code+ # changes; push-to-main keeps the score fresh on every merge.+ assert "schedule:" in text+ assert "cron:" in text+ assert "branches:" in text+ assert "- main" in text+++def test_scorecard_requests_minimal_permissions() -> None:+ text = _workflow_text()++ # Top-level is read-only; only the analysis job widens what it needs.+ assert "permissions: read-all" in text+ # Job-level permissions fully replace the top-level block, so the reads+ # checkout and Scorecard require must be listed explicitly or they default+ # to none and every run fails.+ assert "contents: read" in text+ assert "actions: read" in text+ assert "security-events: write" in text+ assert "id-token: write" in text+++def test_scorecard_documents_advisory_policy() -> None:+ text = _workflow_text()++ assert "advisory-first" in text.lower()+ assert "never blocks merges" in text.lower()