mirror of
https://github.com/myronblair/jarvis
synced 2026-07-27 16:22:55 -05:00
Auth hardening: login rate-limiting + session fixation defenses
- login.php: Redis-backed per-IP rate limit (10 fails / 15 min lockout), keyed off CF-Connecting-IP/X-Forwarded-For so it sees the real client behind NPM; fails open if Redis is down - login.php: session_regenerate_id(true) on successful auth (prevents session fixation) - php.ini: session.use_strict_mode = 1 (reject unknown/attacker-supplied session IDs) - netscan.php: constant-time hash_equals for the registration-key check (matches agent.php) Cookie flags already HttpOnly + SameSite=Lax (verified live). Agent auth verified: missing/bad X-Agent-Key -> 401 on every machine action. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ if ($method !== 'POST') {
|
||||
}
|
||||
|
||||
$reqKey = $_SERVER['HTTP_X_REGISTRATION_KEY'] ?? '';
|
||||
if ($reqKey !== NETSCAN_KEY) {
|
||||
if (!hash_equals(NETSCAN_KEY, $reqKey)) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['error' => 'Unauthorized']); exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user