Commit 014e268bda
014e268bda743fe295b408cad0458953bb86f54c
parent: 0d22adce5c
Unsigned
Alicia Sykes <alicia@omg.lol> · 2026-10-10 17:10 UTC
Fixes the check for unpatched security advisories
Layout: unified · split
.github/CONTRIBUTING.md
+1 −1
| @@ -303,7 +303,7 @@ Below is the full list of checks - it's basically the same as what is listed in |
| 303 | 303 | - 🟡 **Not a fork** - Flags if the GitHub link is a fork instead of source |
| 304 | 304 | - 🟡 **Has license** - Repo should include a license |
| 305 | 305 | - 🟡 **Not archived** - Repo must not be archived |
| 306 | | - 🟡 **No security alerts** - No open critical/high Dependabot alerts |
| 306 | - 🟡 **No security alerts** - No unpatched critical/high security advisories published for the repo |
| 307 | 307 | - 🟡 **Security policy** - Repo should have a security policy (SECURITY.md) and/or private vulnerability reporting enabled |
| 308 | 308 | - 🟡 **Minimum stars** - Repo should have ≥100 stars |
| 309 | 309 | - 🟡 **Bus factor** - Flags if ≥96% of commits come from a single contributor (bots and AI excluded) |
.github/workflows/pr-check.yml
+1 −1
| @@ -11,7 +11,6 @@ on: |
| 11 | 11 | permissions: |
| 12 | 12 | contents: read |
| 13 | 13 | pull-requests: read |
| 14 | | security-events: read |
| 15 | 14 | |
| 16 | 15 | jobs: |
| 17 | 16 | pr-compliance: |
| @@ -147,6 +146,7 @@ jobs: |
| 147 | 146 | PR_USER: ${{ github.event.pull_request.user.login }} |
| 148 | 147 | PR_BODY: ${{ github.event.pull_request.body }} |
| 149 | 148 | GITHUB_TOKEN: ${{ github.token }} |
| 149 | API_TOKEN: ${{ secrets.API_TOKEN }} |
| 150 | 150 | run: python lib/checks/check-project.py |
| 151 | 151 | - name: Generate repo stats |
| 152 | 152 | continue-on-error: true |
lib/checks/check-project.py
+13 −10
| @@ -35,6 +35,7 @@ SPAM_WINDOW_DAYS = 2 |
| 35 | 35 | NEW_ACCOUNT_DAYS = 14 |
| 36 | 36 | |
| 37 | 37 | SESSION = utils.make_session(user_agent=USER_AGENT) |
| 38 | API_TOKEN = os.environ.get("API_TOKEN", "") |
| 38 | 39 | |
| 39 | 40 | LINK_MSG = ( |
| 40 | 41 | "The link(s) you included seem to be returning a 404." |
| @@ -74,8 +75,8 @@ ARCHIVED_MSG = ( |
| 74 | 75 | " Additions must be actively maintained" |
| 75 | 76 | ) |
| 76 | 77 | SECURITY_MSG = ( |
| 77 | | "This project has open security vulnerabilities (critical or high severity)" |
| 78 | | " flagged by GitHub Dependabot. Please verify these have been addressed" |
| 78 | "This project has published security advisories (critical or high severity)" |
| 79 | " with no patched version listed. Please verify these have been addressed" |
| 79 | 80 | ) |
| 80 | 81 | SPAM_AWESOME_MSG = ( |
| 81 | 82 | "You have made many similar submissions on other awesome-* repos today." |
| @@ -200,13 +201,15 @@ def check_ai_commits(owner, repo, token): |
| 200 | 201 | return None |
| 201 | 202 | |
| 202 | 203 | |
| 203 | | def check_security_alerts(owner, repo, token): |
| 204 | | """Return SECURITY_MSG if the repo has open critical/high Dependabot alerts.""" |
| 205 | | alerts = _gh_get(f"/repos/{owner}/{repo}/dependabot/alerts", token, |
| 206 | | params={"state": "open", "severity": "critical,high", "per_page": 1}, |
| 207 | | label="dependabot") |
| 208 | | if alerts: |
| 209 | | return SECURITY_MSG |
| 204 | def check_security_alerts(owner, repo): |
| 205 | """Return SECURITY_MSG if the repo has unpatched critical/high security advisories.""" |
| 206 | try: |
| 207 | report = utils.fetch_security_report(owner, repo, API_TOKEN, session=SESSION, |
| 208 | timeout=TIMEOUT, label=f"{owner}/{repo}") |
| 209 | if utils.unpatched_advisories(report)[1]: |
| 210 | return SECURITY_MSG |
| 211 | except Exception as exc: |
| 212 | logger.warning("check_security_alerts error for %s/%s: %s", owner, repo, exc) |
| 210 | 213 | return None |
| 211 | 214 | |
| 212 | 215 | |
| @@ -395,7 +398,7 @@ def check_repo_signals(diff, pr_user, token, pr_body=""): |
| 395 | 398 | findings.append(finding) |
| 396 | 399 | |
| 397 | 400 | if SECURITY_MSG not in findings: |
| 398 | | finding = check_security_alerts(owner, repo, token) |
| 401 | finding = check_security_alerts(owner, repo) |
| 399 | 402 | if finding: |
| 400 | 403 | findings.append(finding) |
| 401 | 404 | |