SPB Git

Repository Public

check.sh 2.1 KB 32 lines shellscript

1#!/usr/bin/env bash2# ORIX DJ3# File: Scripts/check.sh4# Description: Repository hygiene: author header on first-party sources, no signing material, no credentials or5#              audio files, network code only in the Anthropic client, no privileged or private API.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -uo pipefail10cd "$(dirname "$0")/.."11status=012echo "== headers"13while IFS= read -r f; do head -16 "$f" | grep -q "Author: Simon-Pierre Boucher" || { echo "missing header: $f"; status=1; }; done \14  < <(git ls-files -co --exclude-standard -- '*.swift' '*.sh' '*.py' 'project.yml')15echo "== signing material and audio"16git ls-files -co --exclude-standard | grep -E '\.(p8|p12|cer|mobileprovision|provisionprofile|keychain|pem|wav|aiff|mp3|flac|m4a|caf)$|(^|/)\.env|AuthKey_' && status=117echo "== secrets"18patterns='-----BEGIN [A-Z ]*PRIVATE KEY-----|AuthKey_[A-Z0-9]{10}|sk-ant-[A-Za-z0-9_-]{24,}|ghp_[A-Za-z0-9]{30,}|192\.168\.[0-9]+\.[0-9]+|100\.[0-9]{2,3}\.[0-9]+\.[0-9]+|10\.67\.[0-9]+\.[0-9]+'19hits=$(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 | grep -v "sk-ant-test-0000" || true)20[[ -n "$hits" ]] && { echo "$hits" | cut -c1-200; status=1; }21echo "== network code only in the Anthropic client"22net=$(grep -rnE "URLSession|NWConnection|CFSocket|import Network|WKWebView" App/Sources Packages/ORIXDJCore/Sources | grep -vE "Sources/ORIXDJEngine/Anthropic/|Features/ClaudeStudio/|Features/Settings/" || true)23[[ -n "$net" ]] && { echo "$net"; status=1; }24echo "== the API key is never logged or written"25leak=$(grep -rnE "(print|NSLog|os_log|Logger)\(.*(apiKey|api_key)" App/Sources Packages/ORIXDJCore/Sources || true)26[[ -n "$leak" ]] && { echo "$leak"; status=1; }27echo "== no private API / privilege escalation / shell"28priv=$(grep -rnE "AuthorizationExecuteWithPrivileges|SMJobBless|NSAppleScript|/usr/bin/sudo|dlopen\(|Process\(\)|NSTask|posix_spawn" App/Sources Packages/ORIXDJCore/Sources || true)29[[ -n "$priv" ]] && { echo "$priv"; status=1; }30[[ $status -eq 0 ]] && echo "clean" || echo "FINDINGS"31exit $status32
Files main
Menu

Theme