Commit e1021181dd
Unsigned
Layout: unified · split
.github/CONTRIBUTING.md +3
| @@ -307,6 +307,9 @@ Below is the full list of checks - it's basically the same as what is listed in | ||
| 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) |
| 310 | - 🟡 **Trackers** - Android app should not have privacy-invasive trackers | |
| 311 | - 🟡 **De-Googled** - Android app should not be broken without Google Play Services | |
| 312 | - 🟡 **Privacy policy** - Privacy policy should not be graded poorly (via ToS;DR) | |
| 310 | 313 | - 🟡 **Spam detection** - Flags if the author opened ≥3 PRs to other awesome-* repos, or PRs across ≥7 distinct repos, in the last 2 days |
| 311 | 314 | - **Addition Info** (fyi only, no pass/fail requirements or warnings) |
| 312 | 315 | - 🔵 **Website check** (if has `url`) - Quickly checks for basic security requirements for website |
lib/checks/check-project.py +54 −1
| @@ -33,6 +33,8 @@ SPAM_AWESOME_THRESHOLD = 3 | ||
| 33 | 33 | SPAM_DISTINCT_REPO_THRESHOLD = 7 |
| 34 | 34 | SPAM_WINDOW_DAYS = 2 |
| 35 | 35 | NEW_ACCOUNT_DAYS = 14 |
| 36 | TRACKER_LIMIT = 2 | |
| 37 | POOR_PRIVACY_GRADES = {"D", "E"} | |
| 36 | 38 | |
| 37 | 39 | SESSION = utils.make_session(user_agent=USER_AGENT) |
| 38 | 40 | API_TOKEN = os.environ.get("API_TOKEN", "") |
| @@ -105,6 +107,18 @@ SECURITY_POLICY_MSG = ( | ||
| 105 | 107 | "This repository has neither a security policy nor private" |
| 106 | 108 | " vulnerability reporting enabled, so there's no clear way to report security issues" |
| 107 | 109 | ) |
| 110 | TRACKERS_MSG = ( | |
| 111 | "The Android app contains multiple known trackers, according to Exodus Privacy." | |
| 112 | " Please confirm these are justified" | |
| 113 | ) | |
| 114 | DEGOOGLED_MSG = ( | |
| 115 | "The Android app is reported as broken on de-Googled Android" | |
| 116 | " (without Google Play Services), according to Plexus" | |
| 117 | ) | |
| 118 | PRIVACY_GRADE_MSG = ( | |
| 119 | "The privacy policy for this service is graded as poor by ToS;DR," | |
| 120 | " indicating serious privacy concerns" | |
| 121 | ) | |
| 108 | 122 | |
| 109 | 123 | |
| 110 | 124 | def load_diff(path): |
| @@ -228,6 +242,44 @@ def check_security_policy(owner, repo, token): | ||
| 228 | 242 | return None |
| 229 | 243 | |
| 230 | 244 | |
| 245 | def check_android_app(pkg): | |
| 246 | """Return findings for an Android app with multiple trackers or broken de-Googled support.""" | |
| 247 | findings = [] | |
| 248 | try: | |
| 249 | app = utils.fetch_android_app(pkg, API_TOKEN, session=SESSION, timeout=TIMEOUT, label=pkg) | |
| 250 | if (utils.tracker_count(app) or 0) >= TRACKER_LIMIT: | |
| 251 | findings.append(TRACKERS_MSG) | |
| 252 | if utils.degoogled_status(app) == "broken": | |
| 253 | findings.append(DEGOOGLED_MSG) | |
| 254 | except Exception as exc: | |
| 255 | logger.warning("check_android_app error for %s: %s", pkg, exc) | |
| 256 | return findings | |
| 257 | ||
| 258 | ||
| 259 | def check_privacy_grade(tosdr_id): | |
| 260 | """Return PRIVACY_GRADE_MSG if the service's ToS;DR grade is poor.""" | |
| 261 | try: | |
| 262 | policy = utils.fetch_privacy(tosdr_id, API_TOKEN, session=SESSION, timeout=TIMEOUT, | |
| 263 | label=str(tosdr_id)) | |
| 264 | if utils.privacy_grade(policy) in POOR_PRIVACY_GRADES: | |
| 265 | return PRIVACY_GRADE_MSG | |
| 266 | except Exception as exc: | |
| 267 | logger.warning("check_privacy_grade error for %s: %s", tosdr_id, exc) | |
| 268 | return None | |
| 269 | ||
| 270 | ||
| 271 | def check_privacy_signals(diff): | |
| 272 | """Check trackers, de-Googled support and ToS;DR grade for added services.""" | |
| 273 | findings = [] | |
| 274 | for svc in get_services(diff, "added"): | |
| 275 | fields = svc.get("fields", {}) | |
| 276 | if fields.get("androidApp"): | |
| 277 | findings.extend(check_android_app(fields["androidApp"])) | |
| 278 | if fields.get("tosdrId"): | |
| 279 | findings.append(check_privacy_grade(fields["tosdrId"])) | |
| 280 | return [f for f in dict.fromkeys(findings) if f] | |
| 281 | ||
| 282 | ||
| 231 | 283 | def check_spam_prs(pr_user, token): |
| 232 | 284 | """Return list of spam findings based on recent PR activity.""" |
| 233 | 285 | if not pr_user: |
| @@ -420,7 +472,7 @@ def main(): | ||
| 420 | 472 | try: |
| 421 | 473 | pr_user = os.environ.get("PR_USER", "") |
| 422 | 474 | token = os.environ.get("GITHUB_TOKEN", "") |
| 423 | logger.info("Checking project health: links, spam, account age, duplicate URLs, repo signals") | |
| 475 | logger.info("Checking project health: links, spam, account age, duplicate URLs, privacy, repo signals") | |
| 424 | 476 | logger.info("PR_USER=%s, GITHUB_TOKEN=%s", pr_user or "(empty)", "present" if token else "MISSING") |
| 425 | 477 | |
| 426 | 478 | diff = load_diff(DIFF_PATH) |
| @@ -451,6 +503,7 @@ def main(): | ||
| 451 | 503 | if finding: |
| 452 | 504 | findings.append(finding) |
| 453 | 505 | |
| 506 | findings.extend(check_privacy_signals(diff)) | |
| 454 | 507 | findings.extend(check_repo_signals(diff, pr_user, token, pr_body)) |
| 455 | 508 | except Exception as exc: |
| 456 | 509 | logger.error("Unhandled error in main: %s", exc, exc_info=True) |