Security plugin does not handle missing security callback correctly:
(./Plugin/OpenAPI/Security.pm:68)
for my $security_and (@security_or) {
for my $name (sort keys %$security_and) {
my $security_cb = $handlers->{$name};
if (!$security_cb) {
$res{$name} = {message => "No security callback for $name."} unless exists $res{$name};
}
elsif (!exists $res{$name}) {
$res{$name} = undef;
$n_checks++;
# $security_cb is obviously called synchronously, but the callback
# might also be called synchronously. We need the $sync_mode guard
# to make sure that we do not call continue() if that is the case.
$c->$security_cb(
$definitions->{$name},
$security_and->{$name},
sub {
$res{$name} //= $_[1];
$security_completed->() if --$n_checks == 0;
}
);
}
}
}
If there is no handler defined in the code, $security_completed->() is never called and does not deny the request.
Correct would be:
for my $security_and (@security_or) {
for my $name (sort keys %$security_and) {
my $security_cb = $handlers->{$name};
if (!$security_cb) {
$res{$name} = {message => "No security callback for $name."} unless exists $res{$name};
$security_completed->();
}
elsif (!exists $res{$name}) {
$res{$name} = undef;
$n_checks++;
# $security_cb is obviously called synchronously, but the callback
# might also be called synchronously. We need the $sync_mode guard
# to make sure that we do not call continue() if that is the case.
$c->$security_cb(
$definitions->{$name},
$security_and->{$name},
sub {
$res{$name} //= $_[1];
$security_completed->() if --$n_checks == 0;
}
);
}
}
}
Security plugin does not handle missing security callback correctly:
(./Plugin/OpenAPI/Security.pm:68)
If there is no handler defined in the code, $security_completed->() is never called and does not deny the request.
Correct would be: