Skip to content

Commit e856dae

Browse files
committed
Reject requests for public key auth when the user has no keys
1 parent 12927a3 commit e856dae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/Http/Controllers/Api/Remote/SftpAuthenticationController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public function __invoke(SftpAuthenticationFormRequest $request): JsonResponse
4343
if (!password_verify($request->input('password'), $user->password)) {
4444
$this->reject($request);
4545
}
46+
} else {
47+
// Start blocking requests when the user has no public keys in the first place —
48+
// don't let the user spam this endpoint.
49+
if ($user->sshKeys->isEmpty()) {
50+
$this->reject($request);
51+
}
4652
}
4753

4854
$this->validateSftpAccess($user, $server);

0 commit comments

Comments
 (0)