feat: audit cartography workbook with provenance and quarantine
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user