15 lines
2.0 KiB
PHP
15 lines
2.0 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args','1');
|
|
try{
|
|
$portal=dirname(__DIR__,2);$dir=$portal.'/storage/app/private/investmoz-v2/portal-audit';$plan=json_decode(file_get_contents($dir.'/portal-stability-latest.json'),true,512,JSON_THROW_ON_ERROR);
|
|
putenv('STABILITY_QA_MODE=consumers');$app=(static fn($p)=>require $p)($plan['source'].'/tools/portal-stability-runtime.php');
|
|
$db=Illuminate\Support\Facades\DB::class;$db::beginTransaction();$db::statement('SET TRANSACTION READ ONLY');$result=[];
|
|
$candidates=[];
|
|
foreach(['resource-http-actors-private.json','i0-qa-actor-private.json','revision-geo-actor-qa.json'] as $file){if(!is_file($dir.'/'.$file))continue;$data=json_decode(file_get_contents($dir.'/'.$file),true,512,JSON_THROW_ON_ERROR);if(isset($data['manager']))$data=$data['manager'];$candidates[$file]=$data;}
|
|
foreach($candidates as $file=>$data){$email=$data['email']??null;$user=$email?App\Models\User::where('email',$email)->first():null;$entry=['source_file'=>$file,'account_exists'=>$user!==null,'password_matches'=>false,'MFA_secret_matches'=>false];
|
|
if($user){$entry['user_id']=$user->id;$entry['can_manage_portal']=$user->can('manage-portal');$entry['mfa_confirmed']=$user->two_factor_confirmed_at!==null;$entry['password_matches']=isset($data['password'])&&Illuminate\Support\Facades\Hash::check($data['password'],$user->password);$secret=$data['totp_secret']??$data['secret']??null;if($user->two_factor_secret&&$secret){try{$entry['MFA_secret_matches']=hash_equals(Laravel\Fortify\Fortify::currentEncrypter()->decrypt($user->two_factor_secret),$secret);}catch(Throwable $e){$entry['envelope_unreadable']=true;}}}
|
|
$result[]=$entry;
|
|
}
|
|
$db::rollBack();file_put_contents(__DIR__.'/QA-credential-correspondence.json',json_encode(['read_only'=>true,'target'=>'stability_consumers_20261011_084534_test:55441','candidates'=>$result],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode($result);
|
|
}catch(Throwable $e){echo json_encode(['result'=>'stopped','type'=>$e::class,'line'=>$e->getLine()]);exit(1);}
|