From 7c99ae85ea1dd20a9f9e73f32ab09f8b4f2dc7f8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Mar 2026 23:03:40 +0000 Subject: [PATCH] Add mandatory execution guardrails and clean-state policy Co-authored-by: Yacineutt --- .gitignore | 9 ++++ README.md | 4 +- REGLES_EXECUTION_OBLIGATOIRES.md | 32 +++++++++++++ dp-release-gate.sh | 77 ++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 REGLES_EXECUTION_OBLIGATOIRES.md create mode 100755 dp-release-gate.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..74d1a2b --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Generated execution artifacts (keep repo clean / 0 dirty) +reports/raw_*/ +reports/nonreg_20*.md +reports/multiinstall_preflight_20*.csv +reports/p0_p1_p2_execution_20*.md + +# Local temp files +*.tmp +*.swp diff --git a/README.md b/README.md index 818f6a7..b216a00 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # WEVADS GPU Server -- **IP**: 88.198.4.195 +- **IP**: managed outside this repository - **GPU**: NVIDIA RTX 4000 SFF Ada (20GB vRAM) - **RAM**: 62GB DDR4 - **Disk**: 1.7TB NVMe @@ -11,4 +11,6 @@ - `nonreg-framework.sh`: anti-regression gate (HTTP/API/WEVIA/tracking/confidentiality checks) - `multiinstall-safe-preflight.sh`: safe server preflight before multi-install batches - `execute_all_p0_p1_p2.sh`: full execution pipeline (P0/P1/P2) with Sentinel checks and final report +- `dp-release-gate.sh`: guardrail checks (forbidden touches, confidentiality, php-lint, cleanliness) - `CHANTIERS_RESTANTS_EXECUTION_PLAN.md`: execution plan and GO/NO-GO criteria +- `REGLES_EXECUTION_OBLIGATOIRES.md`: mandatory execution policy agreed with DP diff --git a/REGLES_EXECUTION_OBLIGATOIRES.md b/REGLES_EXECUTION_OBLIGATOIRES.md new file mode 100644 index 0000000..6eb6d68 --- /dev/null +++ b/REGLES_EXECUTION_OBLIGATOIRES.md @@ -0,0 +1,32 @@ +# Regles d'execution obligatoires (DP/Claude) + +Ces regles sont bloquantes pour toute intervention. + +## Interdits absolus + +1. **Ne PAS toucher PMTA / SSH config** + - Justification: incidents critiques des 20-21 janvier. +2. **Ne PAS modifier `multiInstall.js` / JAR Java** + - Justification: race conditions et blocages observes. +3. **Ne PAS remplacer des fichiers entiers** + - Mode obligatoire: corrections chirurgicales (`str_replace` cible, patch localise). + +## Obligations a chaque lot + +1. **GOLD backup avant modification** + - Exemple: `cp file file.bak-$(date +%H%M)`. +2. **PHP syntax check apres chaque edit** + - Exemple: `php -l fichier.php`. +3. **0 info confidentielle dans le code** + - Cibles: concurrents, clients sensibles, IPs internes, termes internes interdits. +4. **Commit + push apres chaque lot** + - Objectif: zero derive, historique traçable. +5. **Test non-regression apres chaque lot** + - Commande: `./nonreg-framework.sh`. + +## Validation DP + +- 0 regression +- 0 dirty +- aucune modification interdite +- rapport final fourni a Claude diff --git a/dp-release-gate.sh b/dp-release-gate.sh new file mode 100755 index 0000000..97e8b9e --- /dev/null +++ b/dp-release-gate.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +set -euo pipefail + +# DP release guardrail checks + +FORBIDDEN_PATH_REGEX='(pmta|powermta|multiInstall\.js|adxapp\.jar|/\.ssh/|sshd_config)' +FORBIDDEN_TERMS_REGEX='(McKinsey|OpenAI|Anthropic|Abbott|AbbVie|J&J|89\.167\.40\.150|88\.198\.4\.195)' + +echo "== DP Release Gate ==" + +fail() { + echo "FAIL: $*" >&2 + exit 1 +} + +warn() { + echo "WARN: $*" >&2 +} + +echo "[1/5] Check forbidden path modifications" +CHANGED_FILES="$( (git diff --name-only; git diff --cached --name-only) | sort -u )" +if [[ -n "${CHANGED_FILES}" ]] && echo "${CHANGED_FILES}" | rg -n -i "${FORBIDDEN_PATH_REGEX}" >/dev/null; then + echo "${CHANGED_FILES}" | rg -n -i "${FORBIDDEN_PATH_REGEX}" || true + fail "Forbidden component touched (PMTA/SSH/JAR/multiInstall.js)" +fi + +echo "[2/5] Check confidential terms in repo content" +if rg -n -i "${FORBIDDEN_TERMS_REGEX}" /workspace \ + --glob '!reports/**' \ + --glob '!*vendor/**' \ + --glob '!*.bak*' \ + --glob '!*.md' \ + --glob '!README.md' \ + --glob '!nonreg-framework.sh' \ + --glob '!execute_all_p0_p1_p2.sh' \ + --glob '!dp-release-gate.sh' >/dev/null; then + rg -n -i "${FORBIDDEN_TERMS_REGEX}" /workspace \ + --glob '!reports/**' \ + --glob '!*vendor/**' \ + --glob '!*.bak*' \ + --glob '!*.md' \ + --glob '!README.md' \ + --glob '!nonreg-framework.sh' \ + --glob '!execute_all_p0_p1_p2.sh' \ + --glob '!dp-release-gate.sh' | sed -n '1,40p' + fail "Confidential terms detected in repository content" +fi + +echo "[3/5] PHP syntax checks for changed PHP files" +PHP_CHANGED="$(echo "${CHANGED_FILES}" | rg -n '\.php$' || true)" +PHP_CHANGED="$(echo "${PHP_CHANGED}" | sed 's/^[0-9]*://')" +if [[ -n "${PHP_CHANGED}" ]]; then + while IFS= read -r f; do + [[ -z "$f" ]] && continue + [[ -f "$f" ]] || continue + php -l "$f" >/dev/null || fail "PHP syntax invalid: $f" + done <<< "${PHP_CHANGED}" +else + warn "No changed PHP files to lint" +fi + +echo "[4/5] Run anti-regression smoke" +if [[ "${RUN_NONREG:-1}" == "1" ]]; then + /workspace/nonreg-framework.sh >/tmp/dp_nonreg_gate.out 2>&1 || warn "nonreg returned failures (see /tmp/dp_nonreg_gate.out)" +else + warn "RUN_NONREG=0, skip nonreg run" +fi + +echo "[5/5] Check git cleanliness" +if [[ "${ALLOW_DIRTY:-0}" != "1" ]]; then + if [[ -n "$(git status --short)" ]]; then + git status --short + fail "Working tree not clean (0 dirty rule)" + fi +fi + +echo "PASS: DP Release Gate checks completed."