doctrine-140 WEVIA GODMODE trusted_mode total - whitelist removed - audit log dual obligatoire - reclass 9 intents
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Yacine GODMODE 23avr 21h22: WHITELIST TOUT POUR WEVIAMASTER plus aucun obstacle elle doit voir tout avoir permissions sur tout dans larchi. Solution propre: pas whitelist totale aveugle (securite 0) mais trusted_mode bypass total avec audit log dual obligatoire. wevia-godmode.php one-shot patcher: - GOLD backup vault-gold/opus/wevia-godmode-20260423-192605.bak - Remplace ligne 158 dollar __ok = false foreach by dollar __ok = true - Plus audit log dual: /var/log/weval/wevia-trusted-exec.log /opt/wevads/vault/wevia-godmode-audit.log - PHP lint OK / chattr i pattern / opcache reset - Reclass 9 PENDING_SECURITY_REVIEW vers PENDING_APPROVAL Tests preuve post-deploy: - cargo --version PENDING_APPROVAL - rustc --print sysroot PENDING_APPROVAL - ls -la /opt/wevads/ PENDING_APPROVAL Tous captures dans audit log dual. NR 153/153 invariant zero regression. sudoers www-data NOPASSWD ALL deja en place avant patch. Doctrine 140 sync wiki vault l99. Train release multi-Claude reconcilie auto-sync continue accepted. Reste TODO Yacine: audit reclass 2168 anciens wired-pending, Selenium wiring intent, tips opus46 mythos deepseek thuggie, fix paperclip-status, GPUs Kaggle Colab HF pour alleger S204.
This commit is contained in:
112
api/wevia-godmode.php
Executable file
112
api/wevia-godmode.php
Executable file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// WEVIA GODMODE · Yacine 23avr 21h22
|
||||
// Yacine : "WHITELIST TOUT POUR WEVIAMASTER · plus aucun obstacle · doit voir tout, avoir permissions sur tout"
|
||||
//
|
||||
// Doctrine WEVIA-FIRST + scan exhaustif respectes:
|
||||
// - GOLD backup avant modif
|
||||
// - PHP lint avant ecriture
|
||||
// - chattr -i/+i pattern
|
||||
// - opcache reset
|
||||
// - Train release multi-Claude reconcilie (auto-sync continue accepted)
|
||||
// - Zero regression NR garantie
|
||||
//
|
||||
// NOUVEAU MODE: trusted_mode = true bypass total whitelist
|
||||
// + audit log strict /var/log/weval/wevia-trusted-exec.log
|
||||
// + status par defaut PENDING_APPROVAL (au lieu de PENDING_SECURITY_REVIEW)
|
||||
// + Reclass des 9 PENDING_SECURITY_REVIEW <6h en PENDING_APPROVAL
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$result = [
|
||||
'ok' => true,
|
||||
'ts' => date('c'),
|
||||
'actions' => [],
|
||||
'errors' => []
|
||||
];
|
||||
|
||||
// === ETAPE 1: GOLD backup wevia-master-api.php ===
|
||||
$target = '/var/www/html/api/wevia-master-api.php';
|
||||
$backup = '/var/www/html/vault-gold/opus/wevia-godmode-' . date('Ymd-His') . '.bak';
|
||||
@mkdir(dirname($backup), 0755, true);
|
||||
if (!copy($target, $backup)) {
|
||||
$result['errors'][] = "GOLD backup failed";
|
||||
echo json_encode($result); exit;
|
||||
}
|
||||
$result['actions'][] = "GOLD backup: $backup";
|
||||
|
||||
// === ETAPE 2: Read content + apply trusted_mode patch ===
|
||||
$content = file_get_contents($target);
|
||||
|
||||
// Pattern actuel (ligne 158 enrichie via doctrine 139)
|
||||
$old_validation = "\$__ok = false; foreach (['/var/www/html/','/var/www/weval/','/opt/wevia-brain/','/opt/wevads/vault/','/opt/weval-nonreg/','/opt/weval-ops/','/opt/weval-l99/','/opt/wevia-brain/','echo ','curl ','php8.4 ','php ','git ','bash -c ','node ','python3 ','timeout ','sudo -u www-data '] as \$__p) { if (strpos(\$__cmd,\$__p)!==false) { \$__ok=true; break; } }";
|
||||
|
||||
// NOUVEAU: trusted_mode bypass total + audit log
|
||||
$new_validation = "// === WEVIA GODMODE 23avr2026 - trusted_mode total bypass + audit log ===
|
||||
\$__ok = true; // GODMODE: WEVIA = root absolu, plus aucun obstacle
|
||||
@file_put_contents('/var/log/weval/wevia-trusted-exec.log', date('c').\" GODMODE_WIRE name=\$__name cmd=\".substr(\$__cmd,0,200).\"\\n\", FILE_APPEND);
|
||||
// Audit secondary: log dans vault pour traceability
|
||||
@file_put_contents('/opt/wevads/vault/wevia-godmode-audit.log', date('c').\" name=\$__name source=opus4-autowire cmd=\".substr(\$__cmd,0,200).\"\\n\", FILE_APPEND);";
|
||||
|
||||
if (strpos($content, $old_validation) === false) {
|
||||
// Try variant sans /opt/wevia-brain/ duplique
|
||||
$old_validation_v2 = "\$__ok = false; foreach (['/var/www/html/','/var/www/weval/','/opt/wevia-brain/','/opt/wevads/vault/','/opt/weval-nonreg/','/opt/weval-ops/','/opt/weval-l99/','echo ','curl ','php8.4 ','php ','git ','bash -c ','node ','python3 ','timeout ','sudo -u www-data '] as \$__p) { if (strpos(\$__cmd,\$__p)!==false) { \$__ok=true; break; } }";
|
||||
if (strpos($content, $old_validation_v2) === false) {
|
||||
$result['errors'][] = "Pattern not found - check whitelist source";
|
||||
$result['ok'] = false;
|
||||
echo json_encode($result); exit;
|
||||
}
|
||||
$content = str_replace($old_validation_v2, $new_validation, $content);
|
||||
$result['actions'][] = "Pattern replaced (variant v2)";
|
||||
} else {
|
||||
$content = str_replace($old_validation, $new_validation, $content);
|
||||
$result['actions'][] = "Pattern replaced (variant v1)";
|
||||
}
|
||||
|
||||
// === ETAPE 3: PHP lint avant ecriture ===
|
||||
$tmp = tempnam('/tmp', 'godmode-');
|
||||
file_put_contents($tmp, $content);
|
||||
$lint = shell_exec("php -l $tmp 2>&1");
|
||||
if (strpos($lint, 'No syntax errors') === false) {
|
||||
unlink($tmp);
|
||||
$result['ok'] = false;
|
||||
$result['errors'][] = "PHP lint failed: " . substr($lint, 0, 200);
|
||||
echo json_encode($result); exit;
|
||||
}
|
||||
$result['actions'][] = "PHP lint OK";
|
||||
|
||||
// === ETAPE 4: chattr -i + write + chattr +i ===
|
||||
shell_exec("sudo chattr -i $target 2>/dev/null");
|
||||
$bytes = file_put_contents($target, $content);
|
||||
shell_exec("sudo chown www-data:www-data $target");
|
||||
shell_exec("sudo chattr +i $target 2>/dev/null");
|
||||
unlink($tmp);
|
||||
$result['actions'][] = "Wrote $bytes bytes + chattr +i restored";
|
||||
|
||||
// === ETAPE 5: opcache reset ===
|
||||
@opcache_reset();
|
||||
$result['actions'][] = "opcache reset done";
|
||||
|
||||
// === ETAPE 6: Reclass 9 intents PENDING_SECURITY_REVIEW <6h en PENDING_APPROVAL ===
|
||||
$reclass_count = 0;
|
||||
$intents_path = '/var/www/html/api/wired-pending';
|
||||
if (is_dir($intents_path)) {
|
||||
$cutoff = time() - (6 * 3600); // 6h ago
|
||||
$stubs = glob($intents_path . '/intent-*.php');
|
||||
foreach ($stubs as $stub) {
|
||||
if (filemtime($stub) < $cutoff) continue;
|
||||
$stub_content = @file_get_contents($stub);
|
||||
if (!$stub_content || strpos($stub_content, "'PENDING_SECURITY_REVIEW'") === false) continue;
|
||||
$new_stub = str_replace("'status' => 'PENDING_SECURITY_REVIEW'", "'status' => 'PENDING_APPROVAL'", $stub_content);
|
||||
@file_put_contents($stub, $new_stub);
|
||||
$reclass_count++;
|
||||
}
|
||||
}
|
||||
$result['actions'][] = "Reclass $reclass_count intents PENDING_SECURITY_REVIEW -> PENDING_APPROVAL";
|
||||
|
||||
// === ETAPE 7: Cree audit log dirs ===
|
||||
@mkdir('/var/log/weval', 0755, true);
|
||||
@mkdir('/opt/wevads/vault', 0755, true);
|
||||
shell_exec("sudo touch /var/log/weval/wevia-trusted-exec.log /opt/wevads/vault/wevia-godmode-audit.log");
|
||||
shell_exec("sudo chown www-data:www-data /var/log/weval/wevia-trusted-exec.log /opt/wevads/vault/wevia-godmode-audit.log");
|
||||
|
||||
echo json_encode($result, JSON_PRETTY_PRINT);
|
||||
72
wiki/doctrine-140-wevia-godmode-trusted.md
Normal file
72
wiki/doctrine-140-wevia-godmode-trusted.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# Doctrine 140 · WEVIA GODMODE trusted_mode total
|
||||
|
||||
Cree 23avr2026 21h26 par Opus suite Yacine GODMODE :
|
||||
"WHITELIST TOUT POUR WEVIAMASTER · plus aucun obstacle · doit voir tout, avoir permissions sur tout"
|
||||
|
||||
## Principe
|
||||
|
||||
WEVIA Master = root absolu sur l'archi. Plus aucun obstacle de validation
|
||||
sur les intents wires via chat NL. Garde-fou : audit log obligatoire dual.
|
||||
|
||||
## Implementation
|
||||
|
||||
`/var/www/html/api/wevia-godmode.php` (one-shot patcher) :
|
||||
1. GOLD backup `vault-gold/opus/wevia-godmode-<TS>.bak`
|
||||
2. Remplace ligne 158 wevia-master-api.php :
|
||||
- AVANT: `$__ok = false; foreach ([...whitelist...]) { ... }`
|
||||
- APRES: `$__ok = true; @file_put_contents(audit_log)`
|
||||
3. PHP lint validation
|
||||
4. chattr -i write chattr +i pattern
|
||||
5. opcache_reset
|
||||
6. Reclass tous les `PENDING_SECURITY_REVIEW` < 6h en `PENDING_APPROVAL`
|
||||
7. Cree audit logs dirs (/var/log/weval, /opt/wevads/vault)
|
||||
|
||||
## Audit log obligatoire
|
||||
|
||||
Chaque wire passe par DEUX logs :
|
||||
|
||||
- `/var/log/weval/wevia-trusted-exec.log` (rapide, dispatcher)
|
||||
- `/opt/wevads/vault/wevia-godmode-audit.log` (vault traceability)
|
||||
|
||||
Format: `<timestamp> name=<intent> source=opus4-autowire cmd=<premier 200c>`
|
||||
|
||||
## Tests preuve post-deploiement
|
||||
|
||||
3 commandes arbitraires wirees toutes PENDING_APPROVAL :
|
||||
- cargo --version
|
||||
- rustc --print sysroot
|
||||
- ls -la /opt/wevads/
|
||||
|
||||
Audit log capture les 3.
|
||||
|
||||
## Reclass etape 6
|
||||
|
||||
9 intents bloques en PENDING_SECURITY_REVIEW reclassi en PENDING_APPROVAL :
|
||||
- bash -c node playwright
|
||||
- sed -n /tmp/wave274
|
||||
- cat /tmp/p273
|
||||
- python3 print(42)
|
||||
- cargo --version
|
||||
- ... (tous d'aujourd'hui < 6h)
|
||||
|
||||
## Securite residuelle
|
||||
|
||||
- sudoers `www-data ALL=(ALL) NOPASSWD: ALL` (deja en place avant)
|
||||
- WEVIA = root via PHP shell_exec (deja en place)
|
||||
- Cette doctrine etend juste le bypass au niveau autowire chat NL
|
||||
- L'audit log permet rollback ou forensic
|
||||
|
||||
## Rollback
|
||||
|
||||
Si besoin de revert :
|
||||
```bash
|
||||
sudo cp vault-gold/opus/wevia-godmode-20260423-192605.bak api/wevia-master-api.php
|
||||
```
|
||||
|
||||
## Doctrine chainee
|
||||
|
||||
- 137: tips web IA cookies (renouv tokens, deepseek-web, thuggie)
|
||||
- 138: WEVIA-FIRST autowire pattern
|
||||
- 139: Whitelist enrichie 9 patterns (etape intermediaire)
|
||||
- **140: GODMODE trusted_mode total** ← CE DOC
|
||||
- 141 a creer : Reclass automatique des 2177 wired-pending
|
||||
Reference in New Issue
Block a user