SPB Git

Repository Public License

check.sh 1.8 KB 25 lines shellscript

1#!/usr/bin/env bash2# ORIX Clean — Scripts/check.sh3# Description: Repository hygiene: author header on first-party sources, no signing material, no credentials, no network code.4# Author: Simon-Pierre Boucher — contact@spboucher.ai5set -uo pipefail6cd "$(dirname "$0")/.."7status=08echo "== headers"9while IFS= read -r f; do head -8 "$f" | grep -q "Author: Simon-Pierre Boucher" || { echo "missing header: $f"; status=1; }; done \10  < <(git ls-files -co --exclude-standard -- '*.swift' '*.sh' '*.py' 'project.yml')11echo "== signing material"12git ls-files -co --exclude-standard | grep -E '\.(p8|p12|cer|mobileprovision|provisionprofile|keychain|pem)$|(^|/)\.env|AuthKey_' && status=113echo "== secrets"14patterns='-----BEGIN [A-Z ]*PRIVATE KEY-----|AuthKey_[A-Z0-9]{10}|(api[_-]?key|apikey|secret|token|password|passwd)["'"'"' ]*[:=] *["'"'"'][^"'"'"' ]{8,}|sk-[A-Za-z0-9_-]{20,}|ghp_[A-Za-z0-9]{30,}|192\.168\.[0-9]+\.[0-9]+|100\.[0-9]+\.[0-9]+\.[0-9]+|10\.67\.[0-9]+\.[0-9]+'15hits=$(git ls-files -co --exclude-standard | grep -vE '\.(png|jpg|pdf|icns)$|^Scripts/check\.sh$' | tr '\n' '\0' | xargs -0 grep -nIE "$patterns" 2>/dev/null || true)16[[ -n "$hits" ]] && { echo "$hits" | cut -c1-200; status=1; }17echo "== no network code in the product"18net=$(grep -rnE "URLSession|NWConnection|CFSocket|import Network|URLRequest|WKWebView" App/Sources Packages/ORIXCleanCore/Sources/ORIXCleanCore || true)19[[ -n "$net" ]] && { echo "$net"; status=1; }20echo "== no private API / privilege escalation"21priv=$(grep -rnE "AuthorizationExecuteWithPrivileges|SMJobBless|NSAppleScript|/usr/bin/sudo|dlopen\(|_CS|csrutil" App/Sources Packages/ORIXCleanCore/Sources/ORIXCleanCore || true)22[[ -n "$priv" ]] && { echo "$priv"; status=1; }23[[ $status -eq 0 ]] && echo "clean" || echo "FINDINGS"24exit $status25
Files main
Menu

Theme