Files
SGF/scripts/sgf-assets-routing-proof.php
T
2026-11-11 09:00:17 +02:00

5 lines
2.3 KiB
PHP

<?php
require __DIR__.'/sgf-selected-assets.php';$repo=dirname(__DIR__);$run=json_decode(file_get_contents('C:/laragon/data/sgf-tempo/run/modular-regression-current.json'),true);$root=$run['root'].'/private/receipt-composition-cc50a276c10c';$s=json_decode(file_get_contents($root.'/state.json'),true);$checks=[];$ok=function($v,$name)use(&$checks){if(!$v)throw new LogicException($name);$checks[]=$name;};foreach(['sgf-entry-menu','sgf-stock-final','sgf-stock-completion','sgf-stock-catalogue','sgf-service-documents','sgf-cash','sgf-iva','sgf-fiscal-rules','sgf-bank','sgf-indicators']as$name)$ok(sgfSelectedAsset($s,'/'.$name.'.mjs')===realpath($s['app'].'/public/'.$name.'.mjs'),'selected exact public module '.$name);
$other=$s;$other['tag']='other-composition';$ok(sgfSelectedAsset($other,'/sgf-stock-final.mjs')===null,'other installation unchanged');$off=$s;$off['singleInstallation']=false;$ok(sgfSelectedAsset($off,'/sgf-stock-final.mjs')===null,'non-selected composition unchanged');foreach(['/../binding.json','/config/stock_catalogue.php','/sgf-stock-final.mjs/../../binding.json','/unknown.mjs']as$path)$ok(sgfSelectedAsset($s,$path)===null,'no general filesystem access '.$path);
$source=str_replace("\r\n","\n",file_get_contents(__DIR__.'/receipt-composition-http.php'));$before=str_replace("\r\n","\n",file_get_contents($root.'/single-integration/20261110-214607-6709696b/router-before-asset-fix.php'));$source=str_replace("require_once __DIR__.'/sgf-selected-assets.php';\n\$assetPath=parse_url(\$_SERVER['REQUEST_URI'],PHP_URL_PATH);\nif(is_string(\$assetPath)&&sgfSelectedAsset(\$s,\$assetPath)!==null)return false;\n",'',$source);$source=str_replace("if((\$s['singleInstallation']??false)===true&&(\$s['tag']??null)==='cc50a276c10c'&&is_string(\$assetPath)&&str_ends_with(\$assetPath,'.mjs')){http_response_code(404);header('Content-Type: text/plain; charset=UTF-8');echo 'Recurso de cliente indisponível.';return;}\n",'',$source);$ok($source===$before,'original router body and existing whitelist preserved');$file=$root.'/asset-routing-boundaries-20261110.json';file_put_contents($file,json_encode(['passed'=>true,'checks'=>$checks,'database_writes'=>0,'other_installations_unchanged'=>true,'browser_visual_review'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'checks'=>count($checks),'proof'=>$file]).PHP_EOL;