skills/security-audit/SKILL.md
End-to-end Google Workspace security & incident-response audit. Enumerates users, 2SV status, OAuth grants, admin actions, suspicious logins, Drive external shares, and (Tier 2) per-user Gmail forwarding/filters/IMAP. Generates findings HTML brief. Use when a security incident is reported, a client asks for a security baseline, or as part of onboarding/offboarding validation.
npx skillsauth add rdfitted/claude-code-setup security-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
End-to-end Google Workspace security audit workflow. Runs in two tiers:
Outputs: raw JSON for retention, HTML findings brief for stakeholders.
tog-nyc.com, for example)Reports/incident_<timestamp>/ inside a client repoWhat it checks (last 30 days by default):
info / review / high based on scope breadth (gmail, drive, calendar, admin.directory), anonymous grants, suspicious display namessuspicious_login, login_failure, gov_attack_warning, account_disabled_password_leakauthorize events (new OAuth grants issued in window — NB: token refreshes also count here, so numbers can be large)people_with_link, public_on_the_web, shared_externally, shared_outside_domain)Scopes requested:
https://www.googleapis.com/auth/admin.directory.user.readonlyhttps://www.googleapis.com/auth/admin.directory.user.securityhttps://www.googleapis.com/auth/admin.reports.audit.readonlyhttps://www.googleapis.com/auth/drive (read-only direct-access; optional — keep if client's repo already uses it)Run:
python scripts/tier1_audit.py \
--workdir "/path/to/client/repo" \
--priority jack="New hire scammed" mufdi="On-site lead" tim="Impersonated" \
--lookback-days 30
If no token.json exists in the workdir, a browser consent window opens. Log in as the Super Admin whose context we want. The token is saved for re-use.
Output:
<workdir>/Reports/incident_<timestamp>/raw/*.json — forensic chain-of-custody dumps<workdir>/Reports/incident_<timestamp>/summary.json — scored summary<workdir>/Reports/incident_<timestamp>/summary.html — dark-themed tech-forward briefWhat it checks:
forward, addLabelIds: TRASH, or removeLabelIds: INBOX on financial-keyword criteria (invoice, wire, bank, payment, ach, routing, password, verify, account)DWD setup (one-time, Super Admin):
sa_key.json in workdir (GITIGNORE IT)https://www.googleapis.com/auth/gmail.settings.basic,
https://www.googleapis.com/auth/gmail.settings.sharing,
https://www.googleapis.com/auth/admin.directory.user.readonly
Run:
python scripts/tier2_gmail_audit.py \
--workdir "/path/to/client/repo" \
--key sa_key.json \
--admin [email protected] \
--only [email protected] [email protected] [email protected] # or omit for org-wide
Output:
<workdir>/Reports/gmail_audit_<timestamp>/results.json<workdir>/Reports/gmail_audit_<timestamp>/audit.htmlAfter running Tier 1 (and optionally Tier 2), generate a consolidated briefing document. Uses the tech-forward dark theme consistent with other security deliverables.
python scripts/render_brief.py \
--tier1 "/path/to/Reports/incident_<timestamp>/summary.json" \
--tier2 "/path/to/Reports/gmail_audit_<timestamp>/results.json" \ # optional
--client-name "The Organic Gardener" \
--incident-context "2026-04-17 smishing incident — Jack Paulchuck scammed for $500 gift cards by attacker impersonating Tim Osborne" \
--out "/path/to/output/findings-brief.html"
| Tier | Meaning | Example | |------|---------|---------| | T1 — Credential exposure | Email/password appeared in breach corpus. Probable for any org. | HIBP hit, leaked-password Google alert | | T2 — Identity compromise | Unauthorized login on a TOG account. Detectable via audit logs. | Impossible travel, anomalous IP with successful login | | T3 — Data exfil / persistence | Data left TOG or attacker established persistence. | Forwarding rules created, OAuth grants to unknown apps, mass Drive downloads |
credentials.json to git — the target repo should have .gitignore covering token*.json, sa_*.json, client_secret_*.json, credentials.jsonSKILL.md This document
scripts/
google_auth.py Self-contained OAuth + service-account helpers
tier1_audit.py Org-wide admin-level audit
tier2_gmail_audit.py Per-user Gmail audit (needs DWD)
render_brief.py Consolidated findings-brief HTML generator
templates/
findings_brief.html.tmpl HTML template for the stakeholder brief
When this skill surfaces a real incident, add entries to:
~/.claude/clients/<client-slug>/decisions.md — what was found, what was remediated~/.claude/clients/<client-slug>/status.md — current security posture, next review datedevelopment
Restore from the Kopia backup repo in one of two opinionated modes. **wikis** (frequent, default) syncs per-project `.ai-docs/` directories from backup to local project trees — used to move compound-knowledge wikis between machines via the backup drive as sneakernet. **full** (rare) restores all sources to original paths for greenfield machine rebuild. Use when the user says "restore wikis", "sync wikis from backup", "pull the wikis", "I plugged in the backup drive on this machine", "rebuild this machine", "greenfield restore", or "restore everything". For ad-hoc single-file restores, use `backup-ops restore` instead.
documentation
# /bp-iterate Iterate the Fitted Business Plan(s). Manages the **internal canonical** and the **external partner/investor variant**, snapshot-on-version-bump lineage, redaction enforcement between variants, and cross-document coupling. ## When this runs - User says `/bp-iterate`, "iterate the BP," "bump the BP," "update the business plan," "version up the BP," "create / update / refresh the external variant" - A material trigger fires per the BP's own Iteration Log (first 2 new closes / fundi
tools
Run Kopia-based backups of key Windows files and config to an external drive. Use when the user says "back up", "run a backup", "snapshot", "the backup drive is plugged in", or wants to set up / configure backups for the first time. Handles initial repo setup, drive detection by volume label, source enumeration, and snapshot creation with structured exclusions.
testing
Secondary backup operations against the Kopia repo — verify integrity, run maintenance/prune, mirror to a second destination, restore files/folders, or run a quick top-up snapshot of hot directories. Use when the user says "verify backups", "check backup integrity", "prune old snapshots", "restore from backup", "mirror backups to cloud", "quick backup", "top up the backup", or asks about backup health. For the primary backup run, use the `backup` skill instead.