12 lines
1.6 KiB
PHP
12 lines
1.6 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args','1');
|
|
set_exception_handler(function(Throwable $e){fwrite(STDERR,$e::class.' line '.$e->getLine().PHP_EOL);exit(1);});
|
|
$root=dirname(__DIR__,2);require $root.'/vendor/autoload.php';$app=require $root.'/bootstrap/app.php';$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
Illuminate\Support\Facades\DB::statement('BEGIN READ ONLY');
|
|
try{
|
|
$t=Illuminate\Support\Facades\DB::selectOne('SELECT current_database() AS database, inet_server_port() AS port');if($t->database!=='investemoz'||(int)$t->port!==5432)throw new RuntimeException('Target mismatch');
|
|
$u=App\Models\User::where('id',2)->where('name','Osmane Nala')->get();if($u->count()!==1||!$u[0]->can('manage-portal')){echo json_encode(['matching_accounts'=>$u->count(),'verified'=>$u->count()===1?$u[0]->hasVerifiedEmail():null,'manager_match'=>$u->count()===1?in_array(strtolower($u[0]->email),config('portal.managers',[]),true):null,'manager_count'=>count(config('portal.managers',[]))]);throw new RuntimeException('Authenticated account must resolve uniquely with effective permission');}
|
|
$a=['at'=>gmdate('c'),'target'=>$t,'actor_id'=>$u[0]->id,'actor_name'=>$u[0]->name,'manage_portal'=>true,'browser_session_observed'=>true,'CLI_is_not_MFA'=>true,'scanner_available_in_authenticated_page'=>true];
|
|
if(is_file(__DIR__.'/ACTOR.json'))throw new RuntimeException('Preserve receipt');file_put_contents(__DIR__.'/ACTOR.json',json_encode($a,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR));echo json_encode($a,JSON_UNESCAPED_UNICODE);
|
|
}finally{Illuminate\Support\Facades\DB::statement('ROLLBACK');}
|