Repository Public License
1#!/usr/bin/env bash2# ORIX Scan3# File: Scripts/check.sh4# Description: Repository hygiene checks: author header on every first-party source file, and a scan of tracked and staged5# files for credentials or signing material. Exits non-zero on any finding.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -uo pipefail10cd "$(dirname "$0")/.."11status=01213echo "== headers"14while IFS= read -r file; do15 head -12 "$file" | grep -q "Author: Simon-Pierre Boucher" || { echo "missing header: $file"; status=1; }16done < <(git ls-files -co --exclude-standard -- '*.swift' '*.sh' '*.py' 'project.yml')1718echo "== secrets"19files=$(git ls-files -co --exclude-standard)20# File types that must never be tracked.21echo "$files" | grep -E '\.(p8|p12|cer|mobileprovision|provisionprofile|keychain|pem)$|(^|/)\.env|AuthKey_' && { echo "signing material or env file present"; status=1; }22# Content patterns: private keys, API key assignments, issuer ids, bearer tokens, sudo-style passwords, private addresses.23patterns='-----BEGIN [A-Z ]*PRIVATE KEY-----|AuthKey_[A-Z0-9]{10}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}.*(issuer|ISSUER)|(issuer|ISSUER).*[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|(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]+'24hits=$(echo "$files" | grep -vE '\.(png|jpg|jpeg|pdf|ico)$|^Scripts/check\.sh$' | tr '\n' '\0' | xargs -0 grep -nIE "$patterns" 2>/dev/null || true)25if [[ -n "$hits" ]]; then echo "$hits" | cut -c1-200; status=1; fi2627[[ $status -eq 0 ]] && echo "clean" || echo "FINDINGS"28exit $status29