Files
BetterDesk/scripts/check-no-sensitive-paths.sh
T
UNITRONIX 1118fc2ba6 Anonymize operator infrastructure fingerprints from public repo.
Remove internal LAN IP, SSH user, and developer paths from docs and examples; move deploy runbook to gitignored docs/private with a public template; drop Cursor debug logging leftovers; add CI checks to prevent regression.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 19:07:42 +02:00

49 lines
943 B
Bash

#!/usr/bin/env bash
# Fail if operator-specific infrastructure fingerprints appear in tracked sources.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
if ! command -v rg >/dev/null 2>&1; then
echo "ERROR: ripgrep (rg) is required" >&2
exit 1
fi
SCAN_PATHS=(
docs/
bridges/
betterdesk-agent/
betterdesk-agent-client/
betterdesk-server/
betterdesk-support-agent/
web-nodejs/
sdks/
scripts/
.github/
)
PATTERNS=(
'192\.168\.0\.110'
'/home/unitronix'
'unitronix@192\.168'
)
FAIL=0
for pat in "${PATTERNS[@]}"; do
if matches=$(rg -n "$pat" "${SCAN_PATHS[@]}" \
--glob '!docs/private/**' \
--glob '!scripts/check-no-sensitive-paths.sh' \
--glob '!*.plan.md' 2>/dev/null); then
echo "ERROR: sensitive pattern '$pat' found:" >&2
echo "$matches" >&2
FAIL=1
fi
done
if [[ $FAIL -ne 0 ]]; then
exit 1
fi
echo "OK: no blocked sensitive path patterns"