From 7450cfc724f857a864fcfdd9dd8f1ed6a2092913 Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Fri, 30 Oct 2026 23:22:10 +0100 Subject: [PATCH 1/3] chore(privacy): add privacy-guard workflow and denylist check Run gitleaks over full history and a structural denylist check on every push and pull request. Matched content is withheld from logs. Private terms load from an untracked file or a CI secret, not this public repo. Generated plugin output is unchanged. --- .github/workflows/privacy-guard.yml | 42 ++++++++++++++++++ .gitignore | 1 + .privacy-allowlist | 9 ++++ .privacy-denylist | 29 ++++++++++++ CHANGELOG.md | 2 + README.md | 2 + scripts/privacy-denylist.sh | 60 +++++++++++++++++++++++++ scripts/test-privacy-denylist.sh | 69 +++++++++++++++++++++++++++++ 8 files changed, 214 insertions(+) create mode 100644 .github/workflows/privacy-guard.yml create mode 100644 .privacy-allowlist create mode 100644 .privacy-denylist create mode 100755 scripts/privacy-denylist.sh create mode 100755 scripts/test-privacy-denylist.sh diff --git a/.github/workflows/privacy-guard.yml b/.github/workflows/privacy-guard.yml new file mode 100644 index 0000000..a1de8a2 --- /dev/null +++ b/.github/workflows/privacy-guard.yml @@ -0,0 +1,42 @@ +name: Privacy Guard + +on: + push: + pull_request: + +permissions: + contents: read + +concurrency: + group: privacy-guard-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + privacy-guard: + name: Privacy Guard + runs-on: ubuntu-latest + env: + GITLEAKS_VERSION: "8.30.1" + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Install gitleaks + run: | + set -euo pipefail + base="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}" + archive="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" + curl -sSfL -o "$RUNNER_TEMP/$archive" "$base/$archive" + curl -sSfL -o "$RUNNER_TEMP/checksums.txt" "$base/gitleaks_${GITLEAKS_VERSION}_checksums.txt" + (cd "$RUNNER_TEMP" && grep " ${archive}\$" checksums.txt | sha256sum -c -) + tar -xzf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP" gitleaks + echo "$RUNNER_TEMP" >> "$GITHUB_PATH" + - name: Scan history for secrets + run: gitleaks detect --source . --log-opts=--all --redact --no-banner --exit-code 1 + - name: Test denylist guard + run: bash scripts/test-privacy-denylist.sh + - name: Check denylist + env: + PRIVACY_DENYLIST_EXTRA: ${{ secrets.PRIVACY_DENYLIST_EXTRA }} + run: bash scripts/privacy-denylist.sh diff --git a/.gitignore b/.gitignore index a4eaa34..f9e6277 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __pycache__/ *.pyc .vstack-stage-*/ .DS_Store +.privacy-denylist.local diff --git a/.privacy-allowlist b/.privacy-allowlist new file mode 100644 index 0000000..fc7ff33 --- /dev/null +++ b/.privacy-allowlist @@ -0,0 +1,9 @@ +# Regexes matched against "path:line:content" of a denylist hit. Keep entries narrow. + +# Addresses on reserved or noreply domains +@[A-Za-z0-9-]+\.(test|invalid|example)\b +@example\.(com|org|net)\b +@users\.noreply\.github\.com\b + +# Generic copywriting example, not a real figure +copywriting-formulas\.md:[0-9]+:.*hit \$10k MRR diff --git a/.privacy-denylist b/.privacy-denylist new file mode 100644 index 0000000..aca8269 --- /dev/null +++ b/.privacy-denylist @@ -0,0 +1,29 @@ +# Structural privacy patterns (extended regex, case-insensitive). Generic only: +# never put names, clients, hosts, or credentials here; this file is public. +# Private terms go in the untracked .privacy-denylist.local or the +# PRIVACY_DENYLIST_EXTRA CI secret. See scripts/privacy-denylist.sh. + +# Tailnet hostnames and the CGNAT range tailnets use +[a-z0-9-]+\.ts\.net\b +\b100\.(6[4-9]|[7-9][0-9]|1[01][0-9]|12[0-7])\.[0-9]{1,3}\.[0-9]{1,3}\b + +# Private network addresses +\b10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\b +\b192\.168\.[0-9]{1,3}\.[0-9]{1,3}\b +\b172\.(1[6-9]|2[0-9]|3[01])\.[0-9]{1,3}\.[0-9]{1,3}\b + +# Machine-specific home and editor store paths +/home/[a-z_][a-z0-9_-]*/ +/Users/[A-Za-z0-9._-]+/ +/cursor/stores + +# UUIDs (account, bot, and device ids) +\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b + +# Email addresses and phone numbers +[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,} +(^|[^0-9A-Za-z])\+[0-9]{1,3}[ .-]?[0-9]([ .-]?[0-9]){7,12}\b + +# Revenue and pricing figures +\b(MRR|ARR|revenue|turnover)\b[^.]{0,24}[$€£][0-9] +[$€£][0-9][0-9,.]*[kKmM]?[ ]?(MRR|ARR)\b diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee3901..3d32859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Add a `Privacy Guard` workflow: gitleaks over full history plus a structural denylist check with an allowlist, optional private patterns, and withheld match content. + ## 0.1.0-canary.6 - Fix the Claude plugin icon being rejected as `ICON_INVALID`: ship the vllnt logo as `.claude-plugin/icon.png`, named by `icon` in `plugin.json`, instead of an SVG that embedded the PNG. diff --git a/README.md b/README.md index 0195ae8..55a5d18 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ python3 scripts/sync.py --source /path/to/skills python3 scripts/sync.py --check --source /path/to/skills ``` +The `Privacy Guard` workflow also runs gitleaks over full history and `scripts/privacy-denylist.sh`, which checks tracked files against the structural patterns in `.privacy-denylist` minus the narrow `.privacy-allowlist`. Matches report `path:line` only. Run it locally with `bash scripts/privacy-denylist.sh`; `scripts/test-privacy-denylist.sh` covers its failure paths. Names that must stay private go in an untracked `.privacy-denylist.local` or the optional `PRIVACY_DENYLIST_EXTRA` repository secret, never in the tracked file. + `--source` reads committed objects at the lock's SHA, ignoring working-tree edits. `--check` rebuilds expected bytes in memory and reports missing, stale, extra, or changed generated files without writing outputs. Its default path downloads the pin; network/access failures are failures, never a successful empty result. The generator accepts only regular archive files/directories, validates skill identities and local dependency links, and bounds archive bytes, expanded bytes, file size, member count, and total payload. It rejects symlink output paths before writing. It stages output and replaces only the three generated host directories and three catalog files, rolling back ordinary replacement errors. Run only one writer at a time in a trusted checkout: this is not a filesystem sandbox or a crash-proof transaction across all targets. diff --git a/scripts/privacy-denylist.sh b/scripts/privacy-denylist.sh new file mode 100755 index 0000000..1e3e3a7 --- /dev/null +++ b/scripts/privacy-denylist.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# +# privacy-denylist.sh — fail when a tracked file matches a denylist pattern +# outside the allowlist. +# +# Patterns (extended regex, one per line, '#' comments): +# .privacy-denylist tracked, structural patterns only +# .privacy-denylist.local optional, untracked, for names that must stay private +# $PRIVACY_DENYLIST_EXTRA optional, newline-separated; set it from a CI secret +# Allowlist (.privacy-allowlist): regexes matched against "path:line:content" of a hit. +# +# Matched content is never printed: CI logs of a public repository are public. +# +# Exit codes: 0 clean, 1 match found, 2 misuse or bad pattern. + +set -u + +cd "$(git rev-parse --show-toplevel)" || exit 2 + +DENY=.privacy-denylist +ALLOW=.privacy-allowlist +SELF=scripts/privacy-denylist.sh + +patterns="$(mktemp)" +allow_patterns="$(mktemp)" +hits="$(mktemp)" +trap 'rm -f "$patterns" "$allow_patterns" "$hits"' EXIT + +strip() { sed -E '/^[[:space:]]*(#|$)/d'; } + +{ + for f in "$DENY" "$DENY.local"; do [[ -f "$f" ]] && cat "$f"; done + [[ -n "${PRIVACY_DENYLIST_EXTRA:-}" ]] && printf '%s\n' "$PRIVACY_DENYLIST_EXTRA" +} | strip > "$patterns" +[[ -f "$ALLOW" ]] && strip < "$ALLOW" > "$allow_patterns" + +if [[ ! -s "$patterns" ]]; then + echo "error: no denylist patterns found; expected $DENY" >&2 + exit 2 +fi + +git grep -nIiE -f "$patterns" -- . ":(exclude)$DENY" ":(exclude)$ALLOW" ":(exclude)$SELF" > "$hits" +status=$? +if (( status > 1 )); then + echo "error: git grep failed; check the denylist patterns" >&2 + exit 2 +fi + +if [[ -s "$allow_patterns" ]]; then + grep -vEf "$allow_patterns" "$hits" > "$hits.kept" + mv "$hits.kept" "$hits" +fi + +if [[ -s "$hits" ]]; then + echo "FAIL privacy denylist: $(wc -l < "$hits" | tr -d ' ') match(es); content withheld" + cut -d: -f1,2 "$hits" | sort -u | sed 's/^/ /' + exit 1 +fi + +echo "OK privacy denylist: no matches ($(wc -l < "$patterns" | tr -d ' ') patterns)" diff --git a/scripts/test-privacy-denylist.sh b/scripts/test-privacy-denylist.sh new file mode 100755 index 0000000..463a726 --- /dev/null +++ b/scripts/test-privacy-denylist.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# +# test-privacy-denylist.sh — success and failure paths of privacy-denylist.sh +# in a throwaway repository. Planted values are synthetic. + +set -u + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +REPO="$(mktemp -d)" +trap 'rm -rf "$REPO"' EXIT + +mkdir -p "$REPO/scripts" +cp "$ROOT/scripts/privacy-denylist.sh" "$REPO/scripts/" +cp "$ROOT/.privacy-denylist" "$ROOT/.privacy-allowlist" "$REPO/" +git -C "$REPO" init -q +git -C "$REPO" config user.email test@example.invalid +git -C "$REPO" config user.name test + +failures=0 +# plant : write a fixture, assembled from fragments so this file never matches the denylist itself +plant() { printf '%s\n' "$1" > "$REPO/doc.md"; } + +# check [VAR=value ...] +check() { + local name="$1" expected="$2"; shift 2 + git -C "$REPO" add -A + local output status + output="$(cd "$REPO" && env "$@" bash scripts/privacy-denylist.sh 2>&1)" + status=$? + if [[ "$status" != "$expected" ]]; then + printf 'FAIL %s: expected exit %s, got %s\n%s\n' "$name" "$expected" "$status" "$output" >&2 + failures=$((failures + 1)) + return + fi + printf 'OK %s\n' "$name" + LAST_OUTPUT="$output" +} + +printf 'Plain documentation.\n' > "$REPO/doc.md" +check "clean tree passes" 0 NOOP=1 + +plant "host: build-box.example-net.ts"".net" +check "tailnet hostname fails" 1 NOOP=1 +grep -q 'doc.md:1' <<< "$LAST_OUTPUT" || { echo "FAIL hit location not reported" >&2; failures=$((failures + 1)); } +grep -q 'ts.net' <<< "$LAST_OUTPUT" && { echo "FAIL matched content leaked to output" >&2; failures=$((failures + 1)); } + +plant "id 123e4567-e89b-12d3-a456-4266""14174000" +check "uuid fails" 1 NOOP=1 + +plant "path /ho""me/someone/project/" +check "home path fails" 1 NOOP=1 + +plant "mail fixture@example.test" +check "allowlisted reserved address passes" 0 NOOP=1 + +plant "mail someone@""company.io" +check "real-looking address fails" 1 NOOP=1 + +printf 'Plain documentation.\nacme-widget appears here\n' > "$REPO/doc.md" +check "extra pattern from environment fails" 1 'PRIVACY_DENYLIST_EXTRA=acme-widget' +check "invalid extra pattern is an error, not a pass" 2 'PRIVACY_DENYLIST_EXTRA=(unbalanced' +printf 'Plain documentation.\n' > "$REPO/doc.md" +check "extra pattern not present passes" 0 'PRIVACY_DENYLIST_EXTRA=acme-widget' + +if (( failures > 0 )); then + printf '%s failure(s)\n' "$failures" >&2 + exit 1 +fi +echo "OK privacy denylist tests passed" From fc05f26dfe8a2ae067cb7323562b6114f7277eb0 Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Fri, 30 Oct 2026 23:27:55 +0100 Subject: [PATCH 2/3] fix(privacy): sync hardened guard from skills review --- .privacy-allowlist | 17 ++++--- .privacy-denylist | 22 ++++++--- scripts/privacy-denylist.sh | 71 +++++++++++++++++++++------ scripts/test-privacy-denylist.sh | 82 ++++++++++++++++++++++++++------ 4 files changed, 150 insertions(+), 42 deletions(-) diff --git a/.privacy-allowlist b/.privacy-allowlist index fc7ff33..c65f78f 100644 --- a/.privacy-allowlist +++ b/.privacy-allowlist @@ -1,9 +1,14 @@ -# Regexes matched against "path:line:content" of a denylist hit. Keep entries narrow. +# Regexes matched against "path:line:token" of each denylist hit. Keep entries narrow +# and anchor them: a token is allowed only if the whole token matches. -# Addresses on reserved or noreply domains -@[A-Za-z0-9-]+\.(test|invalid|example)\b -@example\.(com|org|net)\b -@users\.noreply\.github\.com\b +# Addresses on reserved or noreply domains, and the SSH remote user +:[0-9]+:[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+\.(test|invalid|example)$ +:[0-9]+:[A-Za-z0-9._%+-]+@example\.(com|org|net)$ +:[0-9]+:[A-Za-z0-9._%+-]+@users\.noreply\.github\.com$ +:[0-9]+:git@github\.com$ + +# CI runner home directories +:[0-9]+:.?/home/(runner|user)$ # Generic copywriting example, not a real figure -copywriting-formulas\.md:[0-9]+:.*hit \$10k MRR +^(plugins/[a-z]+/skills/)?(workflows/)?build-landing-page/references/copywriting-formulas\.md:[0-9]+:\$10k MRR$ diff --git a/.privacy-denylist b/.privacy-denylist index aca8269..88e5608 100644 --- a/.privacy-denylist +++ b/.privacy-denylist @@ -3,27 +3,35 @@ # Private terms go in the untracked .privacy-denylist.local or the # PRIVACY_DENYLIST_EXTRA CI secret. See scripts/privacy-denylist.sh. -# Tailnet hostnames and the CGNAT range tailnets use +# Tailnet hostnames and addresses (CGNAT range, IPv6 ULA) [a-z0-9-]+\.ts\.net\b \b100\.(6[4-9]|[7-9][0-9]|1[01][0-9]|12[0-7])\.[0-9]{1,3}\.[0-9]{1,3}\b +\bfd7a:115c:a1e0:[0-9a-f:]+ # Private network addresses \b10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\b \b192\.168\.[0-9]{1,3}\.[0-9]{1,3}\b \b172\.(1[6-9]|2[0-9]|3[01])\.[0-9]{1,3}\.[0-9]{1,3}\b -# Machine-specific home and editor store paths -/home/[a-z_][a-z0-9_-]*/ -/Users/[A-Za-z0-9._-]+/ +# Machine-specific home and editor store paths (a path root, not a URL segment) +(^|[^A-Za-z0-9_./-])/(home|Users)/[A-Za-z0-9._-]+ +[A-Za-z]:\\Users\\[A-Za-z0-9._-]+ /cursor/stores # UUIDs (account, bot, and device ids) \b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b -# Email addresses and phone numbers -[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,} +# Email addresses; a version suffix such as pkg@1.2.3-canary.abc1234 is not one +[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}\b + +# Phone numbers: international, US-style grouped, French-style grouped, 00-prefixed (^|[^0-9A-Za-z])\+[0-9]{1,3}[ .-]?[0-9]([ .-]?[0-9]){7,12}\b +\(?[0-9]{3}\)?[ .-][0-9]{3}[ .-][0-9]{4}\b +\b0[1-9]([ .-][0-9]{2}){4}\b +\b00[0-9]{10,13}\b # Revenue and pricing figures -\b(MRR|ARR|revenue|turnover)\b[^.]{0,24}[$€£][0-9] +\bMRR\b[^.]{0,20}[0-9] +\b(revenue|turnover|pricing)\b[^.]{0,24}[$€£][0-9] [$€£][0-9][0-9,.]*[kKmM]?[ ]?(MRR|ARR)\b +\b[0-9][0-9,.]*[kKmM]?[ ]?(€|EUR\b|USD\b) diff --git a/scripts/privacy-denylist.sh b/scripts/privacy-denylist.sh index 1e3e3a7..e6640ef 100755 --- a/scripts/privacy-denylist.sh +++ b/scripts/privacy-denylist.sh @@ -3,15 +3,17 @@ # privacy-denylist.sh — fail when a tracked file matches a denylist pattern # outside the allowlist. # -# Patterns (extended regex, one per line, '#' comments): -# .privacy-denylist tracked, structural patterns only +# Patterns (extended regex, one per line, '#' comments; matched case-insensitively): +# .privacy-denylist required, tracked, structural patterns only # .privacy-denylist.local optional, untracked, for names that must stay private # $PRIVACY_DENYLIST_EXTRA optional, newline-separated; set it from a CI secret -# Allowlist (.privacy-allowlist): regexes matched against "path:line:content" of a hit. +# Allowlist (.privacy-allowlist): regexes matched against "path:line:token" for each +# matched token, so an allowed token never hides another match on the same line. # -# Matched content is never printed: CI logs of a public repository are public. +# Matched content and pattern text are never printed: CI logs of a public +# repository are public. # -# Exit codes: 0 clean, 1 match found, 2 misuse or bad pattern. +# Exit codes: 0 clean, 1 match found, 2 misuse or invalid pattern. set -u @@ -21,34 +23,69 @@ DENY=.privacy-denylist ALLOW=.privacy-allowlist SELF=scripts/privacy-denylist.sh +tracked="$(mktemp)" +extra="$(mktemp)" patterns="$(mktemp)" allow_patterns="$(mktemp)" hits="$(mktemp)" -trap 'rm -f "$patterns" "$allow_patterns" "$hits"' EXIT +kept="$(mktemp)" +trap 'rm -f "$tracked" "$extra" "$patterns" "$allow_patterns" "$hits" "$kept"' EXIT strip() { sed -E '/^[[:space:]]*(#|$)/d'; } +# valid_regexes