remove WebGUI::Utility::isInSubnet
This commit is contained in:
parent
a3e08c3b8e
commit
ca7321f068
8 changed files with 15 additions and 68 deletions
|
|
@ -18,6 +18,7 @@ use WebGUI::International;
|
|||
use WebGUI::Workflow::Cron;
|
||||
use WebGUI::Workflow::Instance;
|
||||
use WebGUI::Utility;
|
||||
use Net::CIDR::Lite;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -271,7 +272,7 @@ sub www_runCronJob {
|
|||
my $session = shift;
|
||||
$session->http->setMimeType("text/plain");
|
||||
$session->http->setCacheControl("none");
|
||||
unless (isInSubnet($session->request->address, $session->config->get("spectreSubnets")) || canView($session)) {
|
||||
unless (Net::CIDR::Lite->new(@{ $session->config->get('spectreSubnets') })->find($session->request->address) || canView($session)) {
|
||||
$session->errorHandler->security("make a Spectre cron job runner request, but we're only allowed to accept requests from ".join(",",@{$session->config->get("spectreSubnets")}).".");
|
||||
return "error";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use POE::Component::IKC::ClientLite;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Workflow::Cron;
|
||||
use WebGUI::Workflow::Instance;
|
||||
use Net::CIDR::Lite;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ sub www_spectreGetSiteData {
|
|||
if (!defined $subnets) {
|
||||
$subnets = [];
|
||||
}
|
||||
if (!isInSubnet($session->request->address, $subnets)) {
|
||||
if (!Net::CIDR::Lite->new(@$subnets)->find($session->request->address)) {
|
||||
$session->errorHandler->security("Tried to make a Spectre workflow data load request, but we're only allowed to accept requests from "
|
||||
.join(",",@{$subnets}).".");
|
||||
}
|
||||
|
|
@ -182,7 +183,7 @@ sub www_spectreTest {
|
|||
}
|
||||
|
||||
my $sessionIp = $session->request->address;
|
||||
unless (isInSubnet($sessionIp, $subnets)) {
|
||||
unless (Net::CIDR::Lite->new(@$subnets)->find($sessionIp)) {
|
||||
$session->errorHandler->security(
|
||||
sprintf "Tried to make a Spectre workflow runner request from %s, but we're only allowed to accept requests from %s",
|
||||
$sessionIp, join(",",@{$subnets})
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use WebGUI::User;
|
|||
use WebGUI::Utility;
|
||||
use JSON;
|
||||
use XML::Simple;
|
||||
use Net::CIDR::Lite;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -141,7 +142,7 @@ sub canUseService {
|
|||
my ( $session ) = @_;
|
||||
my $subnets = $session->config->get('serviceSubnets');
|
||||
return 1 if !$subnets || !@{$subnets};
|
||||
return 1 if WebGUI::Utility::isInSubnet( $session->request->address, $subnets );
|
||||
return 1 if Net::CIDR::Lite->new(@$subnets)->find($session->request->address);
|
||||
return 0; # Don't go away mad, just go away
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use WebGUI::Workflow::Instance;
|
|||
use WebGUI::Utility;
|
||||
use POE::Component::IKC::ClientLite;
|
||||
use JSON qw/ decode_json /;
|
||||
use Net::CIDR::Lite;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -482,7 +483,7 @@ sub www_runWorkflow {
|
|||
my $session = shift;
|
||||
$session->http->setMimeType("text/plain");
|
||||
$session->http->setCacheControl("none");
|
||||
unless (isInSubnet($session->request->address, $session->config->get("spectreSubnets")) || canRunWorkflow($session)) {
|
||||
unless (Net::CIDR::Lite->new(@{ $session->config->get('spectreSubnets')} )->find($session->request->address) || canRunWorkflow($session)) {
|
||||
$session->errorHandler->security("make a Spectre workflow runner request, but we're only allowed to accept requests from ".join(",",@{$session->config->get("spectreSubnets")}).".");
|
||||
return "error";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue