]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1312735 - allow http auth delegation callbacks based on environmental variable
authorDylan William Hardison <dylan@hardison.net>
Mon, 1 May 2017 23:27:04 +0000 (19:27 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 1 May 2017 23:27:22 +0000 (19:27 -0400)
auth.cgi
heartbeat.cgi

index 00e6b94d6411bfb5b23d0c7d5be2e901d4e09f7f..adf5d34751632de9fe83d716aed1cf4a6198d64d 100755 (executable)
--- a/auth.cgi
+++ b/auth.cgi
@@ -43,8 +43,14 @@ ThrowUserError("auth_delegation_invalid_description")
   unless $description =~ /^[\w\s]{3,255}$/;
 
 my $callback_uri  = URI->new($callback);
+
+my $legal_protocol
+    = $ENV{BUGZILLA_UNSAFE_AUTH_DELEGATION}
+    ? qr/^https?$/i # http or https
+    : qr/^https$/i; # https only
+
 ThrowUserError('auth_delegation_illegal_protocol', { protocol => scalar $callback_uri->scheme })
-    unless $callback_uri->scheme eq 'https';
+    unless $callback_uri->scheme =~ $legal_protocol;
 my $callback_base = $callback_uri->clone;
 $callback_base->query(undef);
 
index 47f3d59a2fb66cb4f59c436854b9ed339fbef27e..e26dfe6bafb888a62a9cf486277586b275bc14f8 100644 (file)
@@ -29,6 +29,7 @@ my $ok = eval {
     die "database not available"            unless $database_ok;
     die "memcached server(s) not available" unless $memcached_ok;
     die "mod_perl not configured?"          unless $ENV{MOD_PERL};
+    die "BUGZILLA_UNSAFE_AUTH_DELEGATION"   if $ENV{BUGZILLA_UNSAFE_AUTH_DELEGATION};
     1;
 };
 warn "heartbeat error: $@" if !$ok && $@;