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