Reject requests for public key auth when the user has no keys

This commit is contained in:
DaneEveritt 2022-05-15 15:47:06 -04:00
parent 12927a3202
commit e856daee19
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -43,6 +43,12 @@ abstract class SftpAuthenticationController extends Controller
if (!password_verify($request->input('password'), $user->password)) {
$this->reject($request);
}
} else {
// Start blocking requests when the user has no public keys in the first place —
// don't let the user spam this endpoint.
if ($user->sshKeys->isEmpty()) {
$this->reject($request);
}
}
$this->validateSftpAccess($user, $server);