feat: audit cartography workbook with provenance and quarantine

This commit is contained in:
2026-09-28 20:48:34 +02:00
parent 2640dd6109
commit 439918d143
5 changed files with 340 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
<?php
use App\Services\CartographyWorkbookAudit;
// Explicit paths only; no Laravel boot, database connection, import or publication.
require __DIR__.'/../vendor/autoload.php';
try {
$manifestPath = getenv('INVESTMOZ_CARTOGRAPHY_MANIFEST');
$workbookPath = getenv('INVESTMOZ_CARTOGRAPHY_FILE');
if (! $manifestPath || ! $workbookPath || ! is_file($manifestPath) || filesize($manifestPath) > 100000) {
throw new RuntimeException('Set INVESTMOZ_CARTOGRAPHY_FILE and INVESTMOZ_CARTOGRAPHY_MANIFEST to authorised local files.');
}
$manifest = json_decode(file_get_contents($manifestPath), true, 32, JSON_THROW_ON_ERROR);
$report = (new CartographyWorkbookAudit)->inspect($workbookPath, $manifest);
echo json_encode($report, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR).PHP_EOL;
} catch (Throwable $exception) {
fwrite(STDERR, 'Audit failed: '.$exception->getMessage().PHP_EOL);
exit(1);
}