SPB Git

Repository Public BSD-3-Clause

check.sh 3.1 KB 60 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Maps8# File             : scripts/check.sh9# Module           : scripts10# Repository       : https://git.spboucher.ai/orix-maps11# Created          : 2026-11-2512# Last Modified    : 2026-11-2513#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : Proprietary, all rights reserved (see license file)32# License File     : LICENSE33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# ORIX Maps — repository hygiene checks: no secrets, no private keys, no tracked geodata, no development key in a release binary.42# usage: scripts/check.sh [path to a built .app to inspect]43set -euo pipefail44cd "$(dirname "$0")/.."45fail=046tracked=$(git ls-files)47# Key material and credentials.48if echo "$tracked" | grep -E '\.(p8|p12|pem|key|mobileprovision)$|(^|/)\.env$' ; then echo "ERROR: key or credential files are tracked"; fail=1; fi49if git grep -n -I -E 'BEGIN (EC |RSA |OPENSSH )?PRIVATE KEY|AKIA[0-9A-Z]{16}|sk-[A-Za-z0-9]{32,}|ghp_[A-Za-z0-9]{36}' -- . ':!scripts/check.sh' ; then echo "ERROR: secret-looking content"; fail=1; fi50# Geodata never goes in git, except the bundled world base map and the small parser fixture.51big=$(echo "$tracked" | grep -E '\.(osm\.pbf|pmtiles|mbtiles|orixmap|orixgraph|sqlite|hgt)$' | grep -v -E '^Apps/ORIXMaps/Resources/BaseMap/world-base\.pmtiles$|Fixtures/monaco\.osm\.pbf$' || true)52if [ -n "$big" ]; then echo "ERROR: geodata tracked in git:"; echo "$big"; fail=1; fi53# The development signing key must exist only as a public key inside '#if DEBUG'.54if [ -n "${1:-}" ]; then55  dev=$(grep -o 'Data(base64Encoded: "[A-Za-z0-9+/=]*"), let key = TrustedKey(publicKey: data, label: "development")' Apps/ORIXMaps/Sources/Regions/RegionsModel.swift | sed -E 's/.*"([A-Za-z0-9+\/=]{40,})".*/\1/')56  if [ -n "$dev" ] && find "$1" -type f -perm +111 -exec strings {} \; 2>/dev/null | grep -q -F "$dev"; then echo "ERROR: the development key is present in $1"; fail=1; else echo "release binary: development key absent"; fi57fi58[ $fail -eq 0 ] && echo "checks passed"59exit $fail60
Files main
Menu

Theme