Commit 965d8c5826

965d8c5826e2e875e57a638aa5f3f6635308ec73

parent: eaaccbbdd7

Unsigned

Alicia Sykes <alicia@omg.lol> ยท 2026-05-17 09:05 UTC

Run listing review weekly

Layout: unified ยท split

.github/workflows/health-check.yml +2
@@ -12,6 +12,8 @@ on:
12 service: 12 service:
13 description: Just run for a specific entry (optional) 13 description: Just run for a specific entry (optional)
14 type: string 14 type: string
15 schedule:
16 - cron: '0 17 * * 5' # Weekly drift check. 5PM on a Friday, in time for weekend updates
15 17
16permissions: 18permissions:
17 contents: read 19 contents: read
lib/awesome-privacy-readme-gen.py +31 โˆ’29
@@ -20,11 +20,6 @@ app_list_file_path = os.path.join(project_root, 'awesome-privacy.yml')
20readme_path = os.path.join(project_root, '.github/README.md') 20readme_path = os.path.join(project_root, '.github/README.md')
21icon_size=14 21icon_size=14
22 22
23# Read the main YAML file, where all data lives
24logger.info("Reading the awesome-privacy file...")
25with open(app_list_file_path, 'r') as file:
26 data = yaml.safe_load(file)
27
28def iconElement(serviceUrl, serviceIcon): 23def iconElement(serviceUrl, serviceIcon):
29 path = serviceIcon or f"https://icon.horse/icon/{urlparse(serviceUrl).netloc}" 24 path = serviceIcon or f"https://icon.horse/icon/{urlparse(serviceUrl).netloc}"
30 return f"<img src='{path}' width='{icon_size}' alt='' />" 25 return f"<img src='{path}' width='{icon_size}' alt='' />"
@@ -73,7 +68,7 @@ def makeHref(text):
73 if not text: return "#" 68 if not text: return "#"
74 return re.sub(r'[^\w\s-]', '', text.lower()).replace(" ", "-") 69 return re.sub(r'[^\w\s-]', '', text.lower()).replace(" ", "-")
75 70
76def makeContents(): 71def makeContents(data):
77 contents = "<blockquote><details open>\n" 72 contents = "<blockquote><details open>\n"
78 contents += "<summary>๐Ÿ“‹ <b>Contents</b></summary>\n" 73 contents += "<summary>๐Ÿ“‹ <b>Contents</b></summary>\n"
79 74
@@ -88,7 +83,7 @@ def makeContents():
88 contents += "\n</details></blockquote>\n\n" 83 contents += "\n</details></blockquote>\n\n"
89 return contents 84 return contents
90 85
91def makeAwesomePrivacy(): 86def makeAwesomePrivacy(data):
92 markdown = "" 87 markdown = ""
93 for category in data.get('categories'): 88 for category in data.get('categories'):
94 markdown += f"## {category.get('name')}\n\n" 89 markdown += f"## {category.get('name')}\n\n"
@@ -145,13 +140,6 @@ def makeAwesomePrivacy():
145 markdown += "\n---\n\n" 140 markdown += "\n---\n\n"
146 return markdown 141 return markdown
147 142
148awesome_privacy_results = makeContents() + makeAwesomePrivacy()
149
150# Update the README.md between markers
151logger.info("Reading README.md file...")
152with open(readme_path, 'r') as file:
153 readme_content = file.read()
154
155def update_content_between_markers(content, start_marker, end_marker, new_content): 143def update_content_between_markers(content, start_marker, end_marker, new_content):
156 logger.info(f"Updating content between {start_marker} and {end_marker} markers...") 144 logger.info(f"Updating content between {start_marker} and {end_marker} markers...")
157 start_index = content.find(start_marker) 145 start_index = content.find(start_marker)
@@ -166,18 +154,32 @@ def update_content_between_markers(content, start_marker, end_marker, new_conten
166 logger.error(f"Markers {start_marker} and {end_marker} not found.") 154 logger.error(f"Markers {start_marker} and {end_marker} not found.")
167 return content 155 return content
168 156
169# Update guides and resources in README.md 157
170readme_content = update_content_between_markers( 158def main():
171 readme_content, 159 logger.info("Reading the awesome-privacy file...")
172 "<!-- awesome-privacy-start -->", 160 with open(app_list_file_path, 'r') as file:
173 "<!-- awesome-privacy-end -->", 161 data = yaml.safe_load(file)
174 awesome_privacy_results 162
175) 163 awesome_privacy_results = makeContents(data) + makeAwesomePrivacy(data)
176 164
177# Write back the updated content to README.md 165 logger.info("Reading README.md file...")
178logger.info("Writing back to README.md...") 166 with open(readme_path, 'r') as file:
179with open(readme_path, 'w') as file: 167 readme_content = file.read()
180 file.write(readme_content) 168
181 169 readme_content = update_content_between_markers(
182# All done. Time to go home for tea and medals. 170 readme_content,
183logger.info("Script completed successfully!") 171 "<!-- awesome-privacy-start -->",
172 "<!-- awesome-privacy-end -->",
173 awesome_privacy_results,
174 )
175
176 logger.info("Writing back to README.md...")
177 with open(readme_path, 'w') as file:
178 file.write(readme_content)
179
180 # All done. Time to go home for tea and medals.
181 logger.info("Script completed successfully!")
182
183
184if __name__ == "__main__":
185 main()
lib/checks/make-info-stats.py +14 โˆ’67
@@ -25,23 +25,20 @@ import sys
25from datetime import datetime, timezone 25from datetime import datetime, timezone
26from urllib.parse import urlparse 26from urllib.parse import urlparse
27 27
28import requests 28sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
29import utils
29 30
30DIFF_PATH = "/tmp/pr-diff.json" 31DIFF_PATH = "/tmp/pr-diff.json"
31OUTPUT_PATH = "/tmp/repo-stats.md" 32OUTPUT_PATH = "/tmp/repo-stats.md"
32TIMEOUT = 10 33TIMEOUT = 10
33MAX_SUBMISSIONS = 5 34MAX_SUBMISSIONS = 5
34USER_AGENT = "awesome-privacy-ci/1.0" 35USER_AGENT = "awesome-privacy-ci/1.0"
35AI_BOT_AUTHORS = [
36 "noreply@anthropic.com",
37 "devin-ai-integration[bot]",
38 "copilot-swe-agent.github.com",
39 "noreply@cursor.com",
40]
41RESTRICTIVE_LICENSES = { 36RESTRICTIVE_LICENSES = {
42 "AGPL-3.0-only", "AGPL-3.0-or-later", "SSPL-1.0", "BSL-1.0", "BUSL-1.1", 37 "AGPL-3.0-only", "AGPL-3.0-or-later", "SSPL-1.0", "BSL-1.0", "BUSL-1.1",
43} 38}
44 39
40SESSION = utils.make_session(user_agent=USER_AGENT)
41
45SITE_INFO_URL = "https://site-info-fetch.as93.workers.dev" 42SITE_INFO_URL = "https://site-info-fetch.as93.workers.dev"
46ANDROID_API_URL = "https://android-app-privacy.as93.net" 43ANDROID_API_URL = "https://android-app-privacy.as93.net"
47IOS_API_URL = "https://ios-app-info.as93.net" 44IOS_API_URL = "https://ios-app-info.as93.net"
@@ -52,11 +49,8 @@ GREEN, ORANGE, RED, BLUE, WHITE = "\U0001f7e2", "\U0001f7e0", "\U0001f534", "\U0
52 49
53def _api_get(url, params=None, timeout=TIMEOUT, headers=None): 50def _api_get(url, params=None, timeout=TIMEOUT, headers=None):
54 """GET a URL, return parsed JSON on 200, else None.""" 51 """GET a URL, return parsed JSON on 200, else None."""
55 hdrs = {"User-Agent": USER_AGENT}
56 if headers:
57 hdrs.update(headers)
58 try: 52 try:
59 resp = requests.get(url, headers=hdrs, timeout=timeout, params=params) 53 resp = SESSION.get(url, headers=headers, timeout=timeout, params=params)
60 if resp.status_code == 200: 54 if resp.status_code == 200:
61 return resp.json() 55 return resp.json()
62 except Exception as e: 56 except Exception as e:
@@ -88,17 +82,6 @@ def relative_time(iso_str):
88 return None 82 return None
89 83
90 84
91def _days_since(iso_str):
92 """Return number of days since an ISO timestamp, or None."""
93 if not iso_str:
94 return None
95 try:
96 dt = datetime.fromisoformat(iso_str.replace("Z", "+00:00"))
97 return (datetime.now(timezone.utc) - dt).days
98 except Exception:
99 return None
100
101
102def _friendly_date(iso_str): 85def _friendly_date(iso_str):
103 """Return relative time string with 'ago' suffix, falling back to raw string.""" 86 """Return relative time string with 'ago' suffix, falling back to raw string."""
104 if not iso_str: 87 if not iso_str:
@@ -131,28 +114,9 @@ def format_markdown(stats):
131 return "\n".join(f"- {emoji} **{label}:** {value}" for emoji, label, value in stats) 114 return "\n".join(f"- {emoji} **{label}:** {value}" for emoji, label, value in stats)
132 115
133 116
134def parse_github_field(value):
135 """Parse 'owner/repo' or full URL into (owner, repo) or (None, None)."""
136 if not value:
137 return None, None
138 if value.startswith("https://github.com/"):
139 parts = value.removeprefix("https://github.com/").strip("/").split("/")
140 if len(parts) >= 2:
141 return parts[0], parts[1]
142 return None, None
143 if "/" in value:
144 parts = value.split("/")
145 if len(parts) == 2:
146 return parts[0], parts[1]
147 return None, None
148
149
150def gh_get(path, token, params=None): 117def gh_get(path, token, params=None):
151 """GET a GitHub API endpoint. Returns JSON on 200, else None.""" 118 """GET a GitHub API endpoint. Returns JSON on 200, else None."""
152 headers = {"Accept": "application/vnd.github.v3+json"} 119 return utils.gh_get(path, token, session=SESSION, params=params, timeout=TIMEOUT, label="repos")
153 if token:
154 headers["Authorization"] = f"token {token}"
155 return _api_get(f"https://api.github.com{path}", params=params, headers=headers)
156 120
157 121
158def fetch_all_data(owner, repo, token): 122def fetch_all_data(owner, repo, token):
@@ -183,23 +147,9 @@ def fetch_all_data(owner, repo, token):
183 147
184 commits = gh_get(f"/repos/{owner}/{repo}/commits", token, {"per_page": 100}) 148 commits = gh_get(f"/repos/{owner}/{repo}/commits", token, {"per_page": 100})
185 if commits is not None: 149 if commits is not None:
186 bot_set = {a.lower() for a in AI_BOT_AUTHORS} 150 bot_set = {a.lower() for a in utils.AI_BOT_AUTHORS}
187 ai_count = 0
188 for c in commits:
189 author = c.get("commit", {}).get("author", {})
190 email = (author.get("email") or "").lower()
191 name = (author.get("name") or "").lower()
192 if email in bot_set or name in bot_set:
193 ai_count += 1
194 continue
195 message = (c.get("commit", {}).get("message") or "").lower()
196 for line in message.splitlines():
197 if line.strip().startswith("co-authored-by:"):
198 if any(bot in line for bot in bot_set):
199 ai_count += 1
200 break
201 data["commit_count"] = len(commits) 151 data["commit_count"] = len(commits)
202 data["ai_commit_count"] = ai_count 152 data["ai_commit_count"] = sum(1 for c in commits if utils.commit_has_bot(c, bot_set))
203 else: 153 else:
204 data["commit_count"] = None 154 data["commit_count"] = None
205 data["ai_commit_count"] = None 155 data["ai_commit_count"] = None
@@ -232,7 +182,7 @@ def grade_stats(data):
232 else: 182 else:
233 stats.append((GREEN, "License", lic.get("name") or spdx or "Present")) 183 stats.append((GREEN, "License", lic.get("name") or spdx or "Present"))
234 184
235 age_days = _days_since(data.get("created_at")) 185 age_days = utils.repo_age_days(data)
236 age_str = relative_time(data.get("created_at")) 186 age_str = relative_time(data.get("created_at"))
237 if age_days is None: 187 if age_days is None:
238 stats.append((WHITE, "Repo Age", "Unknown")) 188 stats.append((WHITE, "Repo Age", "Unknown"))
@@ -243,7 +193,7 @@ def grade_stats(data):
243 else: 193 else:
244 stats.append((RED, "Repo Age", age_str)) 194 stats.append((RED, "Repo Age", age_str))
245 195
246 updated_days = _days_since(data.get("pushed_at")) 196 updated_days = utils.repo_pushed_days_ago(data)
247 updated_str = _friendly_date(data.get("pushed_at")) 197 updated_str = _friendly_date(data.get("pushed_at"))
248 if updated_days is None: 198 if updated_days is None:
249 stats.append((WHITE, "Last Updated", "Unknown")) 199 stats.append((WHITE, "Last Updated", "Unknown"))
@@ -343,16 +293,13 @@ def check_security_txt(url):
343 base = f"{parsed.scheme}://{parsed.netloc}" 293 base = f"{parsed.scheme}://{parsed.netloc}"
344 for path in ("/.well-known/security.txt", "/security.txt"): 294 for path in ("/.well-known/security.txt", "/security.txt"):
345 try: 295 try:
346 resp = requests.get( 296 resp = SESSION.get(base + path, timeout=TIMEOUT, allow_redirects=True)
347 base + path, headers={"User-Agent": USER_AGENT},
348 timeout=TIMEOUT, allow_redirects=True,
349 )
350 if resp.status_code == 200 and "contact:" in resp.text.lower(): 297 if resp.status_code == 200 and "contact:" in resp.text.lower():
351 return True 298 return True
352 except Exception: 299 except Exception:
353 continue 300 continue
354 try: 301 try:
355 requests.head(base, headers={"User-Agent": USER_AGENT}, timeout=TIMEOUT) 302 SESSION.head(base, timeout=TIMEOUT)
356 return False 303 return False
357 except Exception: 304 except Exception:
358 return None 305 return None
@@ -545,7 +492,7 @@ def _resolve_args(argv):
545 result = {"name": None, "owner": None, "repo": None, "url": args.url, 492 result = {"name": None, "owner": None, "repo": None, "url": args.url,
546 "android": args.android, "ios": args.ios, "tosdr": args.tosdr} 493 "android": args.android, "ios": args.ios, "tosdr": args.tosdr}
547 if args.repo: 494 if args.repo:
548 owner, repo = parse_github_field(args.repo) 495 owner, repo = utils.parse_github_field(args.repo)
549 if not owner: 496 if not owner:
550 print(f"Invalid repo format: {args.repo}", file=sys.stderr) 497 print(f"Invalid repo format: {args.repo}", file=sys.stderr)
551 sys.exit(1) 498 sys.exit(1)
@@ -570,7 +517,7 @@ def _resolve_args(argv):
570 for yaml_key, result_key in field_map.items(): 517 for yaml_key, result_key in field_map.items():
571 if fields.get(yaml_key): 518 if fields.get(yaml_key):
572 if yaml_key == "github": 519 if yaml_key == "github":
573 result["owner"], result["repo"] = parse_github_field(fields[yaml_key]) 520 result["owner"], result["repo"] = utils.parse_github_field(fields[yaml_key])
574 else: 521 else:
575 result[result_key] = str(fields[yaml_key]) 522 result[result_key] = str(fields[yaml_key])
576 if any(v for k, v in result.items() if k != "name"): 523 if any(v for k, v in result.items() if k != "name"):
lib/review-listings.py +19 โˆ’5
@@ -20,7 +20,13 @@ Checks:
20- github-fork: github repo is not a fork (needs token) 20- github-fork: github repo is not a fork (needs token)
21 21
22Findings have three severities: error (must fix), warn (should review), info (FYI). 22Findings have three severities: error (must fix), warn (should review), info (FYI).
23HTTP 403/429 on reachability checks is demoted from error to warn (bot-blocking). 23HTTP 403/406/429 (and 404 on known bot-blocking hosts such as play.google.com) on
24reachability checks is demoted from error to warn.
25
26Exit codes:
27 1 when pass rate drops below FAIL_PASS_RATE or errors exceed FAIL_MAX_ERRORS (5)
28 2 you didn't run the script right / something else fucked up
29 0 everything is amazing
24 30
25Flags: 31Flags:
26- --save-json PATH: save a JSON report to this file 32- --save-json PATH: save a JSON report to this file
@@ -49,6 +55,7 @@ from datetime import datetime, timezone
49from threading import Lock 55from threading import Lock
50from time import monotonic 56from time import monotonic
51from typing import Callable, Iterable 57from typing import Callable, Iterable
58from urllib.parse import urlparse
52 59
53sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) 60sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
54try: 61try:
@@ -73,9 +80,13 @@ ACTIVITY_BANDS = (
73SEVERITIES = ("error", "warn", "info") 80SEVERITIES = ("error", "warn", "info")
74_SEV_COLOR = {"error": "red", "warn": "yellow", "info": "cyan"} 81_SEV_COLOR = {"error": "red", "warn": "yellow", "info": "cyan"}
75_SEV_EMOJI = {"error": "๐Ÿ”ด", "warn": "๐ŸŸ ", "info": "๐ŸŸก"} 82_SEV_EMOJI = {"error": "๐Ÿ”ด", "warn": "๐ŸŸ ", "info": "๐ŸŸก"}
76_SOFT_HTTP = {403, 429} 83_SOFT_HTTP = {403, 406, 429}
84_SOFT_404_HOSTS = {"play.google.com"}
77_PKG_RE = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$") 85_PKG_RE = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$")
78 86
87FAIL_PASS_RATE = 95.0
88FAIL_MAX_ERRORS = 5
89
79 90
80@dataclass 91@dataclass
81class Entry: 92class Entry:
@@ -150,8 +161,10 @@ def _get_repo(entry: Entry, ctx: Context):
150 161
151 162
152def _unreachable(field, url, status, default_sev): 163def _unreachable(field, url, status, default_sev):
153 """Return (severity, message). 403/429 demote error to warn.""" 164 """Return (severity, message). Bot-blocking signatures demote error to warn."""
154 sev = "warn" if default_sev == "error" and status in _SOFT_HTTP else default_sev 165 host = urlparse(url).netloc.lower()
166 soft = status in _SOFT_HTTP or (status == 404 and host in _SOFT_404_HOSTS)
167 sev = "warn" if default_sev == "error" and soft else default_sev
155 detail = f"{url} returned HTTP {status}" if status else f"{url} could not be reached" 168 detail = f"{url} returned HTTP {status}" if status else f"{url} could not be reached"
156 return sev, f"{field} is unreachable, {detail}" 169 return sev, f"{field} is unreachable, {detail}"
157 170
@@ -701,7 +714,8 @@ def main():
701 except OSError as exc: 714 except OSError as exc:
702 logging.warning("Could not write %s: %s", path, exc) 715 logging.warning("Could not write %s: %s", path, exc)
703 716
704 sys.exit(1 if any(f.severity == "error" for f in findings) else 0) 717 fail = summary["pass_rate"] < FAIL_PASS_RATE or summary["errors"] > FAIL_MAX_ERRORS
718 sys.exit(1 if fail else 0)
705 719
706 720
707if __name__ == "__main__": 721if __name__ == "__main__":
lib/utils/data.py +4 โˆ’3
@@ -30,6 +30,7 @@ def slugify(title):
30 """Match the slug format used by awesome-privacy.xyz and the README generator.""" 30 """Match the slug format used by awesome-privacy.xyz and the README generator."""
31 if not title: 31 if not title:
32 return "" 32 return ""
33 title = re.sub(r"[+&]", "and", title.lower()) 33 title = title.lower()
34 title = re.sub(r"\s+", "-", title) 34 title = re.sub(r"\s", "-", title)
35 return re.sub(r"[^a-z0-9-]", "", title) 35 title = re.sub(r"[+&]", "and", title)
36 return title.replace("?", "")
lib/utils/http.py +19 โˆ’9
@@ -1,6 +1,7 @@
1"""HTTP session and URL reachability helpers.""" 1"""HTTP session and URL reachability helpers."""
2 2
3import logging 3import logging
4import time
4 5
5import requests 6import requests
6 7
@@ -8,6 +9,7 @@ DEFAULT_TIMEOUT = 10
8DEFAULT_USER_AGENT = ( 9DEFAULT_USER_AGENT = (
9 "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" 10 "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
10) 11)
12_RETRY_BACKOFF = 1.0 # in seconds. one retry attempt on transient failures
11 13
12 14
13def make_session(user_agent=DEFAULT_USER_AGENT): 15def make_session(user_agent=DEFAULT_USER_AGENT):
@@ -19,12 +21,20 @@ def make_session(user_agent=DEFAULT_USER_AGENT):
19def check_url(url, session=None, timeout=DEFAULT_TIMEOUT): 21def check_url(url, session=None, timeout=DEFAULT_TIMEOUT):
20 """Return (ok, status_code). ok=True for 2xx/3xx; returns (True, None) on transport error.""" 22 """Return (ok, status_code). ok=True for 2xx/3xx; returns (True, None) on transport error."""
21 session = session or make_session() 23 session = session or make_session()
22 try: 24 for attempt in range(2):
23 resp = session.head(url, timeout=timeout, allow_redirects=True) 25 try:
24 if resp.status_code >= 400: 26 resp = session.head(url, timeout=timeout, allow_redirects=True)
25 resp = session.get(url, timeout=timeout, allow_redirects=True, stream=True) 27 if resp.status_code >= 400:
26 resp.close() 28 resp = session.get(url, timeout=timeout, allow_redirects=True, stream=True)
27 return resp.status_code < 400, resp.status_code 29 resp.close()
28 except requests.RequestException as exc: 30 status = resp.status_code
29 logging.debug("URL check error for %s: %s", url, exc) 31 if 500 <= status < 600 and attempt == 0:
30 return True, None 32 time.sleep(_RETRY_BACKOFF)
33 continue
34 return status < 400, status
35 except requests.RequestException as exc:
36 logging.debug("URL check error for %s (attempt %d): %s", url, attempt + 1, exc)
37 if attempt == 0:
38 time.sleep(_RETRY_BACKOFF)
39 continue
40 return True, None