SPB Git

Repository Public License

check.sh 3.2 KB 66 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Camera8# File             : Scripts/check.sh9# Description      : Repository hygiene checks: author header on every10#                    first-party source file, and a scan of tracked and staged11#                    files for credentials or signing material. Exits non-zero12#                    on any finding.13# Module           : Scripts14# Repository       : https://git.spboucher.ai/orix-camera15# Project Website  : https://www.orixlab.dev16# Created          : 2026-11-2117# Last Modified    : 2026-11-2118#19# Author           : Simon-Pierre Boucher20# Position         : Professor of Finance21# Institution      : Université du Québec en Outaouais (UQO)22# Organization     : SP Boucher23# Website          : https://spboucher.ai24# Git              : https://git.spboucher.ai25#26# Preferred Contact: support@spboucher.ai27# Technical Contact: dev@spboucher.ai28# Security/Admin   : admin@spboucher.ai29#30# Copyright (c) 202631# Simon-Pierre Boucher32# All rights reserved where applicable. This file is governed by the33# applicable project license, copyright notices and relevant law.34# Existing third-party rights and notices remain unaffected.35#36# License          : Proprietary, all rights reserved (see license file)37# License File     : LICENSE38#39# Do not embed credentials, private keys, access tokens,40# certificates or confidential personal information.41#42# =============================================================================43# END OF SP BOUCHER SOURCE HEADER44# =============================================================================4546set -uo pipefail47cd "$(dirname "$0")/.."48status=04950echo "== headers"51while IFS= read -r file; do52  head -12 "$file" | grep -q "Author: Simon-Pierre Boucher" || { echo "missing header: $file"; status=1; }53done < <(git ls-files -co --exclude-standard -- '*.swift' '*.sh' '*.py' 'project.yml')5455echo "== secrets"56files=$(git ls-files -co --exclude-standard)57# File types that must never be tracked.58echo "$files" | grep -E '\.(p8|p12|cer|mobileprovision|provisionprofile|keychain|pem)$|(^|/)\.env|AuthKey_' && { echo "signing material or env file present"; status=1; }59# Content patterns: private keys, API key assignments, issuer ids, bearer tokens, sudo-style passwords, private addresses.60patterns='-----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]+'61hits=$(echo "$files" | grep -vE '\.(png|jpg|jpeg|pdf|ico)$|^Scripts/check\.sh$' | tr '\n' '\0' | xargs -0 grep -nIE "$patterns" 2>/dev/null || true)62if [[ -n "$hits" ]]; then echo "$hits" | cut -c1-200; status=1; fi6364[[ $status -eq 0 ]] && echo "clean" || echo "FINDINGS"65exit $status66
Files main
Menu

Theme