@@ -1,23 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
// Read-only check: never print a password, encrypted value, MFA secret or token.
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
require __DIR__.'/portal-qa-environment.php';
|
||||
$target = portalQaEnvironment();
|
||||
$app = require dirname(__DIR__).'/bootstrap/app.php';
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
$identity = portalQaAssertTarget($target);
|
||||
$directory = storage_path('app/private/investmoz-v2/portal-audit');
|
||||
$credentials = json_decode(file_get_contents($directory.'/investor-mfa-qa-private.json'), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (($credentials['email'] ?? null) !== 'investor-mfa-qa@example.invalid' || (int) ($credentials['actor_id'] ?? 0) !== 18) {
|
||||
throw new RuntimeException('Unexpected synthetic QA identity; refused.');
|
||||
}
|
||||
$connection = Illuminate\Support\Facades\DB::connection();
|
||||
$connection = DB::connection();
|
||||
$connection->statement('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY');
|
||||
try {
|
||||
$matches = App\Models\User::whereRaw('lower(trim(email)) = ?', [$credentials['email']])->get();
|
||||
$matches = User::whereRaw('lower(trim(email)) = ?', [$credentials['email']])->get();
|
||||
$actor = $matches->firstWhere('id', 18);
|
||||
$passwordMatches = $actor && Illuminate\Support\Facades\Hash::check($credentials['password'], $actor->password);
|
||||
$passwordMatches = $actor && Hash::check($credentials['password'], $actor->password);
|
||||
$mfaDecrypts = false;
|
||||
$mfaSecretMatches = false;
|
||||
if ($actor && $actor->two_factor_secret) {
|
||||
@@ -26,7 +32,7 @@ try {
|
||||
$mfaDecrypts = is_string($secret);
|
||||
$mfaSecretMatches = isset($credentials['totp_secret']) && hash_equals($credentials['totp_secret'], $secret);
|
||||
unset($secret);
|
||||
} catch (Illuminate\Contracts\Encryption\DecryptException $exception) {
|
||||
} catch (DecryptException $exception) {
|
||||
// Record the classification only; do not expose cipher text or exception details.
|
||||
}
|
||||
}
|
||||
@@ -40,7 +46,7 @@ try {
|
||||
'email_exact' => $actor && $actor->email === $credentials['email'],
|
||||
'local_password_matches_database' => (bool) $passwordMatches,
|
||||
'local_password_has_surrounding_whitespace' => trim($credentials['password']) !== $credentials['password'],
|
||||
'password_rehash_required' => $actor ? Illuminate\Support\Facades\Hash::needsRehash($actor->password) : null,
|
||||
'password_rehash_required' => $actor ? Hash::needsRehash($actor->password) : null,
|
||||
'mfa_confirmed' => $actor && $actor->two_factor_confirmed_at !== null,
|
||||
'mfa_secret_decrypts' => $mfaDecrypts,
|
||||
'local_mfa_secret_matches_database' => $mfaSecretMatches,
|
||||
|
||||
Reference in New Issue
Block a user