Python
Revert "Add exposure-audit skill (18 skills, v1.1.0)"
Charlie Hills43d6fc4b8d6e
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 575bb21..dccc4f3 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -8,8 +8,8 @@{"name": "social-media-skills","source": ".",- "description": "The complete set of Claude skills behind Charlie Hills' content system. 415k+ followers across LinkedIn, Instagram, Substack, X and YouTube. 100m+ views per year. 18 skills covering voice, LinkedIn, Instagram Reels, YouTube thumbnails, analytics, community and security.",- "version": "1.1.0",+ "description": "The complete set of Claude skills behind Charlie Hills' content system. 350k+ followers across LinkedIn, Instagram, Substack, X and YouTube. 100m+ views per year. 18 skills covering voice, LinkedIn, Instagram Reels, YouTube thumbnails, analytics, and community.",+ "version": "1.0.0","metadata": {"categories": ["voice",@@ -17,8 +17,7 @@"reels","youtube","analytics",- "community",- "security"+ "community"],"tags": ["content creation",@@ -29,10 +28,7 @@"apify","elevenlabs","heygen",- "remotion",- "security audit",- "api keys",- "secret scanning"+ "remotion"]}}diff --git a/README.md b/README.mdindex 0b1a469..42ba440 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@# Social Media Skills for AI Agents-The complete set of Claude skills behind Charlie Hills' content system. 415k+ followers across LinkedIn, Instagram, Substack, X and YouTube. 100m+ views per year. All running through one system that starts with the newsletter and flows out to every other channel.+The complete set of Claude skills behind Charlie Hills' content system. 350k+ followers across LinkedIn, Instagram, Substack, X and YouTube. 100m+ views per year. All running through one system that starts with the newsletter and flows out to every other channel.Built by [Charlie Hills](https://charliehills.substack.com). Subscribe to the [MarTech AI newsletter](https://charliehills.substack.com) for weekly breakdowns of how this system works in practice.@@ -71,7 +71,6 @@ See each skill's `SKILL.md` for trigger phrases, inputs, and dependencies.| [gemini-carousel](skills/gemini-carousel/) | Slide-by-slide carousel generator with an approval gate. || [quote-post](skills/quote-post/) | Claude writes the quote, Gemini recreates the image with the quote baked in. || [analytics-dashboard](skills/analytics-dashboard/) | LinkedIn Analytics export to interactive React dashboard plus 5 data-backed recommendations. |-| [exposure-audit](skills/exposure-audit/) | Sweep your own machine for live API keys in cloud-synced folders, secrets in public repo history, and abandoned deployments. Scopes first, never prints a secret, marks what it could not finish. |<!-- SKILLS:END -->## Installation@@ -130,7 +129,6 @@ Once installed, ask Claude to help with content tasks and it will pick the right"Turn this outlier Reel into a script" → reels-scripting"I need a thumbnail for 'How I fired my team'" → youtube-thumbnail"Write me a pinned comment" → pinned-comment-"Am I exposed / did I leak a key" → exposure-audit```## Skill Categories@@ -164,9 +162,6 @@ Once installed, ask Claude to help with content tasks and it will pick the right### Analytics- `analytics-dashboard` — LinkedIn export to dashboard + 5 recommendations-### Security-- `exposure-audit` — 20-point sweep of your own setup: synced-folder keys, public repo history, abandoned deployments-## PrerequisitesA few skills need external services. Set these environment variables before use:diff --git a/VERSIONS.md b/VERSIONS.mdindex 35d9b34..8ce95d1 100644--- a/VERSIONS.md+++ b/VERSIONS.md@@ -1,17 +1,5 @@# Versions-## 1.1.0 — 2026-08-12--Adds `exposure-audit`. 18 skills.--**Security**-- exposure-audit — a 20-point sweep of your own setup, run in the right order: scope the- surface first, then score the checklist against it. Catches the three things published- vulnerability lists miss — live keys inside cloud-synced folders, unrevoked keys from- products that were shut down, and abandoned deployments still holding environment- variables. Never prints a secret value, never calls a state-changing endpoint, and- reports NOT RUN instead of guessing when a check does not complete.-## 1.0.0 — 2026-04-22Initial release. 17 skills covering the full content system documented in the MarTech AI newsletter.diff --git a/skills/exposure-audit/SKILL.md b/skills/exposure-audit/SKILL.mddeleted file mode 100644index 9f93e56..0000000--- a/skills/exposure-audit/SKILL.md+++ /dev/null@@ -1,128 +0,0 @@-----name: exposure-audit-description: >- Audit what you are actually exposed to — live API keys sitting in cloud-synced folders, secrets committed to public repos, unauthenticated local services, abandoned deployments still holding environment variables, and the twenty classic vibe-coding app vulnerabilities. Use this skill whenever the user says "am I exposed", "check my security", "did I leak a key", "is anything of mine hackable", "audit my machine", "check my repos for secrets", "are we at risk of this", or pastes a security scare (a reel, a thread, a news story, a vulnerability list) and wants to know whether it applies to them. Also use it before making a repo public, before handing a project to a collaborator, and after shutting a product down. Reach for it even when the user does not say the word "security" — if the honest answer needs to know what is actually exposed, audit first, then answer.------# Exposure Audit--Most people running this are not shipping a SaaS with users, a database and file-uploads. So most published vulnerability checklists mostly do not apply, and saying-"you're fine" after skimming one is useless.--The real exposure is usually a different shape: **live credentials in the wrong place**,-and **things that were switched off but are still switched on somewhere**. The first-audit run with this method found live production API keys sitting in a cloud-synced-folder, one of them a payments key for a business that had closed a month earlier. Every-app-vulnerability item on the twenty-point list came back clean or not-applicable.--That is the lesson to carry in: scope the surface before running the checklist, or you-will spend the whole audit writing N/A next to things the user was never at risk of, and-miss the thing that can actually cost them money.--## The order that works--**1. Scope first, checklist second.**-Run `scripts/scan.sh` before reading any checklist. It answers: which repos exist and-which are public, what is listening, what is deployed, which domains resolve. Until you-know the surface, you cannot say whether "row-level security off" is a finding or a-non-event.--**2. Run the sweep.**--```bash-bash skills/exposure-audit/scripts/scan.sh-```--Adjust the path to wherever the skill is installed (`~/.claude/skills/exposure-audit/`-for a user-scoped install). Two optional inputs:--```bash-DOMAINS="yoursite.com another.com" \-SYNC_DIRS="$HOME/Desktop $HOME/Dropbox" \-bash skills/exposure-audit/scripts/scan.sh-```--Takes 3-6 minutes. Writes a plain-text findings file to a temp path and prints it. Every-line is prefixed with a marker (`FINDING:`, `CLEAN:`, `NOTRUN:`, `SCOPE:`) so you can-read it straight into the report without re-deriving anything.--It never prints a secret value. Where it needs to prove a key is live-format, it prints-the variable name and the first 7 characters only. Keep that discipline in everything-you write afterwards — the report gets read on a screen, sometimes a shared one.--**3. Map the findings against `references/checklist-20.md`.**-That file has the twenty classic vibe-coding vulnerabilities, each with the exact check,-what counts as a pass, and the condition under which it is genuinely not applicable.-Read it after the scan, not before.--**4. Chase what the scan could not reach.**-Cloud-sync clients (Google Drive, iCloud, Dropbox, OneDrive) do not always materialise a-file locally, so a read just hangs. The scan wraps every synced-folder read in a-`perl -e 'alarm N'` guard and emits `NOTRUN:` when it stalls. Those are not clean, and-they are not findings either. Retry each one once. If it stalls again, it ships as-**NOT RUN** with the reason.--Writing "clean" over a check that never completed is the one failure that makes the whole-audit worthless.--**5. Write the report.**-Use `assets/report-template.html`. Structure, in this order:--- **Verdict** — one sentence. How many of the checklist items actually bite, and what the- real exposure is. If the honest headline is "the list mostly does not apply to you, but- here are two live keys", say exactly that.-- **Do now** — ranked. Live credentials always outrank everything else, because a key- that can move money or spend budget is the only category with an unbounded downside.-- **Later** — local-only and low-impact, with a one-line reason it can wait.-- **Clean** — what was checked and passed, each with the method. This section is not- padding. It is the difference between "I looked and it's fine" and "I ran these- commands and here is what they returned".-- **All 20** — the item-by-item table, with N/A items carrying a reason, not a shrug.--Every finding gets a **Fix** line that is a specific action, not advice. "Revoke it in-the payment provider's dashboard, then delete the file" beats "consider rotating-credentials". Where the order matters, say why — revoking before deleting matters because-deleting a synced file locally leaves the key in that service's version history.--Open the finished file in the browser and print the absolute path on its own line.--## Rules that stop this audit doing harm--- **Never print a secret value.** Variable name plus a 7-character prefix is enough to- prove a key is real and live-format. The full string is never needed to make the point.-- **Never call an endpoint that changes state to test it.** A queue-draining route like- `GET /messages` destroys real data the moment you probe it. Probe `/health` instead and- reason about the rest. Say in the report that you inferred it rather than tested it.-- **Never `curl -L`.** A dead page that redirects to a homepage returns 200 and reads as- alive. Follow nothing, and judge the status code you actually got.-- **Respect each site's terms.** Some platforms prohibit automated access outright. Check- before pointing a browser or a scraper at one.-- **Do not fix anything.** This skill reports. Revoking a key, deleting a deployment and- rotating a token are the user's calls, and some are irreversible. Rank them, make each- one a two-minute action, and let them press the button.--## Reporting honestly--Report every finding you have evidence for, ranked, including the ones that turn out to-be low. Suppressing a minor finding to keep the report tidy removes the user's ability to-judge it. Ranking is the filter, never omission.--Three states, and they are not interchangeable:--- **Finding** — you ran a check and it failed. Name the command's result.-- **Clean** — you ran a check and it passed. Name the method.-- **NOT RUN** — the check did not complete. Say why, and what would complete it.--An audit that quietly turns a stalled read into a clean result is worse than no audit,-because the user will act on it.--## Scope and limits--- Built and tested on macOS. `lsof` and the synced-folder defaults are macOS shaped;- Linux works with minor adjustment, Windows is untested.-- Requires `git`, `curl` and `perl`. Uses the GitHub CLI (`gh`) for repository visibility- and `npm` for the dependency check. Each is optional — the sweep marks anything it- cannot run as `NOTRUN:` rather than skipping it silently.-- It reads. It never writes to a repo, never revokes anything, never calls a- state-changing endpoint.diff --git a/skills/exposure-audit/assets/report-template.html b/skills/exposure-audit/assets/report-template.htmldeleted file mode 100644index ec03f2b..0000000--- a/skills/exposure-audit/assets/report-template.html+++ /dev/null@@ -1,123 +0,0 @@-<!DOCTYPE html>-<!--- exposure-audit report template. Brand-locked: navy #00132F on white, Space Grotesk- (installed locally, so no webfont request), orange #D97557 as the only accent.- Self-contained — no external requests. Replace the {{...}} markers and the example- blocks, keep the component classes.-- Section order is deliberate: verdict, do-now, later, clean, full table. Most people- read the first sentence and the first finding, so the highest-downside item goes at #1.--->-<html lang="en-GB">-<head>-<meta charset="utf-8">-<title>{{TITLE}}</title>-<style>- * { box-sizing: border-box; }- body {- margin: 0; padding: 56px 40px 80px;- font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;- color: #00132F; background: #FFFFFF; line-height: 1.55; font-size: 16px;- }- .wrap { max-width: 940px; margin: 0 auto; }- .eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #6B7A90; margin-bottom: 10px; }- h1 { font-size: 38px; line-height: 1.15; font-weight: 700; margin: 0 0 6px; }- h1 .accent { color: #D97557; }- .sub { font-size: 17px; color: #43526B; margin: 0 0 34px; }- .verdict { border-left: 5px solid #D97557; background: #FBF4F1; padding: 20px 24px; margin: 0 0 40px; border-radius: 0 6px 6px 0; }- .verdict p { margin: 0 0 10px; font-size: 18px; font-weight: 500; }- .verdict p:last-child { margin: 0; font-size: 15px; font-weight: 400; color: #43526B; }- h2 { font-size: 22px; font-weight: 700; margin: 46px 0 6px; }- h2 .num { color: #D97557; }- .h2note { font-size: 14px; color: #6B7A90; margin: 0 0 18px; }- .finding { border: 1px solid #E3E8EF; border-radius: 8px; padding: 18px 22px; margin-bottom: 14px; }- .finding.crit { border-left: 4px solid #C0392B; }- .finding.med { border-left: 4px solid #D97557; }- .finding.low { border-left: 4px solid #9AA7B8; }- .ftop { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 6px; }- .ftitle { font-size: 17px; font-weight: 700; }- .tag { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; padding: 3px 9px; border-radius: 3px; white-space: nowrap; }- .tag.crit { background: #C0392B; color: #fff; }- .tag.med { background: #D97557; color: #fff; }- .tag.low { background: #EDF1F6; color: #43526B; }- .tag.nr { background: #00132F; color: #fff; }- .finding p { margin: 6px 0; font-size: 15px; }- .finding .fix { font-weight: 500; }- .finding .fix::before { content: "Fix: "; color: #D97557; font-weight: 700; }- code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; background: #F4F6F9; padding: 2px 6px; border-radius: 3px; }- .clean { background: #F5F8F5; border-radius: 8px; padding: 20px 24px; }- .clean ul { margin: 0; padding-left: 20px; }- .clean li { margin-bottom: 8px; font-size: 15px; }- table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14.5px; }- th { text-align: left; font-weight: 700; padding: 10px 12px; border-bottom: 2px solid #00132F; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }- td { padding: 9px 12px; border-bottom: 1px solid #EDF1F6; vertical-align: top; }- td.st { white-space: nowrap; font-weight: 500; }- .ok { color: #2E7D46; } .na { color: #8895A7; } .warn { color: #C0392B; }- .foot { margin-top: 50px; padding-top: 18px; border-top: 1px solid #E3E8EF; font-size: 13px; color: #6B7A90; }-</style>-</head>-<body>-<div class="wrap">-- <div class="eyebrow">Exposure audit · {{DD/MM/YYYY}}</div>- <h1>{{Question in his words}} <span class="accent">{{accent phrase}}</span></h1>- <p class="sub">{{One line on what was checked and against what.}}</p>-- <div class="verdict">- <p>{{The bottom line in one sentence — how many items bite, and what the real exposure is.}}</p>- <p>{{One supporting sentence: what does not apply and why, plus what came back clean.}}</p>- </div>-- <h2><span class="num">Do now</span> — {{n}} things</h2>- <p class="h2note">Ranked by real exposure. Live credentials outrank everything else.</p>-- <!-- One block per finding. crit / med / low, tag matching. NOT RUN uses tag.nr. -->- <div class="finding crit">- <div class="ftop">- <span class="ftitle">1. {{What is wrong, stated as a fact}}</span>- <span class="tag crit">Critical</span>- </div>- <p>{{The evidence — file path, what the command returned, redacted key prefix.}}</p>- <p>{{Why it matters in his terms. What is the downside if it goes wrong.}}</p>- <p class="fix">{{A specific action. If order matters, say why.}}</p>- </div>-- <h2><span class="num">Later</span> — {{n}}, none urgent</h2>- <p class="h2note">{{Why these can wait — local-only, low impact.}}</p>-- <div class="finding low">- <div class="ftop">- <span class="ftitle">{{n}}. {{Finding}}</span>- <span class="tag low">Low</span>- </div>- <p>{{Evidence, and the reason the severity is capped.}}</p>- <p class="fix">{{Action, or "Nothing, while X stays true."}}</p>- </div>-- <h2><span class="num">Clean</span> — verified this session</h2>- <p class="h2note">Each of these was checked with a command, not assumed.</p>-- <div class="clean">- <ul>- <li><strong>{{What passed.}}</strong> {{The method — which command, what scope, what it returned.}}</li>- </ul>- </div>-- <h2><span class="num">All 20</span>, item by item</h2>- <p class="h2note">{{How many are N/A and the single reason why.}}</p>-- <table>- <tr><th style="width:38px">#</th><th>Vulnerability</th><th style="width:110px">Status</th><th>Why</th></tr>- <tr><td>1</td><td>{{item}}</td><td class="st ok">Clean</td><td>{{reason}}</td></tr>- <tr><td>2</td><td>{{item}}</td><td class="st warn">Flagged</td><td>{{reason, pointing at the finding number}}</td></tr>- <tr><td>3</td><td>{{item}}</td><td class="st na">N/A</td><td>{{the reason it cannot apply}}</td></tr>- </table>-- <p class="foot">- Method: {{the actual commands and tools used}}.<br>- Not run: {{every check that did not complete, with the reason}}. No secret value is printed in this report.- </p>--</div>-</body>-</html>diff --git a/skills/exposure-audit/references/checklist-20.md b/skills/exposure-audit/references/checklist-20.mddeleted file mode 100644index 6774aeb..0000000--- a/skills/exposure-audit/references/checklist-20.md+++ /dev/null@@ -1,166 +0,0 @@-# The twenty vibe-coding vulnerabilities — how to actually check each one--Read this **after** `scripts/scan.sh` has told you what surface exists. Read it before-and you will score items against an app the user does not have.--Each item below carries three things: the check that produces evidence, what counts as a-pass, and the condition under which it is genuinely not applicable. "Not applicable" is a-real verdict, but it needs a reason — "no database" is a reason, "probably fine" is not.--**Most of these need a public app with users, a database, or uploads.** If the user has-none of those, expect roughly thirteen N/As, and expect the audit's value to come from-items 1, 2, 5, 11 and 18 plus the exposures in `SKILL.md` that this list does not cover at-all: cloud-synced secrets, abandoned deployments, and unrevoked keys from closed products.-------## Credential exposure — where the findings actually come from--### 1. Secrets committed to a repo-**Check:** `git ls-files | grep -i '\.env'` for the current tree, and-`git log --all --diff-filter=A --name-only` for history. Both, always.-**Pass:** only `.env.example` files, and each one contains placeholders rather than-live-format values. Verify that — an example file with a real key in it is the same leak-with a friendlier filename.-**Why history matters more than the tree:** GitHub serves a deleted file's blob at its-original URL indefinitely. Removing the file in a later commit removes nothing.-**Extend it:** a secret does not need git to escape. Anything inside a cloud-synced-folder (Google Drive, iCloud, Dropbox, OneDrive) is copied to a second system with its-own sharing rules and version history. Treat a `.env` there as published.--### 2. Real API keys in the front end-**Check:** `NEXT_PUBLIC_*` variables in source, and key patterns in the served HTML and-JS bundle of any live domain.-**Pass:** no live-format key reaches the browser. Anything prefixed `NEXT_PUBLIC_` is-inlined into the bundle at build time and is readable by every visitor — that prefix is a-declaration that the value is public, so a secret behind it is already leaked.-**N/A when:** there is no front end that ships JavaScript.-------## Data-layer items — all need a database--### 3. Row-level security off-**Check:** Supabase/Firebase project settings; grep for `supabase`/`firebase` clients.-**Pass:** RLS enabled on every table holding user data.-**N/A when:** no database exists. State that plainly.--### 6. SQL built by string concatenation-**Check:** grep for query construction with template literals or `+` around user input.-**Pass:** parameterised queries or an ORM everywhere.-**N/A when:** no SQL.--### 14. Predictable IDs with no ownership check-**Check:** sequential integer IDs in routes, and whether the handler verifies the row-belongs to the requester.-**Pass:** the handler checks ownership regardless of ID format. Unguessable IDs are not-an access control — they are a delay.-**N/A when:** no user-owned records.--### 15. Saving the whole request body-**Check:** `update({...req.body})` or equivalent mass-assignment.-**Pass:** an explicit allow-list of fields. Otherwise a caller can set `role: "admin"` by-adding it to the payload.-**N/A when:** no persistence layer.-------## Auth items — all need accounts--### 4. Permissions checked in the front end-**Pass:** every permission decision is re-made server-side. Hiding a button hides nothing;-the endpoint is still callable.-**N/A when:** no permission system.--### 9. Passwords stored in plain text-**Pass:** bcrypt, scrypt or argon2. **N/A when:** no accounts.--### 10. Auth tokens in localStorage-**Pass:** httpOnly cookies. localStorage is readable by any script on the page, so one XSS-becomes full account takeover.-**N/A when:** no tokens issued.--### 13. No email verification on signup-**Pass:** verification before the account can act. **N/A when:** no signup.--### 19. No password strength or breach check-**Pass:** a length floor plus a HaveIBeenPwned range check. **N/A when:** no passwords.-------## Endpoint items — check even for local apps, then weight by exposure--### 5. No rate limiting-**Check:** any HTTP service in the PHASE 1 listening list; does it throttle?-**Pass:** limits on anything that costs money, sends messages or attempts auth.-**Weight it:** a service bound to `127.0.0.1` is reachable only by processes already-running as that user, so this is a low finding, not a critical one. A service on `*` is-reachable by everything on the same network. The scan labels which is which — use that label-rather than assuming.--### 11. Admin panel with no auth-**Check:** unauthenticated request to a health or index route; grep API route handlers for-any auth reference.-**Pass:** authentication on anything that performs actions.-**Careful:** do not probe a state-changing endpoint to test it. A route like-`GET /messages` can consume a queue and destroy real data the moment you call it. Probe-`/health`, then reason about the rest and label the conclusion as inferred.--### 7. No server-side input validation-**Pass:** schema validation at the boundary. Client validation is a UX feature.-**N/A when:** no endpoint accepts input from anyone but the user themselves.--### 12. CORS set to `*`-**Pass:** an explicit origin allow-list. A wildcard plus credentials means any site can-make authenticated calls on a visitor's behalf.--### 16. Webhooks with no signature check-**Pass:** HMAC verification against the provider's secret. Without it the endpoint accepts-a forged "payment succeeded" from anyone who knows the URL.-**N/A when:** no webhook handlers exist.--### 20. File uploads with no validation-**Pass:** type, size and extension checks, and storage outside the web root.-**N/A when:** no upload endpoints.-------## Output and operational items--### 8. Rendering user content as raw HTML-**Check:** `dangerouslySetInnerHTML`, `v-html`, `innerHTML =`.-**Pass:** escaped by default, sanitised where raw HTML is genuinely needed.-**N/A when:** no user-submitted content is displayed.--### 17. Stack traces in production-**Check:** error responses on the live domain; `NODE_ENV` handling in error paths.-**Pass:** a generic message to the client, the detail in the logs. A stack trace names file-paths, package versions and sometimes credentials.-**N/A when:** nothing dynamic runs in production.--### 18. Never updating dependencies-**Check:** `npm audit` per project.-**Pass:** zero critical, and highs triaged rather than ignored.-**Weight it:** on a local-only tool this is low — nothing hostile is reaching it. On-anything deployed it moves up immediately. Report the counts either way so the trend is-visible next time.-------## What this list does not cover, and should--Twenty-point lists like this one assume the reader has shipped an app. The exposure that-actually turns up sits in three places they never mention, and every one of them produced-a real finding on the first run of this audit:--1. **Synced folders.** A `.env` inside a Drive, iCloud, Dropbox or OneDrive folder was- never committed, and is still copied to a second system with its own sharing and- version history.-2. **Closed products with live keys.** Shutting a business down does not revoke its API- keys. A payments key for a dead product is the highest-downside item on this page,- because it is the only one that can move money.-3. **Abandoned deployments.** A linked Vercel or Netlify project outlives the product and- keeps its environment variables. Unlinking locally changes nothing.--Check these three first. They are faster than the twenty and they are where the findings-have actually been.diff --git a/skills/exposure-audit/scripts/scan.sh b/skills/exposure-audit/scripts/scan.shdeleted file mode 100755index a640af1..0000000--- a/skills/exposure-audit/scripts/scan.sh+++ /dev/null@@ -1,298 +0,0 @@-#!/usr/bin/env bash-# exposure-audit sweep — scope, credentials, web surface, dependencies.-#-# Prints marker-prefixed lines so the calling agent can build a report without-# re-deriving anything:-# SCOPE: what exists (repos, ports, domains, deployments)-# FINDING: a check that failed, with the evidence-# CLEAN: a check that passed, with the method-# NOTRUN: a check that did not complete, with the reason-#-# Never prints a secret value. Keys are shown as NAME + 7-char prefix only.-# Never calls a state-changing endpoint. Never follows redirects. Never writes anything.-#-# Optional inputs:-# DOMAINS="yoursite.com another.com" domains to check for exposed keys and headers-# SYNC_DIRS="$HOME/Desktop $HOME/Dropbox" cloud-synced folders to sweep for .env files-# OWNERS="my-login my-org" whose repos get the deep history scan-#-# Tested on macOS. Needs git, curl and perl. Uses gh and npm where available and-# reports NOTRUN when they are missing rather than skipping silently.--set -uo pipefail--OUT="${1:-}"-if [ -z "$OUT" ]; then- OUT="${TMPDIR:-/tmp}/exposure-audit-$(date +%Y%m%d-%H%M%S).txt"-fi-: > "$OUT"--say() { printf '%s\n' "$*" | tee -a "$OUT"; }-hdr() { say ""; say "### $*"; }--# Run a command with a hard time limit. `timeout` is not installed on this machine,-# and a piped `timeout` failure reads as success, so use perl's alarm instead.-# Returns 142 on expiry, which is how Drive stalls surface.-cap() { local secs="$1"; shift; perl -e 'alarm shift; exec @ARGV' "$secs" "$@" 2>/dev/null; }--# Key formats worth catching. Deliberately anchored to live prefixes so that-# placeholder values in .env.example files do not produce false alarms.-KEYPAT='sk-ant-api[0-9]{2}-|sk-proj-[A-Za-z0-9_-]{20,}|apify_api_[A-Za-z0-9]{20,}|ghp_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{20,}|AKIA[0-9A-Z]{16}|xoxb-[0-9]{10,}|AIza[0-9A-Za-z_-]{30,}|ntn_[A-Za-z0-9]{20,}|pdl_(live|liv)[A-Za-z0-9_]{10,}|sk_live_[A-Za-z0-9]{20,}|rk_live_[A-Za-z0-9]{20,}|-----BEGIN (RSA|OPENSSH|EC|DSA)? ?PRIVATE KEY'--say "exposure-audit sweep — $(date '+%d/%m/%Y %H:%M %Z')"-say "output: $OUT"--# Folders a cloud client copies to a second system. A .env in one of these was never-# committed to git and is still published to somewhere with its own sharing rules and-# version history. Override with SYNC_DIRS="path1 path2" (no spaces in paths).-SYNC=()-if [ -n "${SYNC_DIRS:-}" ]; then- for d in $SYNC_DIRS; do [ -d "$d" ] && SYNC+=("$d"); done-else- for d in "$HOME/Desktop" "$HOME/Documents" "$HOME/Dropbox" "$HOME/OneDrive" \- "$HOME/Library/Mobile Documents/com~apple~CloudDocs" \- "$HOME/Library/CloudStorage"; do- [ -d "$d" ] && SYNC+=("$d")- done-fi-say "SCOPE: ${#SYNC[@]} cloud-synced folders in scope"--# ─────────────────────────────────────────────────────────────────────────────-hdr "PHASE 1 — scope"-# Scope first. Without knowing which repos are public and what is deployed, a-# checklist item cannot be scored as a finding or a non-event.--REPOS=()-for r in "$HOME"/*; do- [ -d "$r/.git" ] && REPOS+=("$r")-done-# Synced folders are slow to walk because the client materialises files on demand,-# so cap each one and report when it does not finish rather than reporting fewer repos.-for d in ${SYNC[@]+"${SYNC[@]}"}; do- FOUND=$(cap 45 bash -c 'for r in "$1"/*; do [ -d "$r/.git" ] && echo "$r"; done' _ "$d")- if [ $? -eq 142 ]; then- say "NOTRUN: repo enumeration under $d timed out after 45s (cloud client materialising files). Home-directory repos below are complete."- else- while IFS= read -r r; do [ -n "$r" ] && REPOS+=("$r"); done <<< "$FOUND"- fi-done--say "SCOPE: ${#REPOS[@]} git repos found"-# Whose repos count. A clone of someone else's public repo cannot leak your keys —-# you have no push access — so deep-scanning its history is pure wasted time.-# Defaults to your own GitHub login. Set OWNERS="my-login my-org" to widen it.-OWNERS="${OWNERS:-$(cap 15 gh api user --jq .login)}"-if [ -z "$OWNERS" ]; then- say "NOTRUN: could not resolve a GitHub login (gh missing or not authenticated), so every repo is treated as third-party and none gets the deep history scan. Fix: run 'gh auth login', or set OWNERS=\"your-login\"."-fi-PUBLIC_REPOS=()-for r in ${REPOS[@]+"${REPOS[@]}"}; do- # Every git call here has to be time-capped. A repo stalled by a cloud client will- # hang `git remote get-url` indefinitely, which is how the first run of this script- # died silently two thirds of the way through.- url=$(cap 15 git -C "$r" remote get-url origin)- if [ -z "$url" ]; then- say "SCOPE: $(basename "$r") — no remote (local only, or unreadable)"- continue- fi- slug=$(printf '%s' "$url" | sed -E 's#.*github.com[:/]##; s/\.git$//')- owner="${slug%%/*}"- vis=$(cap 25 gh repo view "$slug" --json visibility -q .visibility)- [ -z "$vis" ] && vis="UNKNOWN"- mine="third-party"- case " $OWNERS " in *" $owner "*) mine="yours" ;; esac- say "SCOPE: $(basename "$r") — $vis — $slug ($mine)"- [ "$vis" = "PUBLIC" ] && [ "$mine" = "yours" ] && PUBLIC_REPOS+=("$r")-done-say "SCOPE: ${#PUBLIC_REPOS[@]} repos are BOTH public AND yours — only these get the deep history scan"--hdr "listening services"-# Anything bound to * is reachable by every device on the same network.-# Anything on 127.0.0.1 is reachable only by processes already running as you.-lsof -nP -iTCP -sTCP:LISTEN 2>/dev/null | awk 'NR>1 {print $1, $9}' | sort -u | while read -r proc addr; do- case "$addr" in- \*:*|"[::]":*) say "SCOPE: ALL-INTERFACES $proc $addr" ;;- *) say "SCOPE: loopback $proc $addr" ;;- esac-done--# ─────────────────────────────────────────────────────────────────────────────-hdr "PHASE 2 — credentials (where the real findings live)"--hdr "2a. secrets committed to git"-COMMITTED=0-for r in ${REPOS[@]+"${REPOS[@]}"}; do- name=$(basename "$r")- tracked=$(cap 40 git -C "$r" ls-files | grep -iE '(^|/)\.env($|\.[a-z]+$)' | grep -v '\.example$' | head -5)- history=$(cap 60 git -C "$r" log --all --diff-filter=A --name-only --pretty=format: \- | grep -iE '(^|/)\.env($|\.[a-z]+$)' | grep -v '\.example$' | sort -u | head -5)- if [ -n "$tracked" ]; then- say "FINDING: $name tracks a real .env RIGHT NOW: $(printf '%s' "$tracked" | tr '\n' ' ')"- COMMITTED=1- fi- if [ -n "$history" ] && [ -z "$tracked" ]; then- say "FINDING: $name committed a .env historically (still in git history, deleting the file does not remove it): $(printf '%s' "$history" | tr '\n' ' ')"- COMMITTED=1- fi-done-[ "$COMMITTED" -eq 0 ] && say "CLEAN: no real .env is tracked or has ever been committed in any repo (checked working tree + full history with --diff-filter=A across ${#REPOS[@]} repos)"--hdr "2b. live keys inside public repos — working tree AND every commit"-# History matters more than the working tree. A key deleted in a later commit is-# still served by GitHub at its original blob URL forever.-if [ "${#PUBLIC_REPOS[@]}" -eq 0 ]; then- say "CLEAN: no public repos to scan"-else- for r in ${PUBLIC_REPOS[@]+"${PUBLIC_REPOS[@]}"}; do- name=$(basename "$r")- tree_hit=$(git -C "$r" grep -nEI "$KEYPAT" -- . 2>/dev/null | head -5)- revs=$(git -C "$r" rev-list --all 2>/dev/null | head -300)- hist_hit=""- [ -n "$revs" ] && hist_hit=$(cap 90 bash -c "cd '$r' && git grep -nEI '$KEYPAT' $(printf '%s ' $revs) 2>/dev/null | head -5")- if [ -n "$tree_hit" ]; then- say "FINDING: PUBLIC repo $name has live-format key material in the working tree: $(printf '%s' "$tree_hit" | cut -c1-90 | head -3)"- elif [ -n "$hist_hit" ]; then- say "FINDING: PUBLIC repo $name has live-format key material in git history: $(printf '%s' "$hist_hit" | cut -c1-90 | head -3)"- else- say "CLEAN: PUBLIC repo $name — no key material in working tree or history (scanned 11 live key formats across up to 300 commits)"- fi- done-fi--hdr "2c. .env files in cloud-synced locations"-# This is the one the published checklists miss. A .env that was never committed to-# git is still uploaded to Drive, iCloud, Dropbox or OneDrive if it sits in one of-# their folders.-DRIVE_ENVS=""-SYNC_STALLED=0-for d in ${SYNC[@]+"${SYNC[@]}"}; do- hits=$(cap 60 find "$d" -maxdepth 3 -name ".env" -not -path "*/node_modules/*")- if [ $? -eq 142 ]; then- SYNC_STALLED=1- say "NOTRUN: .env search under $d timed out after 60s (cloud client). Re-run just this step: find '$d' -maxdepth 3 -name .env -not -path '*/node_modules/*'"- continue- fi- [ -n "$hits" ] && DRIVE_ENVS="$DRIVE_ENVS$hits\n"-done-DRIVE_ENVS=$(printf '%b' "$DRIVE_ENVS" | grep -v '^$')-if [ -z "$DRIVE_ENVS" ] && [ "$SYNC_STALLED" -eq 0 ]; then- say "CLEAN: no .env files in any cloud-synced folder (searched ${#SYNC[@]} trees to depth 3)"-elif [ -n "$DRIVE_ENVS" ]; then- while IFS= read -r f; do- [ -z "$f" ] && continue- # Print variable names and a 7-char prefix only. Enough to prove a key is- # live-format, never enough to use it.- body=$(cap 30 sed -E 's/=(.{0,7}).*/= \1…[REDACTED]/' "$f")- if [ $? -eq 142 ] || [ -z "$body" ]; then- say "NOTRUN: $f exists but could not be read in 30s (the cloud client has not materialised it). Open it manually — treat every key inside as sync-exposed until seen."- continue- fi- names=$(printf '%s' "$body" | grep -vE '^\s*#|^\s*$' | tr '\n' ' ')- if printf '%s' "$body" | grep -qE 'sk-ant-|sk-proj-|pdl_liv|sk_live_|apify_api_|ghp_|AIza|ntn_|AKIA'; then- say "FINDING: live-format key in cloud-synced $f — $names"- else- say "CLEAN: $f is cloud-synced but holds no live-format key — $names"- fi- done <<< "$DRIVE_ENVS"-fi--hdr "2d. keys inlined in MCP config"-# A key written into an MCP server's command string prints in full on every-# `claude mcp list`, including over someone's shoulder or on a shared screen.-inline=$(grep -oE '"(command|args)":[^]]{0,400}' "$HOME/.claude.json" 2>/dev/null \- | grep -oiE "$KEYPAT" | sort -u | head -3)-if [ -n "$inline" ]; then- say "FINDING: ~/.claude.json has key material inline in an MCP command string (prints in full on every 'claude mcp list')"-else- say "CLEAN: ~/.claude.json has no key material inline in MCP command strings"-fi--# ─────────────────────────────────────────────────────────────────────────────-hdr "PHASE 3 — public web surface"--# Feed in domains to check as DOMAINS="a.com b.com". No default — a domain you do not-# own is not yours to probe.-DOMAINS="${DOMAINS:-}"-[ -z "$DOMAINS" ] && say "NOTRUN: no domains checked. Re-run with DOMAINS=\"yoursite.com\" to scan served HTML for key material, public build vars and security headers."-for d in $DOMAINS; do- u="https://$d"- # No -L. A dead page that redirects to a homepage returns 200 and reads as alive.- code=$(cap 20 curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$u")- if [ -z "$code" ] || [ "$code" = "000" ]; then- say "SCOPE: $u did not respond (no redirect followed)"- continue- fi- say "SCOPE: $u -> HTTP $code"- html=$(cap 25 curl -s --max-time 20 "$u")- if printf '%s' "$html" | grep -qiE "$KEYPAT"; then- say "FINDING: $u serves live-format key material in its HTML"- else- say "CLEAN: $u — no key material in served HTML"- fi- pub=$(printf '%s' "$html" | grep -ohE 'NEXT_PUBLIC_[A-Z0-9_]+' | sort -u | tr '\n' ' ')- [ -n "$pub" ] && say "FINDING: $u exposes build-time public vars in the bundle: $pub"- hdrs=$(cap 20 curl -sI --max-time 15 "$u")- missing=""- for h in content-security-policy x-frame-options x-content-type-options referrer-policy strict-transport-security; do- printf '%s' "$hdrs" | grep -qi "^$h" || missing="$missing $h"- done- if [ -n "$missing" ]; then- say "FINDING: $u missing security headers:$missing"- else- say "CLEAN: $u sets all five checked security headers"- fi-done--hdr "abandoned deployments"-# A product that was shut down is only shut down if the deployment is gone too.-# A linked Vercel project can still be live with its environment variables attached.-for r in ${REPOS[@]+"${REPOS[@]}"}; do- if [ -f "$r/.vercel/project.json" ]; then- pj=$(cap 15 cat "$r/.vercel/project.json")- say "FINDING: $(basename "$r") is still linked to a Vercel project — verify it is not deployed with env vars attached: $(printf '%s' "$pj" | cut -c1-160)"- fi-done--# ─────────────────────────────────────────────────────────────────────────────-hdr "PHASE 4 — code-level checks and dependencies"--hdr "unauthenticated API routes"-for r in ${REPOS[@]+"${REPOS[@]}"}; do- routes=$(cap 30 find "$r" -path "*/api/*" -name "route.ts" -not -path "*/node_modules/*")- [ -z "$routes" ] && continue- while IFS= read -r f; do- [ -z "$f" ] && continue- if ! grep -qiE "auth|session|getToken|Authorization|x-api-key" "$f" 2>/dev/null; then- say "FINDING: ${f#$HOME/} has no auth check (severity depends on whether the app is deployed — see PHASE 1 scope)"- fi- done <<< "$routes"-done--hdr "CORS wildcards and unsigned webhooks"-cors=$(grep -rlE "Access-Control-Allow-Origin['\"]?\s*[:,]\s*['\"]\*" "$HOME"/*/src 2>/dev/null | head -3)-if [ -n "$cors" ]; then say "FINDING: wildcard CORS in: $cors"; else say "CLEAN: no wildcard CORS in any src/ tree"; fi-hooks=$(grep -rliE "webhook" "$HOME"/*/src 2>/dev/null | head -5)-if [ -n "$hooks" ]; then- for h in $hooks; do- grep -qiE "signature|hmac|verifyWebhook|constructEvent" "$h" 2>/dev/null \- && say "CLEAN: webhook handler ${h#$HOME/} verifies signatures" \- || say "FINDING: webhook handler ${h#$HOME/} does not verify a signature"- done-else- say "CLEAN: no webhook handlers exist, so there is no signature check to get wrong"-fi--hdr "dependency vulnerabilities"-for r in ${REPOS[@]+"${REPOS[@]}"}; do- [ -f "$r/package.json" ] || continue- res=$(cap 70 npm audit --prefix "$r" --json 2>/dev/null \- | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{try{const v=JSON.parse(s).metadata.vulnerabilities;if(v.critical+v.high>0)console.log('crit '+v.critical+' high '+v.high+' mod '+v.moderate);}catch(e){}})")- if [ -n "$res" ]; then- say "FINDING: $(basename "$r") — $res"- fi-done--say ""-say "### sweep complete — $OUT"-say "Next: read references/checklist-20.md and map these lines onto the twenty items."-say "Anything marked NOTRUN is not clean. Retry it once, then ship it as NOT RUN with the reason."