]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1403777 - Migrate urlbase from params to localconfig
authorDylan William Hardison <dylan@hardison.net>
Sat, 16 Dec 2017 19:17:05 +0000 (13:17 -0600)
committerGitHub <noreply@github.com>
Sat, 16 Dec 2017 19:17:05 +0000 (13:17 -0600)
69 files changed:
.circleci/checksetup_answers.legacy.txt
.circleci/config.yml
.htaccess
.perlcriticrc
Bugzilla.pm
Bugzilla/Auth/Login/CGI.pm
Bugzilla/BugUrl/Bugzilla/Local.pm
Bugzilla/CGI.pm
Bugzilla/Config/Advanced.pm
Bugzilla/Config/Attachment.pm
Bugzilla/Config/Common.pm
Bugzilla/Config/Core.pm [deleted file]
Bugzilla/Install/Filesystem.pm
Bugzilla/Install/Localconfig.pm
Bugzilla/Mailer.pm
Bugzilla/Search/Quicksearch.pm
Bugzilla/Template.pm
Bugzilla/Util.pm
Bugzilla/WebService/Server/JSONRPC.pm
Bugzilla/WebService/Server/REST.pm
README.rst
attachment.cgi
chart.cgi
checksetup.pl
docs/en/rst/administering/parameters.rst
editparams.cgi
extensions/BMO/Extension.pm
extensions/BMO/lib/Reports/ReleaseTracking.pm
extensions/Bitly/lib/WebService.pm
extensions/BugModal/lib/ActivityStream.pm
extensions/BzAPI/lib/Resources/Bugzilla.pm
extensions/BzAPI/lib/Util.pm
extensions/GitHubAuth/lib/Client.pm
extensions/GitHubAuth/lib/Login.pm
extensions/InlineHistory/Extension.pm
extensions/Persona/lib/Login.pm
extensions/PhabBugz/lib/WebService.pm
extensions/Push/lib/Connector.disabled/AMQP.pm
extensions/Push/lib/Connector.disabled/ServiceNow.pm
extensions/Push/lib/Connector/Spark.pm
extensions/SecureMail/Extension.pm
extensions/SiteMapIndex/Extension.pm
extensions/SiteMapIndex/lib/Util.pm
extensions/Splinter/lib/Util.pm
github.cgi
httpd/httpd.conf
importxml.pl
index.cgi
new_bug.cgi
post_bug.cgi
qa/config/checksetup_answers.txt
qa/config/generate_test_data.pl
qa/t/lib/QA/Util.pm
qa/t/test_security.t
qa/t/test_shutdown.t
relogin.cgi
robots.cgi [new file with mode: 0755]
scripts/addcustomfield.pl
scripts/entrypoint.pl
showdependencygraph.cgi
t/.perlcritic-history
template/en/default/admin/params/advanced.html.tmpl
template/en/default/admin/params/attachment.html.tmpl
template/en/default/admin/params/core.html.tmpl [deleted file]
template/en/default/global/header.html.tmpl
template/en/default/robots.txt.tmpl
template/en/default/setup/strings.txt.pl
template/en/default/welcome-admin.html.tmpl
userprefs.cgi

index 11d8c913184d26d436c7674e43e0950d3771e786..759ee081af3d58acef41371c3e889081a7f6e254 100644 (file)
@@ -8,4 +8,3 @@ $answer{'create_htaccess'} = '';
 $answer{'cvsbin'} = '/usr/bin/cvs';
 $answer{'diffpath'} = '/usr/bin';
 $answer{'interdiffbin'} = '/usr/bin/interdiff';
-$answer{'urlbase'} = 'http://<<HOSTNAME>>:8000/bmo/';
index 0b2071a3787b4b2d8f14043c2154b424ffb25318..54f5381d53a50745f141d5057dc5dc461ee2a465 100644 (file)
@@ -31,6 +31,13 @@ defaults:
     BMO_db_name: bugs
     BMO_memcached_servers: localhost:11211
     BMO_memcached_namespace: "bugzilla:"
+    BMO_urlbase: AUTOMATIC
+    HTTPD_StartServers: 1
+    HTTPD_MinSpareServers: 1
+    HTTPD_MaxSpareServers: 1
+    HTTPD_ServerLimit: 1
+    HTTPD_MaxClients: 1
+    HTTPD_MaxRequestsPerChild: 4000
 
   mysql_env: &mysql_env
     MYSQL_DATABASE: bugs
@@ -52,10 +59,10 @@ defaults:
 
   default_qa_setup: &default_qa_setup
     run:
+      name: default qa setup
       command: |
         mv /opt/bmo/local /app/local
-        perl -MSys::Hostname -i -pE 's/bmo.test/hostname().":8000"/ges' $BZ_QA_CONF_FILE
-        perl -MSys::Hostname -i -pE 's/bmo.test/hostname().":8000"/ges' $BZ_QA_ANSWERS_FILE
+        perl -MSys::Hostname -i -pE 's/bmo.test/hostname() . ":$ENV{PORT}"/ges' $BZ_QA_CONF_FILE
         perl checksetup.pl --no-database --default-localconfig
         mkdir artifacts
 
@@ -78,7 +85,6 @@ jobs:
             -t bmo .
       - deploy:
           command: |
-            docker build -t bmo .
             if [[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]]; then
                 TAG="${CIRCLE_TAG:-$CIRCLE_BRANCH}"
                 if [[ $TAG == "master" ]]; then
@@ -159,13 +165,9 @@ jobs:
       - run: |
           mv /opt/bmo/local /app/local
           perl checksetup.pl --no-database
-          perl -MSys::Hostname -i -pE 's/bmo.test/hostname().":8000"/ges' $BZ_QA_ANSWERS_FILE
           /app/scripts/entrypoint.pl load_test_data
           mkdir artifacts
-      - run: |
-          BZ_BASE_URL="http://$(hostname):$PORT"
-          export BZ_BASE_URL
-          /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t
+      - run: /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t
       - store_artifacts:
           path: /app/logs
 
@@ -192,4 +194,4 @@ workflows:
           requires:
             - test_sanity
             - test_bmo
-            - test_webservices
\ No newline at end of file
+            - test_webservices
index 98614c4222bfeaf0429368405d98f7198b7b5bdc..06d3ac26863af732da950062f4024e29a8434cd9 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -52,6 +52,8 @@ RewriteRule ^__version__$ version.json [L]
 # heartbeat.cgi returns 200 if the DB and memcached are both working, and 500 otherwise.
 RewriteRule ^__heartbeat__$ heartbeat.cgi [L]
 
+RewriteRule ^robots\.txt$ robots.cgi [L]
+
 # New single page interface for filing bugs
 RewriteRule ^new[-_]bug$ new_bug.cgi [L,QSA]
 
index 14b2d7cab470655efb07bbb8399b9b46ab643062..15ff6c82b54f6ef3fac74545c91b5d2582fdd880 100644 (file)
@@ -5,7 +5,7 @@ severity = 1
 #perltidyrc = .perltidyrc
 [InputOutput::RequireCheckedSyscalls]
 functions = :builtins
-exclude_functions = print say binmode
+exclude_functions = print say sleep binmode
 
 [-BuiltinFunctions::ProhibitUselessTopic]
 [-ControlStructures::ProhibitCascadingIfElse]
@@ -17,15 +17,18 @@ exclude_functions = print say binmode
 [-Modules::RequireVersionVar]
 [-References::ProhibitDoubleSigils]
 [-RegularExpressions::ProhibitComplexRegexes]
+[-RegularExpressions::RequireDotMatchAnything]
+[-RegularExpressions::RequireLineBoundaryMatching]
 [-RegularExpressions::RequireExtendedFormatting]
 [-Subroutines::ProhibitExcessComplexity]
 [-ValuesAndExpressions::ProhibitConstantPragma]
 [-ValuesAndExpressions::ProhibitEmptyQuotes]
 [-ValuesAndExpressions::ProhibitMagicNumbers]
+[-ValuesAndExpressions::ProhibitNoisyQuotes]
+[-ValuesAndExpressions::ProhibitNoisyQuotes]
 [-ValuesAndExpressions::ProhibitVersionStrings]
 [-Variables::ProhibitLocalVars]
 [-Variables::ProhibitPackageVars]
-[-ValuesAndExpressions::ProhibitNoisyQuotes]
 
 # this policy is broken currently
 [-Freenode::PackageMatchesFilename]
index e985423c55e1b2e80b2ec72af02a423b7654d033..07482c0f76f5609c79dd47f3d83e1fa48c33ed0a 100644 (file)
@@ -401,7 +401,7 @@ sub login {
             my $self_url     = trim($cgi->self_url);
             my $sig_type     = 'prev_url:' . $authenticated_user->id;
             my $self_url_sig = issue_hash_sig($sig_type, $self_url);
-            my $redir_url    = URI->new( correct_urlbase() . "reset_password.cgi" );
+            my $redir_url    = URI->new( Bugzilla->localconfig->{urlbase} . "reset_password.cgi" );
             $redir_url->query_form(prev_url => $self_url, prev_url_sig => $self_url_sig);
             print $cgi->redirect($redir_url);
             exit;
index 22a765f61b6c73edf697c708d3785b7dfacbf030..a813529d54dcb3dae8b516c5200993619b939068 100644 (file)
@@ -49,7 +49,7 @@ sub get_login_info {
     # Attachments are served from a separate host (ideally), and so
     # an evil attachment cannot abuse this check with a redirect.
     elsif (my $referer = $cgi->referer) {
-        my $urlbase = correct_urlbase();
+        my $urlbase = Bugzilla->localconfig->{urlbase};
         $valid = 1 if $referer =~ /^\Q$urlbase\E/;
     }
     # If the web browser doesn't accept cookies and the Referer header
index a5cb5d49b8729154a69ac725c93b9b60df1b843d..14d03f048db3b2e6ddd87ef4ed7e06e25f7af9a0 100644 (file)
@@ -96,7 +96,7 @@ sub _check_value {
 sub local_uri {
     my ($self, $bug_id) = @_;
     $bug_id ||= '';
-    return correct_urlbase() . "show_bug.cgi?id=$bug_id";
+    return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id";
 }
 
 1;
index ea8d96da835e58cd89d646c8f30acb39596f3acd..0f9b0cf885166d8d51bbd4efaee9f82aad770e26 100644 (file)
@@ -57,12 +57,12 @@ sub DEFAULT_CSP {
 # Because show_bug code lives in many different .cgi files,
 # we needed a centralized place to define the policy.
 # normally the policy would just live in one .cgi file.
-# Additionally, correct_urlbase() cannot be called at compile time, so this can't be a constant.
+# Additionally, Bugzilla->localconfig->{urlbase} cannot be called at compile time, so this can't be a constant.
 sub SHOW_BUG_MODAL_CSP {
     my ($bug_id) = @_;
     my %policy = (
         script_src  => ['self', 'nonce', 'unsafe-inline', 'unsafe-eval', 'https://www.google-analytics.com' ],
-        object_src  => [correct_urlbase() . "extensions/BugModal/web/ZeroClipboard/ZeroClipboard.swf"],
+        object_src  => [Bugzilla->localconfig->{urlbase} . "extensions/BugModal/web/ZeroClipboard/ZeroClipboard.swf"],
         img_src     => [ 'self', 'https://secure.gravatar.com', 'https://www.google-analytics.com' ],
         connect_src => [
             'self',
@@ -76,7 +76,7 @@ sub SHOW_BUG_MODAL_CSP {
         ],
     );
     if (use_attachbase() && $bug_id) {
-        my $attach_base = Bugzilla->params->{'attachment_base'};
+        my $attach_base = Bugzilla->localconfig->{'attachment_base'};
         $attach_base =~ s/\%bugid\%/$bug_id/g;
         push @{ $policy{img_src} }, $attach_base;
     }
@@ -141,7 +141,7 @@ sub new {
     # Send appropriate charset
     $self->charset(Bugzilla->params->{'utf8'} ? 'UTF-8' : '');
 
-    # Redirect to urlbase/sslbase if we are not viewing an attachment.
+    # Redirect to urlbase if we are not viewing an attachment.
     if ($self->url_is_attachment_base and $script ne 'attachment.cgi') {
         $self->redirect_to_urlbase();
     }
@@ -177,7 +177,7 @@ sub new {
 sub target_uri {
     my ($self) = @_;
 
-    my $base = correct_urlbase();
+    my $base = Bugzilla->localconfig->{urlbase};
     if (my $request_uri = $self->request_uri) {
         my $base_uri = URI->new($base);
         $base_uri->path('');
@@ -594,11 +594,12 @@ sub send_cookie {
     }
 
     # Add the default path and the domain in.
-    $paramhash{'-path'} = Bugzilla->params->{'cookiepath'};
-    $paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'}
-        if Bugzilla->params->{'cookiedomain'};
+    state $uri = URI->new( Bugzilla->localconfig->{urlbase} );
+    $paramhash{'-path'}   = $uri->path;
+    # we don't set the domain.
     $paramhash{'-secure'} = 1
-        if Bugzilla->params->{'ssl_redirect'};
+      if lc( $uri->scheme ) eq 'https';
+
 
     # Move the param list back into an array for the call to cookie().
     foreach (keys(%paramhash)) {
@@ -683,14 +684,15 @@ sub redirect_search_url {
 
 sub redirect_to_https {
     my $self = shift;
-    my $sslbase = Bugzilla->params->{'sslbase'};
+    my $urlbase = Bugzilla->localconfig->{'urlbase'};
+
     # If this is a POST, we don't want ?POSTDATA in the query string.
     # We expect the client to re-POST, which may be a violation of
     # the HTTP spec, but the only time we're expecting it often is
     # in the WebService, and WebService clients usually handle this
     # correctly.
     $self->delete('POSTDATA');
-    my $url = $sslbase . $self->url('-path_info' => 1, '-query' => 1,
+    my $url = $urlbase . $self->url('-path_info' => 1, '-query' => 1,
                                     '-relative' => 1);
 
     # XML-RPC clients (SOAP::Lite at least) require a 301 to redirect properly
@@ -707,14 +709,14 @@ sub redirect_to_https {
 sub redirect_to_urlbase {
     my $self = shift;
     my $path = $self->url('-path_info' => 1, '-query' => 1, '-relative' => 1);
-    print $self->redirect('-location' => correct_urlbase() . $path);
+    print $self->redirect('-location' => Bugzilla->localconfig->{urlbase} . $path);
     exit;
 }
 
 sub url_is_attachment_base {
     my ($self, $id) = @_;
     return 0 if !use_attachbase() or !i_am_cgi();
-    my $attach_base = Bugzilla->params->{'attachment_base'};
+    my $attach_base = Bugzilla->localconfig->{'attachment_base'};
     # If we're passed an id, we only want one specific attachment base
     # for a particular bug. If we're not passed an ID, we just want to
     # know if our current URL matches the attachment_base *pattern*.
@@ -860,9 +862,6 @@ As its only argument, it takes the name of the cookie to expire.
 
 =item C<redirect_to_https>
 
-This routine redirects the client to the https version of the page that
-they're looking at, using the C<sslbase> parameter for the redirection.
-
 Generally you should use L<Bugzilla::Util/do_ssl_redirect_if_required>
 instead of calling this directly.
 
index d7fdd34aacf42884d54b6393430880316a7bad7a..dc5be490fa66328d3e78d5cdc5a0a5e4b97c384d 100644 (file)
@@ -16,12 +16,6 @@ use Bugzilla::Config::Common;
 our $sortkey = 1700;
 
 use constant get_param_list => (
-    {
-        name    => 'cookiedomain',
-        type    => 't',
-        default => ''
-    },
-
     {
         name    => 'inbound_proxies',
         type    => 't',
index bc2f4502992a9270bcd27aa5fa4e94d474dddfc0..c3dbd03ed9229957293ad2b354b0b89d82b4b35b 100644 (file)
@@ -23,12 +23,6 @@ sub get_param_list {
             type    => 'b',
             default => 0
         },
-        {
-            name    => 'attachment_base',
-            type    => 't',
-            default => '',
-            checker => \&check_urlbase
-        },
         {
             name    => 'allow_attachment_deletion',
             type    => 'b',
@@ -68,7 +62,7 @@ sub get_param_list {
 
 sub check_params {
     my ( $class, $params ) = @_;
-    return unless $params->{attachment_storage} eq 's3';
+    return '' unless $params->{attachment_storage} eq 's3';
 
     if (   $params->{s3_bucket} eq ''
         || $params->{aws_access_key_id} eq ''
index 8b1a9da911c34acba3401e63bcc4e90fe33e1477..fabf7c880ee52d0c426496062c7d9528bd2ed77a 100644 (file)
@@ -23,7 +23,7 @@ use Bugzilla::Status;
 use base qw(Exporter);
 @Bugzilla::Config::Common::EXPORT = qw(
     check_multi check_numeric check_regexp check_url check_group
-    check_sslbase check_priority check_severity check_platform
+    check_priority check_severity check_platform
     check_opsys check_shadowdb check_urlbase check_webdotbase
     check_user_verify_class
     check_mail_delivery_method check_notification check_utf8
@@ -81,32 +81,6 @@ sub check_email {
     return "";
 }
 
-sub check_sslbase {
-    my $url = shift;
-    if ( $url ne '' ) {
-        if ( $url !~ m#^https://([^/]+).*/$# ) {
-            return "must be a legal URL, that starts with https and ends with a slash.";
-        }
-        my $host = $1;
-
-        # Fall back to port 443 if for some reason getservbyname() fails.
-        my $port = getservbyname( 'https', 'tcp' ) || 443;
-        if ( $host =~ /^(.+):(\d+)$/ ) {
-            $host = $1;
-            $port = $2;
-        }
-        local *SOCK;
-        my $proto = getprotobyname('tcp');
-        socket( SOCK, PF_INET, SOCK_STREAM, $proto );
-        my $iaddr = inet_aton($host) || return "The host $host cannot be resolved";
-        my $sin = sockaddr_in( $port, $iaddr );
-        if ( !connect( SOCK, $sin ) ) {
-            return "Failed to connect to $host:$port; unable to enable SSL";
-        }
-        close(SOCK);
-    }
-    return "";
-}
 
 sub check_utf8 {
     my $utf8 = shift;
diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm
deleted file mode 100644 (file)
index b3848a1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-package Bugzilla::Config::Core;
-
-use 5.10.1;
-use strict;
-use warnings;
-
-use Bugzilla::Config::Common;
-
-our $sortkey = 100;
-
-use constant get_param_list => (
-    {
-        name    => 'urlbase',
-        type    => 't',
-        default => '',
-        checker => \&check_urlbase
-    },
-
-    {
-        name    => 'ssl_redirect',
-        type    => 'b',
-        default => 0
-    },
-
-    {
-        name    => 'sslbase',
-        type    => 't',
-        default => '',
-        checker => \&check_sslbase
-    },
-
-    {
-        name    => 'cookiepath',
-        type    => 't',
-        default => '/'
-    },
-);
-
-1;
index bb87e499e6e536bbcb938973213fb040818ecec3..01b8d7e8e7bbe9a8046d7ceb1475098b03b043e2 100644 (file)
@@ -416,9 +416,6 @@ sub FILESYSTEM {
         "skins/yui3.css"          => { perms     => CGI_READ,
                                        overwrite => 1,
                                        contents  => $yui3_all_css },
-        "robots.txt"              => { perms     => CGI_READ,
-                                       overwrite => 1,
-                                       contents  => \&robots_txt},
         "httpd/env.conf"          => { perms     => CGI_READ,
                                        overwrite => 1,
                                        contents  => \&HTTPD_ENV_CONF },
@@ -969,15 +966,6 @@ sub _check_web_server_group {
     return $group_id;
 }
 
-sub robots_txt {
-    my $output = '';
-    my %vars;
-    Bugzilla::Hook::process("before_robots_txt", { vars => \%vars });
-    Bugzilla->template->process("robots.txt.tmpl", \%vars, \$output)
-    or die Bugzilla->template->error;
-    return $output;
-}
-
 
 1;
 
index c1c8fb12e311b942f14bdfa6d9d23f8f62298415..f877829c518f5ca8c4358272d80e1990a2fdaef0 100644 (file)
@@ -31,6 +31,7 @@ use Tie::Hash::NamedCapture;
 use Safe;
 use Term::ANSIColor;
 use Taint::Util qw(untaint);
+use Sys::Hostname qw(hostname);
 
 use parent qw(Exporter);
 
@@ -122,10 +123,11 @@ use constant LOCALCONFIG_VARS => (
     },
     {
         name    => 'diffpath',
-        default => sub { dirname(bin_loc('diff')) },
+        default => sub { dirname( bin_loc('diff') ) },
     },
     {
-        name    => 'site_wide_secret',
+        name => 'site_wide_secret',
+
         # 64 characters is roughly the equivalent of a 384-bit key, which
         # is larger than anybody would ever be able to brute-force.
         default => sub { generate_random_password(64) },
@@ -148,14 +150,23 @@ use constant LOCALCONFIG_VARS => (
     },
     {
         name    => 'memcached_servers',
-        default =>  _migrate_param("memcached_servers", ""),
+        default => _migrate_param( "memcached_servers", "" ),
     },
     {
         name    => 'memcached_namespace',
-        default => _migrate_param("memcached_namespace", "bugzilla:"),
+        default => _migrate_param( "memcached_namespace", "bugzilla:" ),
+    },
+    {
+        name    => 'urlbase',
+        default => _migrate_param( "urlbase", "" ),
     },
+    {
+        name    => 'attachment_base',
+        default => _migrate_param( "attachment_base", '' ),
+    }
 );
 
+
 use constant ENV_KEYS => (
     (map { ENV_PREFIX . $_->{name} } LOCALCONFIG_VARS),
     (map { ENV_PREFIX . $_ } PARAM_OVERRIDE),
index 768f686070c1ae62ff8165571634ccffee934248..6e46d18629421d8aa4631e0535cfb605888c43f9 100644 (file)
@@ -104,10 +104,7 @@ sub MessageToMTA {
     # We add this header to uniquely identify all email that we
     # send as coming from this Bugzilla installation.
     #
-    # We don't use correct_urlbase, because we want this URL to
-    # *always* be the same for this Bugzilla, in every email,
-    # even if the admin changes the "ssl_redirect" parameter some day.
-    $email->header_set('X-Bugzilla-URL', Bugzilla->params->{'urlbase'});
+    $email->header_set('X-Bugzilla-URL', Bugzilla->localconfig->{urlbase});
 
     # We add this header to mark the mail as "auto-generated" and
     # thus to hopefully avoid auto replies.
@@ -156,7 +153,7 @@ sub MessageToMTA {
     else {
         # Sendmail will automatically append our hostname to the From
         # address, but other mailers won't.
-        my $urlbase = Bugzilla->params->{'urlbase'};
+        my $urlbase = Bugzilla->localconfig->{urlbase};
         $urlbase =~ m|//([^:/]+)[:/]?|;
         $hostname = $1;
         $from .= "\@$hostname" if $from !~ /@/;
@@ -248,7 +245,7 @@ sub build_thread_marker {
         $user_id = Bugzilla->user->id;
     }
 
-    my $sitespec = '@' . Bugzilla->params->{'urlbase'};
+    my $sitespec = '@' . Bugzilla->localconfig->{urlbase};
     $sitespec =~ s/:\/\//\./; # Make the protocol look like part of the domain
     $sitespec =~ s/^([^:\/]+):(\d+)/$1/; # Remove a port number, to relocate
     if ($2) {
index b28829c3a2e069c6987b829d9e9bbb8989ee86d3..6897d22194ab4cbd031e2ad935d1a55398363ea7 100644 (file)
@@ -266,7 +266,7 @@ sub quicksearch {
     my $modified_query_string = $cgi->canonicalise_query(@params_to_strip);
 
     if ($cgi->param('load')) {
-        my $urlbase = correct_urlbase();
+        my $urlbase = Bugzilla->localconfig->{urlbase};
         # Param 'load' asks us to display the query in the advanced search form.
         print $cgi->redirect(-uri => "${urlbase}query.cgi?format=advanced&amp;"
                              . $modified_query_string);
@@ -315,7 +315,7 @@ sub _bug_numbers_only {
     if ($searchstring !~ /,/ && !i_am_webservice()) {
         # Single bug number; shortcut to show_bug.cgi.
         print $cgi->redirect(
-            -uri => correct_urlbase() . "show_bug.cgi?id=$searchstring");
+            -uri => Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$searchstring");
         exit;
     }
     else {
@@ -338,7 +338,7 @@ sub _handle_alias {
         if ($bug_id && Bugzilla->user->can_see_bug($bug_id) && !i_am_webservice()) {
             $alias = url_quote($alias);
             print Bugzilla->cgi->redirect(
-                -uri => correct_urlbase() . "show_bug.cgi?id=$alias");
+                -uri => Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$alias");
             exit;
         }
     }
index 49b7e943529b07be702267e81b1d86e2127fc680..206f2f3cb5747f67555e8e9ea06027623b28a177 100644 (file)
@@ -191,9 +191,7 @@ sub quoteUrls {
     }
 
     # Provide tooltips for full bug links (Bug 74355)
-    my $urlbase_re = '(' . join('|',
-        map { qr/$_/ } grep($_, Bugzilla->params->{'urlbase'},
-                            Bugzilla->params->{'sslbase'})) . ')';
+    my $urlbase_re = quotemeta(Bugzilla->localconfig->{urlbase});
     $text =~ s~\b(${urlbase_re}\Qshow_bug.cgi?id=\E([0-9]+)(\#c([0-9]+))?)\b
               ~($things[$count++] = $bug_link_func->($3, $1, { comment_num => $5, user => $user })) &&
                ("\x{FDD2}" . ($count-1) . "\x{FDD3}")
@@ -1036,7 +1034,7 @@ sub create {
             'sudoer' => sub { return Bugzilla->sudoer; },
 
             # Allow templates to access the "corect" URLBase value
-            'urlbase' => sub { return Bugzilla::Util::correct_urlbase(); },
+            'urlbase' => sub { return Bugzilla->localconfig->{urlbase}; },
 
             # Allow templates to access docs url with users' preferred language
             'docs_urlbase' => sub {
index df2f788234d14504ded5b8f5ae6f0d579ba4001a..c23e738e66dbb24ae7f942be4ff55a467aa44b54 100644 (file)
@@ -259,34 +259,14 @@ sub i_am_webservice {
 # (doing so can mess up XML-RPC).
 sub do_ssl_redirect_if_required {
     return if !i_am_cgi();
-    return if !Bugzilla->params->{'ssl_redirect'};
-
-    my $sslbase = Bugzilla->params->{'sslbase'};
+    my $uri = URI->new(Bugzilla->localconfig->{'urlbase'});
+    return if $uri->scheme ne 'https';
 
     # If we're already running under SSL, never redirect.
-    return if uc($ENV{HTTPS} || '') eq 'ON';
-    # Never redirect if there isn't an sslbase.
-    return if !$sslbase;
+    return if $ENV{HTTPS} && $ENV{HTTPS} eq 'on';
     Bugzilla->cgi->redirect_to_https();
 }
 
-sub correct_urlbase {
-    my $ssl = Bugzilla->params->{'ssl_redirect'};
-    my $urlbase = Bugzilla->params->{'urlbase'};
-    my $sslbase = Bugzilla->params->{'sslbase'};
-
-    if (!$sslbase) {
-        return $urlbase;
-    }
-    elsif ($ssl) {
-        return $sslbase;
-    }
-    else {
-        # Return what the user currently uses.
-        return (uc($ENV{HTTPS} || '') eq 'ON') ? $sslbase : $urlbase;
-    }
-}
-
 # Returns the real remote address of the client,
 sub remote_ip {
     my $remote_ip       = $ENV{'REMOTE_ADDR'} || '127.0.0.1';
@@ -383,10 +363,9 @@ sub is_ipv6 {
 }
 
 sub use_attachbase {
-    my $attachbase = Bugzilla->params->{'attachment_base'};
-    return ($attachbase ne ''
-            && $attachbase ne Bugzilla->params->{'urlbase'}
-            && $attachbase ne Bugzilla->params->{'sslbase'}) ? 1 : 0;
+    my $attachbase = Bugzilla->localconfig->{'attachment_base'};
+    my $urlbase    = Bugzilla->localconfig->{'urlbase'};
+    return ($attachbase ne '' && $attachbase ne $urlbase);
 }
 
 sub diff_arrays {
@@ -932,7 +911,7 @@ Bugzilla::Util - Generic utility functions for bugzilla
   # Functions that tell you about your environment
   my $is_cgi   = i_am_cgi();
   my $is_webservice = i_am_webservice();
-  my $urlbase  = correct_urlbase();
+  my $urlbase  = Bugzilla->localconfig->{urlbase};
 
   # Data manipulation
   ($removed, $added) = diff_arrays(\@old, \@new);
@@ -1066,11 +1045,6 @@ in a command-line script.
 Tells you whether or not the current usage mode is WebServices related
 such as JSONRPC or XMLRPC.
 
-=item C<correct_urlbase()>
-
-Returns either the C<sslbase> or C<urlbase> parameter, depending on the
-current setting for the C<ssl_redirect> parameter.
-
 =item C<remote_ip()>
 
 Returns the IP address of the remote client. If Bugzilla is behind
index 0bd7b4648b563d6ef462898d003e2a063f711c87..0931670487557720c91fb9f152b199dd0a636136 100644 (file)
@@ -149,7 +149,7 @@ sub retrieve_json_from_get {
     # order to throw proper errors. We use the installation's urlbase as
     # the id, in this case.
     else {
-        $id = correct_urlbase();
+        $id = Bugzilla->localconfig->{urlbase};
     }
     # Setting _bz_request_id here is required in case we throw errors early,
     # before _handle.
index 6e1944061d16cc5d8495baaa57f123d9c3f9e098..6fb86fdd41180b33d3fcccead9050bbc64e09518 100644 (file)
@@ -17,7 +17,7 @@ use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Hook;
-use Bugzilla::Util qw(correct_urlbase html_quote disable_utf8 enable_utf8);
+use Bugzilla::Util qw(html_quote disable_utf8 enable_utf8);
 use Bugzilla::WebService::Constants;
 use Bugzilla::WebService::Util qw(taint_data fix_credentials);
 
@@ -94,7 +94,7 @@ sub handle {
     # also set up the correct handler method
     my $obj = {
         version => '1.1',
-        id      => correct_urlbase(),
+        id      => Bugzilla->localconfig->{urlbase},
         method  => $self->bz_method_name,
         params  => $params
     };
index 86e4dd414fe11f739e18a4af9cdd032e592c8d49..ccbd5132507b7adf5c17db2a29436dd2e2490602 100644 (file)
@@ -176,6 +176,29 @@ PORT
 BUGZILLA_UNSAFE_AUTH_DELEGATION
   This should never be set in production. It allows auth delegation over http.
 
+BMO_urlbase
+  The public url for this instance. Note that if this begins with https://
+  abd BMO_inbound_proxies is set to '*' Bugzilla will believe the connection to it
+  is using SSL.
+
+BMO_attachment_base
+  This is the url for attachments.
+  When the allow_attachment_display parameter is on, it is possible for a
+  malicious attachment to steal your cookies or perform an attack on Bugzilla
+  using your credentials.
+
+  If you would like additional security on attachments to avoid this, set this
+  parameter to an alternate URL for your Bugzilla that is not the same as
+  urlbase or sslbase. That is, a different domain name that resolves to this
+  exact same Bugzilla installation.
+
+  For added security, you can insert %bugid% into the URL, which will be
+  replaced with the ID of the current bug that the attachment is on, when you
+  access an attachment. This will limit attachments to accessing only other
+  attachments on the same bug. Remember, though, that all those possible domain
+  names (such as 1234.your.domain.com) must point to this same Bugzilla
+  instance.
+
 BMO_db_driver
   What SQL database to use. Default is mysql. List of supported databases can be
   obtained by listing Bugzilla/DB directory - every module corresponds to one
index 432ce8914e034e379507178d7502d35630a8cdaa..d1523d2484d8e43fa763de210c2b79bb632d1fbb 100755 (executable)
@@ -61,7 +61,7 @@ if (Bugzilla->params->{disable_bug_updates} && $cgi->request_method eq 'POST') {
         'Bug updates are currently disabled.');
 }
 
-# You must use the appropriate urlbase/sslbase param when doing anything
+# You must use the appropriate urlbase param when doing anything
 # but viewing an attachment, or a raw diff.
 if ($action ne 'view'
     && (($action !~ /^(?:interdiff|diff)$/) || $format ne 'raw'))
@@ -267,7 +267,7 @@ sub get_attachment {
                 }
                 unless ($userid && $valid_token) {
                     # Not a valid token.
-                    print $cgi->redirect('-location' => correct_urlbase() . $path);
+                    print $cgi->redirect('-location' => Bugzilla->localconfig->{urlbase} . $path);
                     exit;
                 }
                 # Change current user without creating cookies.
@@ -287,7 +287,7 @@ sub get_attachment {
             # make sure we were not going to request credentials on the
             # alternate host.
             Bugzilla->login();
-            my $attachbase = Bugzilla->params->{'attachment_base'};
+            my $attachbase = Bugzilla->localconfig->{'attachment_base'};
             # Replace %bugid% by the ID of the bug the attachment
             # belongs to, if present.
             $attachbase =~ s/\%bugid\%/$bug_id/;
@@ -377,7 +377,7 @@ sub view {
     Bugzilla::Hook::process('attachment_should_redirect_login', { do_redirect => \$do_redirect });
 
     if ($do_redirect) {
-        my $uri = URI->new(correct_urlbase() . 'attachment.cgi');
+        my $uri = URI->new(Bugzilla->localconfig->{urlbase} . 'attachment.cgi');
         $uri->query_param(id => $attachment->id);
         $uri->query_param(content_type => $contenttype) if $contenttype_override;
 
index ea07a3adeadc8cd74e6cf9b3878d5d56038cfac5..26f21c389b283f92a6fce113b6a06fe5ff10c76c 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -215,7 +215,7 @@ elsif ($action eq "convert_search") {
         $url = $params->canonicalise_query('format', 'query_format');
         $url = '&amp;' . html_quote($url);
     }
-    print $cgi->redirect(-location => correct_urlbase() . "query.cgi?format=create-series$url");
+    print $cgi->redirect(-location => Bugzilla->localconfig->{urlbase} . "query.cgi?format=create-series$url");
 }
 else {
     ThrowUserError('unknown_action', {action => $action});
index cd973f5c7ad1483e1fe84a784e0d31b1b5ffeeaf..6cea8549d25955d69b97ccc4069e0215b9910a4d 100755 (executable)
@@ -155,6 +155,14 @@ unless ($ENV{LOCALCONFIG_ENV}) {
 }
 my $lc_hash = Bugzilla->localconfig;
 
+unless ($switch{'no-database'}) {
+    die "urlbase is not set\n" unless $lc_hash->{urlbase};
+    die "urlbase must end with slash\n" unless $lc_hash->{urlbase} =~ m{/$}ms;
+    if ($lc_hash->{attachment_base}) {
+        die "attachment_base must end with slash\n" unless $lc_hash->{attachment_base} =~ m{/$}ms;
+    }
+}
+
 ###########################################################################
 # Check --DATABASE-- setup
 ###########################################################################
@@ -279,12 +287,6 @@ unless ($switch{'no-database'}) {
     # Reset the mod_perl pre-load list
     unlink(Bugzilla::Constants::bz_locations()->{datadir} . '/mod_perl_preload');
 
-    # Check if the default parameter for urlbase is still set, and if so, give
-    # notification that they should go and visit editparams.cgi
-    if (Bugzilla->params->{'urlbase'} eq '') {
-        print "\n" . get_text('install_urlbase_default') . "\n"
-            unless $silent;
-    }
     if (!$silent) {
         success(get_text('install_success'));
     }
index 75974d38831d59d09152756e9bdd09e51adfc363..338df3eb3de915bc07ca4d8394ed5574e3229360 100644 (file)
@@ -10,47 +10,6 @@ accessed via the menu on the left.
 
 .. _param-required-settings:
 
-Required Settings
-=================
-
-The core required parameters for any Bugzilla installation are set
-here. :param:`urlbase` is always required; the other parameters should be
-set, or it must be explicitly decided not to
-set them, before the new Bugzilla installation starts to be used.
-
-urlbase
-    Defines the fully qualified domain name and web
-    server path to this Bugzilla installation.
-    For example, if the Bugzilla query page is
-    :file:`http://www.foo.com/bugzilla/query.cgi`,
-    the :param:`urlbase` should be set
-    to :paramval:`http://www.foo.com/bugzilla/`.
-
-ssl_redirect
-    If enabled, Bugzilla will force HTTPS (SSL) connections, by
-    automatically redirecting any users who try to use a non-SSL
-    connection. Also, when this is enabled, Bugzilla will send out links
-    using :param:`sslbase` in emails instead of :param:`urlbase`.
-
-sslbase
-    Defines the fully qualified domain name and web
-    server path for HTTPS (SSL) connections to this Bugzilla installation.
-    For example, if the Bugzilla main page is
-    :file:`https://www.foo.com/bugzilla/index.cgi`,
-    the :param:`sslbase` should be set
-    to :paramval:`https://www.foo.com/bugzilla/`.
-
-cookiepath
-    Defines a path, relative to the web document root, that Bugzilla
-    cookies will be restricted to. For example, if the
-    :param:`urlbase` is set to
-    :file:`http://www.foo.com/bugzilla/`, the
-    :param:`cookiepath` should be set to
-    :paramval:`/bugzilla/`. Setting it to :paramval:`/` will allow all sites
-    served by this web server or virtual host to read Bugzilla cookies.
-
-.. _param-general:
-
 General
 =======
 
@@ -197,16 +156,7 @@ and whether to allow pointing to external files via a URI.
 allow_attachment_display
     If this option is on, users will be able to view attachments from their browser, if their browser supports the attachment's MIME type. If this option is off, users are forced to download attachments, even if the browser is able to display them.
 
-    If you do not trust your users (e.g. if your Bugzilla is public), you should either leave this option off, or configure and set the :param:`attachment_base` parameter (see below). Untrusted users may upload attachments that could be potentially damaging if viewed directly in the browser.
-
-attachment_base
-    When the :param:`allow_attachment_display` parameter is on, it is possible for a malicious attachment to steal your cookies or perform an attack on Bugzilla using your credentials.
-
-    If you would like additional security on attachments to avoid this, set this parameter to an alternate URL for your Bugzilla that is not the same as :param:`urlbase` or :param:`sslbase`. That is, a different domain name that resolves to this exact same Bugzilla installation.
-
-    Note that if you have set the :param:`cookiedomain` parameter, you should set :param:`attachment_base` to use a domain that would not be matched by :param:`cookiedomain`.
-
-    For added security, you can insert ``%bugid%`` into the URL, which will be replaced with the ID of the current bug that the attachment is on, when you access an attachment. This will limit attachments to accessing only other attachments on the same bug. Remember, though, that all those possible domain names (such as 1234.your.domain.com) must point to this same Bugzilla instance. To set this up you need to investigate wildcard DNS.
+    If you do not trust your users (e.g. if your Bugzilla is public), you should either leave this option off, or configure and set the attachment_base localconfig variable. Untrusted users may upload attachments that could be potentially damaging if viewed directly in the browser.
 
 allow_attachment_deletion
     If this option is on, administrators will be able to delete the contents
@@ -747,15 +697,6 @@ confirmuniqueusermatch
 Advanced
 ========
 
-cookiedomain
-    Defines the domain for Bugzilla cookies. This is typically left blank.
-    If there are multiple hostnames that point to the same webserver, which
-    require the same cookie, then this parameter can be utilized. For
-    example, If your website is at
-    ``https://bugzilla.example.com/``, setting this to
-    :paramval:`.example.com/` will also allow
-    ``attachments.example.com/`` to access Bugzilla cookies.
-
 inbound_proxies
     When inbound traffic to Bugzilla goes through a proxy, Bugzilla thinks that the IP address of the proxy is the IP address of every single user. If you enter a comma-separated list of IPs in this parameter, then Bugzilla will trust any ``X-Forwarded-For`` header sent from those IPs, and use the value of that header as the end user's IP address.
 
index d3b48b93caaf0235c510b88dbc21bee57e93c8a1..ac7976d99045fb531aca1eb480662f441ad8b4ec 100755 (executable)
@@ -38,7 +38,7 @@ $user->in_group('tweakparams')
 
 my $action = trim($cgi->param('action') || '');
 my $token  = $cgi->param('token');
-my $current_panel = $cgi->param('section') || 'core';
+my $current_panel = $cgi->param('section') || 'general';
 $current_panel =~ /^([A-Za-z0-9_-]+)$/;
 $current_panel = $1;
 
index db672f82ac640b2be13fac16c7e27d97210722f1..e69d6f1e2a4e11680151970368d144a60c67ccd1 100644 (file)
@@ -1532,8 +1532,8 @@ sub field_end_of_create {
 
     # Create an IT bug so Mozilla's DBAs so they can update the grants for metrics
 
-    if (Bugzilla->params->{'urlbase'} ne 'https://bugzilla.mozilla.org/'
-        && Bugzilla->params->{'urlbase'} ne 'https://bugzilla.allizom.org/')
+    if (Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.mozilla.org/'
+        && Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.allizom.org/')
     {
         return;
     }
@@ -2544,11 +2544,6 @@ sub install_filesystem {
     my $contribute = eval {
         $json->decode(scalar read_file(bz_locations()->{cgi_path} . "/contribute.json"));
     };
-    my $commit = $ENV{CIRCLE_SHA1};
-    unless ($commit) {
-        $commit = `git rev-parse HEAD`;
-        chomp $commit;
-    }
 
     if (!$contribute) {
         die "Missing or invalid contribute.json file";
@@ -2557,8 +2552,8 @@ sub install_filesystem {
     my $version_obj = {
         source  => $contribute->{repository}{url},
         version => BUGZILLA_VERSION,
-        commit  => $commit // "unknown",
-        build   => $ENV{CIRCLE_BUILD_NUM} // "unknown",
+        commit  => $ENV{CIRCLE_SHA1}      // 'unknown',
+        build   => $ENV{CIRCLE_BUILD_NUM} // 'unknown',
     };
 
     $create_files->{'version.json'} = {
index b6c7c4520c96bfb38a308202c3c317742bf496d7..42ef24b4769357fa29b07220aa89de0056bb3447 100644 (file)
@@ -16,7 +16,7 @@ use Bugzilla::Error;
 use Bugzilla::Extension::BMO::Util;
 use Bugzilla::Field;
 use Bugzilla::FlagType;
-use Bugzilla::Util qw(correct_urlbase trick_taint validate_date);
+use Bugzilla::Util qw(trick_taint validate_date);
 use JSON qw(-convert_blessed_universally);
 use List::MoreUtils qw(uniq);
 
@@ -434,7 +434,7 @@ sub report {
         my $bugs = $dbh->selectcol_arrayref($query, undef, @params);
         push @$bugs, 0 unless @$bugs;
 
-        my $urlbase = correct_urlbase();
+        my $urlbase = Bugzilla->localconfig->{urlbase};
         my $cgi = Bugzilla->cgi;
         print $cgi->redirect(
             -url => "${urlbase}buglist.cgi?bug_id=" . join(',', @$bugs)
index b8ada56d2020d3456249a2813d274384351bffe5..4b44faa0e3593d0eab3bb3794cdc584a0044a47b 100644 (file)
@@ -18,7 +18,7 @@ use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Search;
 use Bugzilla::Search::Quicksearch;
-use Bugzilla::Util 'correct_urlbase';
+use Bugzilla::Util ();
 use Bugzilla::WebService::Util 'validate';
 use JSON;
 use LWP::UserAgent;
@@ -47,7 +47,7 @@ sub _validate_uri {
     my $uri = URI->new($url);
     $uri->query(undef);
     $uri->fragment(undef);
-    if ($uri->as_string ne correct_urlbase() . 'buglist.cgi') {
+    if ($uri->as_string ne Bugzilla->localconfig->{urlbase} . 'buglist.cgi') {
         ThrowUserError('bitly_unsupported');
     }
 
@@ -82,7 +82,7 @@ sub list {
     my $data = $search->data;
 
     # form a bug_id only url, sanity check the length
-    $uri = URI->new(correct_urlbase() . 'buglist.cgi?bug_id=' . join(',', map { $_->[0] } @$data));
+    $uri = URI->new(Bugzilla->localconfig->{urlbase} . 'buglist.cgi?bug_id=' . join(',', map { $_->[0] } @$data));
     if (length($uri->as_string) > CGI_URI_LIMIT) {
         ThrowUserError('bitly_failure', { message => "Too many bugs returned by search" });
     }
index 708c056d47207c0651babf8ea8261d9d226ea69e..098c5df3321484873c59076990be1ed2cf5542db 100644 (file)
@@ -274,7 +274,7 @@ sub _add_activities_to_stream {
 
             # split see-also
             if ($change->{fieldname} eq 'see_also') {
-                my $url_base = correct_urlbase();
+                my $url_base = Bugzilla->localconfig->{urlbase};
                 foreach my $f (qw( added removed )) {
                     my @values;
                     foreach my $value (split(/, /, $change->{$f})) {
index accbf71a701ed45362d64bd6000bdf753ce9e13b..6e350d839b36f12eb432be59fe8736a425d8d93e 100644 (file)
@@ -18,7 +18,7 @@ use Bugzilla::Keyword;
 use Bugzilla::Product;
 use Bugzilla::Status;
 use Bugzilla::Field;
-use Bugzilla::Util qw(correct_urlbase);
+use Bugzilla::Util ();
 
 use Bugzilla::Extension::BzAPI::Constants;
 
@@ -143,7 +143,7 @@ sub get_configuration {
 sub get_empty {
     my ($self) = @_;
     return {
-        ref           => $self->type('string', correct_urlbase() . "bzapi/"),
+        ref           => $self->type('string', Bugzilla->localconfig->{urlbase} . "bzapi/"),
         documentation => $self->type('string', BZAPI_DOC),
         version       => $self->type('string', BUGZILLA_VERSION)
     };
index ac5e8cbd1c6785faa2c7ba109ee4f8d60fa1ce8e..d50679a6cb132b23866984658d6a0a314695f437 100644 (file)
@@ -21,7 +21,7 @@ use Bugzilla::Bug;
 use Bugzilla::Constants;
 use Bugzilla::Extension::BzAPI::Constants;
 use Bugzilla::Token;
-use Bugzilla::Util qw(correct_urlbase email_filter);
+use Bugzilla::Util qw(email_filter);
 use Bugzilla::WebService::Util qw(filter_wants);
 
 use MIME::Base64;
@@ -44,7 +44,7 @@ our @EXPORT = qw(
 # Return an URL base appropriate for constructing a ref link
 # normally required by REST API calls.
 sub ref_urlbase {
-    return correct_urlbase() . "bzapi";
+    return Bugzilla->localconfig->{urlbase} . "bzapi";
 }
 
 # convert certain fields within a bug object
index 46c070856cde3b94844b02beab68986149d0f2b5..291501961d76917e594369bfad9d5d499fc779d3 100644 (file)
@@ -17,7 +17,7 @@ use URI::QueryParam;
 use Digest;
 
 use Bugzilla::Extension::GitHubAuth::Client::Error qw(ThrowUserError ThrowCodeError);
-use Bugzilla::Util qw(remote_ip correct_urlbase);
+use Bugzilla::Util qw(remote_ip);
 
 use constant DIGEST_HASH => 'SHA1';
 
@@ -39,7 +39,7 @@ sub new {
 sub login_uri {
     my ($class, $target_uri) = @_;
 
-    my $uri = URI->new(correct_urlbase() . "github.cgi");
+    my $uri = URI->new(Bugzilla->localconfig->{urlbase} . "github.cgi");
     $uri->query_form(target_uri => $target_uri);
     return $uri;
 }
@@ -52,7 +52,7 @@ sub authorize_uri {
         client_id    => Bugzilla->params->{github_client_id},
         scope        => 'user:email',
         state        => $state,
-        redirect_uri => correct_urlbase() . "github.cgi",
+        redirect_uri => Bugzilla->localconfig->{urlbase} . "github.cgi",
     );
 
     return $uri;
index 3f81467d0a05b4ff4e917a4113b6ec4f398b4ba2..073fbfeeabbc89ac0c686f3fffb861fbb2eea843 100644 (file)
@@ -17,7 +17,7 @@ use fields qw(github_failure);
 use Scalar::Util qw(blessed);
 
 use Bugzilla::Constants qw(AUTH_NODATA AUTH_ERROR USAGE_MODE_BROWSER);
-use Bugzilla::Util qw(trick_taint correct_urlbase generate_random_password);
+use Bugzilla::Util qw(trick_taint generate_random_password);
 use Bugzilla::Token qw(issue_short_lived_session_token set_token_extra_data);
 use List::MoreUtils qw(any);
 use Bugzilla::Extension::GitHubAuth::Client;
@@ -201,7 +201,7 @@ sub _mk_choose_email {
 
     return sub {
         my $email = shift;
-        my $uri = URI->new(correct_urlbase() . "github.cgi");
+        my $uri = URI->new(Bugzilla->localconfig->{urlbase} . "github.cgi");
         $uri->query_form( state => $state, email => $email );
         return $uri;
     };
index fb4a8f98f28111677e2a36e6ec8522b53861362c..adbfa4c74a5480094cec93dfa33ad15368612996 100644 (file)
@@ -16,7 +16,7 @@ use base qw(Bugzilla::Extension);
 use Bugzilla::User::Setting;
 use Bugzilla::Constants;
 use Bugzilla::Attachment;
-use Bugzilla::Util 'correct_urlbase';
+use Bugzilla::Util ();
 
 our $VERSION = '1.5';
 
@@ -132,7 +132,7 @@ sub template_before_process {
 
             # split see-also
             if ($change->{fieldname} eq 'see_also') {
-                my $url_base = correct_urlbase();
+                my $url_base = Bugzilla->localconfig->{urlbase};
                 foreach my $f (qw( added removed )) {
                     my @values;
                     foreach my $value (split(/, /, $change->{$f})) {
index b9ba97a7ee8f8a043a211406fa1f37eb50be19ba..9a5e3a5b724ab99d44434f387f0a4486cba558b7 100644 (file)
@@ -43,7 +43,7 @@ sub get_login_info {
     $cgi->delete('token');
     check_hash_token($token, ['login']);
 
-    my $urlbase = new URI(correct_urlbase());
+    my $urlbase = new URI(Bugzilla->localconfig->{urlbase});
     my $audience = $urlbase->scheme . "://" . $urlbase->host_port;
 
     my $ua = new LWP::UserAgent( timeout => 10 );
index 738077880435bd9eb35395050bee9301fe872f95..0ff2d46f9d7f9d53de84350072b1ff40202e2551 100644 (file)
@@ -20,7 +20,7 @@ use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Extension::Push::Util qw(is_public);
 use Bugzilla::User;
-use Bugzilla::Util qw(correct_urlbase detaint_natural);
+use Bugzilla::Util qw(detaint_natural);
 use Bugzilla::WebService::Constants;
 
 use Bugzilla::Extension::PhabBugz::Constants;
@@ -111,7 +111,7 @@ sub revision {
     return {
         result          => $result,
         attachment_id   => $attachment->id,
-        attachment_link => correct_urlbase() . "attachment.cgi?id=" . $attachment->id
+        attachment_link => Bugzilla->localconfig->{urlbase} . "attachment.cgi?id=" . $attachment->id
     };
 }
 
index f712ee89070ecacd54c9dfe550b9c6d7fde746b4..1ba365e21c6f34eb9e35aa8309676a6eed4fbfd3 100644 (file)
@@ -27,7 +27,7 @@ sub init {
     if ($self->config->{queue}) {
         $self->{queue_name} = $self->config->{queue};
     } else {
-        my $queue_name = Bugzilla->params->{'urlbase'};
+        my $queue_name = Bugzilla->localconfig->{'urlbase'};
         $queue_name =~ s#^https?://##;
         $queue_name =~ s#/$#|#;
         $queue_name .= generate_random_password(16);
index a6d84cbe018faa23df464d16146d514aa56c249c..d0ebdcf1037872cb6728d5dce577773e3f8818a1 100644 (file)
@@ -241,7 +241,7 @@ sub send {
     $request->content(to_json($data));
     $request->authorization_basic($self->config->{service_now_user}, $self->config->{service_now_pass});
 
-    $self->{lwp} ||= LWP::UserAgent->new(agent => Bugzilla->params->{urlbase});
+    $self->{lwp} ||= LWP::UserAgent->new(agent => Bugzilla->localconfig->{urlbase});
     my $result = $self->{lwp}->request($request);
 
     # http level errors
index 3194bd3abdd3fb1c11a1745659b232a91e95bdd4..e58ddfbe4eccbf0be50e9f7c8430e149880296bf 100644 (file)
@@ -18,7 +18,7 @@ use Bugzilla::Extension::Push::Constants;
 use Bugzilla::Extension::Push::Util;
 use Bugzilla::Bug;
 use Bugzilla::Attachment;
-use Bugzilla::Util qw(correct_urlbase);
+use Bugzilla::Util ();
 
 use JSON qw(decode_json encode_json);
 use LWP::UserAgent;
@@ -108,7 +108,7 @@ sub send {
                 }
             }
         }
-        $text .= correct_urlbase() . "show_bug.cgi?id=" . $bug->id;
+        $text .= Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=" . $bug->id;
 
         my $room_id = $self->config->{spark_room_id};
         my $message_uri = $self->_spark_uri('messages');
index 0219ac3ba77142f5489a809f31f3000d7644fc8b..d684b5a399361bd8de1d9f354a05cb106dbd3a66 100644 (file)
@@ -32,7 +32,7 @@ use Bugzilla::Comment;
 use Bugzilla::Group;
 use Bugzilla::Object;
 use Bugzilla::User;
-use Bugzilla::Util qw(correct_urlbase trim trick_taint is_7bit_clean);
+use Bugzilla::Util qw(trim trick_taint is_7bit_clean);
 use Bugzilla::Error;
 use Bugzilla::Mailer;
 
@@ -568,7 +568,7 @@ sub _make_secure {
         my $message;
         my $email_type = $email->header('X-Bugzilla-Type');
         my $vars = {
-          'urlbase'    => correct_urlbase(),
+          'urlbase'    => Bugzilla->localconfig->{urlbase},
           'bug_id'     => $bug_id,
           'maintainer' => Bugzilla->params->{'maintainer'},
           'email_type' => $email_type
@@ -622,7 +622,7 @@ sub _pgp_encrypt {
         Data => $encrypted,
         Object => 'MESSAGE',
         Headers => {
-            Comment => correct_urlbase() . ($bug_id ? 'show_bug.cgi?id=' . $bug_id : ''),
+            Comment => Bugzilla->localconfig->{urlbase} . ($bug_id ? 'show_bug.cgi?id=' . $bug_id : ''),
         },
     );
     # until Crypt::OpenPGP makes the Version header optional we have to strip
index a3f09348567ee4339abcf84695d2f185df6b249c..3d4342e0e8b52f38a237ed0d68ea8f5c8f23c7f2 100644 (file)
@@ -31,7 +31,7 @@ use base qw(Bugzilla::Extension);
 our $VERSION = '1.0';
 
 use Bugzilla::Constants qw(bz_locations ON_WINDOWS);
-use Bugzilla::Util qw(correct_urlbase get_text);
+use Bugzilla::Util qw(get_text);
 use Bugzilla::Install::Filesystem;
 
 use Bugzilla::Extension::SiteMapIndex::Constants;
@@ -80,7 +80,7 @@ sub page_before_template {
 
 sub install_before_final_checks {
     my ($self) = @_;
-    if (!correct_urlbase()) {
+    if (!Bugzilla->localconfig->{urlbase}) {
         print STDERR get_text('sitemap_no_urlbase'), "\n";
         return;
     }
@@ -89,7 +89,7 @@ sub install_before_final_checks {
         return;
     }
 
-    return if (correct_urlbase() ne 'https://bugzilla.mozilla.org/');
+    return if (Bugzilla->localconfig->{urlbase} ne 'https://bugzilla.mozilla.org/');
 }
 
 sub install_filesystem {
@@ -126,7 +126,7 @@ EOT
 
 sub before_robots_txt {
     my ($self, $args) = @_;
-    $args->{vars}{SITEMAP_URL} = correct_urlbase() . SITEMAP_URL;
+    $args->{vars}{SITEMAP_URL} = Bugzilla->localconfig->{urlbase} . SITEMAP_URL;
 }
 
 __PACKAGE__->NAME;
index 3548e5af5ec3296d75043c6d6d2e31053cc2bc7e..4519461b4207ae4389fdfe9944ad02e689f8bf2f 100644 (file)
@@ -34,7 +34,7 @@ our @EXPORT = qw(
 
 use Bugzilla::Extension::SiteMapIndex::Constants;
 
-use Bugzilla::Util qw(correct_urlbase datetime_from url_quote);
+use Bugzilla::Util qw(datetime_from url_quote);
 use Bugzilla::Constants qw(bz_locations);
 
 use Scalar::Util qw(blessed);
@@ -144,7 +144,7 @@ END
     foreach my $filename (@$filelist) {
         $index_xml .= "
   <sitemap>
-    <loc>" . correct_urlbase() . "data/$extension_name/$filename</loc>
+    <loc>" . Bugzilla->localconfig->{urlbase} . "data/$extension_name/$filename</loc>
     <lastmod>$timestamp</lastmod>
   </sitemap>
 ";
@@ -166,8 +166,8 @@ END
 sub _generate_sitemap_file {
     my ($extension_name, $filecount, $products, $bugs) = @_;
 
-    my $bug_url = correct_urlbase() . 'show_bug.cgi?id=';
-    my $product_url = correct_urlbase() . 'describecomponents.cgi?product=';
+    my $bug_url = Bugzilla->localconfig->{urlbase} . 'show_bug.cgi?id=';
+    my $product_url = Bugzilla->localconfig->{urlbase} . 'describecomponents.cgi?product=';
 
     my $sitemap_xml = <<END;
 <?xml version="1.0" encoding="UTF-8"?>
index d85b0532b3443436f36334654caeeb5bf276d1df..c85bb9b3b67712acbf7ef5e6e0a1d70ee6b5e361 100644 (file)
@@ -88,7 +88,7 @@ sub attachment_id_is_patch {
 sub get_review_base {
     my $base = Bugzilla->params->{'splinter_base'};
     $base =~ s!/$!!;
-    my $urlbase = correct_urlbase();
+    my $urlbase = Bugzilla->localconfig->{urlbase};
     $urlbase =~ s!/$!! if $base =~ "^/";
     $base = $urlbase . $base;
     return $base;
index 703617b326277daec016b1886186930ffba9a36c..acb02d4669caf9ed7647a90839623af9d35c1c68 100755 (executable)
@@ -13,7 +13,7 @@ use warnings;
 use lib qw(. lib local/lib/perl5);
 
 use Bugzilla;
-use Bugzilla::Util qw( correct_urlbase );
+use Bugzilla::Util ();
 use Bugzilla::Error;
 use Bugzilla::Constants;
 use Bugzilla::Token qw( issue_short_lived_session_token
@@ -26,7 +26,7 @@ BEGIN { Bugzilla->extensions }
 use Bugzilla::Extension::GitHubAuth::Client;
 
 my $cgi     = Bugzilla->cgi;
-my $urlbase = correct_urlbase();
+my $urlbase = Bugzilla->localconfig->{urlbase};
 
 if (lc($cgi->request_method) eq 'post') {
     # POST requests come from Bugzilla itself and begin the GitHub login process
index 8d0dad36d22d56c720286b7636c0ffc21278b0b2..a664ebb168e17e0e1379a7ae4d842cf669d0a317 100644 (file)
@@ -68,6 +68,9 @@ DocumentRoot "/app"
 <IfDefine HTTPD_IN_SUBDIR>
 Alias "/bmo" "/app"
 </IfDefine>
+<IfDefine HTTPS>
+    SetEnv HTTPS on
+</IfDefine>
 <Directory "/app">
     Options -Indexes -FollowSymLinks
     AllowOverride None
index 0de32ee624d40fc49a39b05200c163b18e1ca5aa..23609f2b3407cf5a603ce0c42d7823d9f6bf79ad 100755 (executable)
@@ -1214,7 +1214,7 @@ sub process_bug {
 
     $log .= "Bug ${urlbase}show_bug.cgi?id=$bug_fields{'bug_id'} ";
     $log .= "imported as bug $id.\n";
-    $log .= $params->{"urlbase"} . "show_bug.cgi?id=$id\n\n";
+    $log .= Bugziilla->localconfig->{"urlbase"} . "show_bug.cgi?id=$id\n\n";
     if ($err) {
         $log .= "The following problems were encountered while creating bug $id.\n";
         $log .= $err;
@@ -1274,7 +1274,7 @@ my $urlbase    = $root->{'att'}->{'urlbase'};
 my $log = join("\n\n", @logs);
 $log .=  "\n\nImported $bugtotal bug(s) from $urlbase,\n  sent by $exporter.\n";
 my $subject =  "$bugtotal Bug(s) successfully moved from $urlbase to "
-   . $params->{"urlbase"};
+   . Bugzilla->localconfig->{"urlbase"};
 my @to = ($exporter, $maintainer);
 MailMessage( $subject, $log, @to );
 
index 6635ef50adc257ff74f4acc72fa7c2ab447caa0d..f21edfc92ec16db3c45d5885113ba6d43813b791 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -75,7 +75,7 @@ else {
 
     if ($user_id && $user->in_group('admin')) {
         # If 'urlbase' is not set, display the Welcome page.
-        unless (Bugzilla->params->{'urlbase'}) {
+        unless (Bugzilla->localconfig->{'urlbase'}) {
             $template->process('welcome-admin.html.tmpl')
                 or ThrowTemplateError($template->error());
             exit;
index 0949f369621841f3171af48fc8abaac7a6dc567d..23b55e3252173ba9aeed0197e9e9b4e2952aba72 100644 (file)
@@ -121,7 +121,7 @@ if (lc($cgi->request_method) eq 'post') {
          push(@all_mail_results, $ref_sent);
      }
 
-     print $cgi->redirect(correct_urlbase() . 'show_bug.cgi?id='.$new_bug->bug_id);
+     print $cgi->redirect(Bugzilla->localconfig->{urlbase} . 'show_bug.cgi?id='.$new_bug->bug_id);
 } else {
  print $cgi->header();
 $template->process("bug/new_bug.html.tmpl",
index 6ea09e37f9d20f4825bc803995d501e9a2116daf..e9a3ed1de2398875bdeef5422c1dfc9746f69f0e 100755 (executable)
@@ -43,7 +43,7 @@ my $vars = {};
 
 # redirect to enter_bug if no field is passed.
 unless ($cgi->param()) {
-    print $cgi->redirect(correct_urlbase() . 'enter_bug.cgi');
+    print $cgi->redirect(Bugzilla->localconfig->{urlbase} . 'enter_bug.cgi');
     exit;
 }
 
index f9fb6ea60100915685d42435ae05fc7ee332c64a..79d9cb90c314da095dcffce78d0134ac0947eef8 100644 (file)
@@ -22,6 +22,5 @@ $answer{'db_user'}   = 'bugs';
 $answer{'diffpath'} = '/usr/bin';
 $answer{'index_html'} = 0;
 $answer{'interdiffbin'} = '/usr/bin/interdiff';
-$answer{'urlbase'} = 'http://localhost/bmo/';
 $answer{'use_suexec'} = '';
 $answer{'webservergroup'} = '%USER%';
index 333bffa264b3731ba7b10ef8f461a28c96d23fb6..6bd9dd355a1a50836e5b0ef6ef0fda0254aed14e 100644 (file)
@@ -67,17 +67,6 @@ Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
 # Set Parameters
 ##########################################################################
 
-# Some parameters must be turned on to create bugs requiring them.
-# They are also expected to be turned on by some webservice_*.t scripts.
-my ($urlbase, $sslbase);
-$urlbase = $config->{browser_url} . '/' . $config->{bugzilla_installation};
-$urlbase .= '/' unless $urlbase =~ /\/$/;
-
-if ($urlbase =~ /^https/) {
-    $sslbase = $urlbase;
-    $urlbase =~ s/^https(.+)$/http$1/;
-}
-
 # Create missing priorities
 # BMO uses P1-P5 which is different from upstream
 my $field = Bugzilla::Field->new({ name => 'priority' });
@@ -98,8 +87,6 @@ foreach my $value (qw(PC)) {
 }
 
 my %set_params = (
-    urlbase => $urlbase,
-    sslbase => $sslbase,
     usebugaliases => 1,
     useqacontact  => 1,
     mail_delivery_method => 'Test',
index 0ef843ce7e510b45d194478c41b3dd93502ea19f..f80837c0ec02170a004ab8e616ca1fb11d2246c8 100644 (file)
@@ -357,8 +357,8 @@ sub set_parameters {
     go_to_admin($sel);
     $sel->click_ok("link=Parameters", undef, "Go to the Config Parameters page");
     $sel->wait_for_page_to_load(WAIT_TIME);
-    $sel->title_is("Configuration: Required Settings");
-    my $last_section = "Required Settings";
+    $sel->title_is("Configuration: General");
+    my $last_section = "General";
 
     foreach my $section (keys %$params) {
         if ($section ne $last_section) {
index 56fba4b01d63996171c465fe569237726c8a5255..757c33d06554659be4bacbc1308e4f8511d5ee22 100644 (file)
@@ -35,8 +35,7 @@ my $bug1_id = create_bug($sel, $bug_summary);
 
 # No alternate host for attachments; cookies will be accessible.
 
-set_parameters($sel, { "Attachments" => {"allow_attachment_display-on" => undef,
-                                         "reset-attachment_base" => undef} });
+set_parameters($sel, { "Attachments" => {"allow_attachment_display-on" => undef } });
 
 go_to_bug($sel, $bug1_id);
 $sel->click_ok("link=simple patch, v1");
@@ -51,24 +50,22 @@ $sel->go_back_ok();
 $sel->wait_for_page_to_load_ok(WAIT_TIME);
 $sel->title_like(qr/^$bug1_id /);
 
-# Alternate host for attachments; no cookie should be accessible.
-
-set_parameters($sel, { "Attachments" => {"attachment_base" => {type  => "text",
-                                                               value => "$config->{browser_ip_url}/$urlbase/"}} });
-go_to_bug($sel, $bug1_id);
-$sel->click_ok("link=simple patch, v1");
-$sel->wait_for_page_to_load_ok(WAIT_TIME);
-$sel->title_is("");
-@cookies = split(/[\s;]+/, $sel->get_cookie());
-$nb_cookies = scalar @cookies;
-ok(!$nb_cookies, "No cookies found");
-ok(!$sel->is_cookie_present("Bugzilla_login"), "Bugzilla_login not accessible");
-ok(!$sel->is_cookie_present("Bugzilla_logincookie"), "Bugzilla_logincookie not accessible");
-$sel->go_back_ok();
-$sel->wait_for_page_to_load_ok(WAIT_TIME);
-$sel->title_like(qr/^$bug1_id /);
-
-set_parameters($sel, { "Attachments" => {"reset-attachment_base" => undef} });
+# # Alternate host for attachments; no cookie should be accessible.
+
+# set_parameters($sel, { "Attachments" => {"attachment_base" => {type  => "text",
+#                                                                value => "$config->{browser_ip_url}/$urlbase/"}} });
+# go_to_bug($sel, $bug1_id);
+# $sel->click_ok("link=simple patch, v1");
+# $sel->wait_for_page_to_load_ok(WAIT_TIME);
+# $sel->title_is("");
+# @cookies = split(/[\s;]+/, $sel->get_cookie());
+# $nb_cookies = scalar @cookies;
+# ok(!$nb_cookies, "No cookies found");
+# ok(!$sel->is_cookie_present("Bugzilla_login"), "Bugzilla_login not accessible");
+# ok(!$sel->is_cookie_present("Bugzilla_logincookie"), "Bugzilla_logincookie not accessible");
+# $sel->go_back_ok();
+# $sel->wait_for_page_to_load_ok(WAIT_TIME);
+# $sel->title_like(qr/^$bug1_id /);
 
 #######################################################################
 # Security bug 472362.
index 92230720761cae99d61452c2e9095742a5d7efd3..dc5cabd4aa4223433bc4ad41c0adb3637c2c0773 100644 (file)
@@ -58,9 +58,6 @@ $sel->type_ok("Bugzilla_login", $config->{admin_user_login}, "Enter admin login
 $sel->type_ok("Bugzilla_password", $config->{admin_user_passwd}, "Enter admin password");
 $sel->click_ok("log_in");
 $sel->wait_for_page_to_load_ok(WAIT_TIME);
-$sel->title_is("Configuration: Required Settings");
-$sel->click_ok("link=General");
-$sel->wait_for_page_to_load_ok(WAIT_TIME);
 $sel->title_is("Configuration: General");
 $sel->type_ok("shutdownhtml", "");
 $sel->click_ok('//input[@type="submit" and @value="Save Changes"]', undef, "Save Changes");
index e1e1a897e839a12dd6ea4712d2d67008e055269e..4202fba0ca42f096ed3912eafd3f51eaae0e26a8 100755 (executable)
@@ -31,7 +31,7 @@ my $target;
 
 if (!$action) {
     # redirect to index.cgi if no action is defined.
-    print $cgi->redirect(correct_urlbase() . 'index.cgi');
+    print $cgi->redirect(Bugzilla->localconfig->{urlbase} . 'index.cgi');
     exit;
 }
 # prepare-sudo: Display the sudo information & login page
diff --git a/robots.cgi b/robots.cgi
new file mode 100755 (executable)
index 0000000..d9c3097
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -T
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use lib qw(. lib local/lib/perl5);
+
+use Bugzilla;
+use Bugzilla::Constants;
+use Bugzilla::Error;
+use Bugzilla::Update;
+use Digest::MD5 qw(md5_hex);
+use List::MoreUtils qw(any);
+
+# Check whether or not the user is logged in
+my $user     = Bugzilla->login(LOGIN_OPTIONAL);
+my $cgi      = Bugzilla->cgi;
+my $template = Bugzilla->template;
+
+my %vars;
+print $cgi->header('text/plain');
+Bugzilla::Hook::process( "before_robots_txt", { vars => \%vars } );
+$template->process( "robots.txt.tmpl", \%vars )
+    or ThrowTemplateError( $template->error() );
index a9bd2bcb3737d7a5e87a0fa1c3023993d2018ee0..b5ee0cd4331f137313d5ac1690fa722b0debe3e2 100755 (executable)
@@ -62,5 +62,5 @@ Bugzilla::Field->create({
 });
 print "Done!\n";
 
-my $urlbase = Bugzilla->params->{urlbase};
+my $urlbase = Bugzilla->localconfig->{urlbase};
 print "Please visit ${urlbase}editfields.cgi?action=edit&name=$name to finish setting up this field.\n";
index 02d414c646aded3823c4a3711f4eb63fe7cace18..dba64afbc0b51a8b851b02e9844d9e00b25a4466 100755 (executable)
@@ -3,23 +3,30 @@ use 5.10.1;
 use strict;
 use warnings;
 use lib qw(/app /app/local/lib/perl5);
+use autodie qw(:all);
 
 use Bugzilla::Install::Localconfig ();
 use Bugzilla::Install::Util qw(install_string);
 use Bugzilla::Test::Util qw(create_user);
+
 use DBI;
 use Data::Dumper;
-use English qw($EUID);
+use English qw(-no_match_vars $EUID);
 use File::Copy::Recursive qw(dircopy);
 use Getopt::Long qw(:config gnu_getopt);
+use IO::Async::Loop;
+use IO::Async::Process;
+use IO::Async::Signal;
+use IO::Async::Timer::Periodic;
 use LWP::Simple qw(get);
 use POSIX qw(WEXITSTATUS setsid);
+use Sys::Hostname;
 use User::pwent;
 
-use IO::Async::Loop;
-use IO::Async::Process;
-use IO::Async::Timer::Periodic;
-use IO::Async::Signal;
+BEGIN {
+    STDOUT->autoflush(1);
+    STDERR->autoflush(1);
+}
 
 use constant CI => $ENV{CI};
 
@@ -41,7 +48,13 @@ check_env(qw(
     BMO_db_pass
     BMO_memcached_namespace
     BMO_memcached_servers
-)) unless $cmd eq 'shell';
+    BMO_urlbase
+));
+
+if ( $ENV{BMO_urlbase} eq 'AUTOMATIC' ) {
+    $ENV{BMO_urlbase} = sprintf 'http://%s:%d/%s', hostname(), $ENV{PORT}, $ENV{BZ_QA_LEGACY_MODE} ? 'bmo/' : '';
+    $ENV{BZ_BASE_URL} = sprintf 'http://%s:%d', hostname(), $ENV{PORT};
+}
 
 $func->($opts->());
 
@@ -64,13 +77,24 @@ sub cmd_demo {
 sub cmd_httpd  {
     check_data_dir();
     wait_for_db();
-    run( '/usr/sbin/httpd', '-DFOREGROUND', '-f', '/app/httpd/httpd.conf' );
+    check_httpd_env();
+    my @httpd_args = (
+        '-DFOREGROUND',
+        '-f' => '/app/httpd/httpd.conf',
+    );
+
+    # If we're behind a proxy and the urlbase says https, we must be using https.
+    # * basically means "I trust the load balancer" anyway.
+    if ($ENV{BMO_inbound_proxies} eq '*' && $ENV{BMO_urlbase} =~ /^https/) {
+        unshift @httpd_args, '-DHTTPS';
+    }
+    run( '/usr/sbin/httpd', @httpd_args );
 }
 
 sub cmd_load_test_data {
     wait_for_db();
 
-    die "BZ_QA_ANSWERS_FILE is not set" unless $ENV{BZ_QA_ANSWERS_FILE};
+    die 'BZ_QA_ANSWERS_FILE is not set' unless $ENV{BZ_QA_ANSWERS_FILE};
     run( 'perl', 'checksetup.pl', '--no-template', $ENV{BZ_QA_ANSWERS_FILE} );
 
     if ($ENV{BZ_QA_LEGACY_MODE}) {
@@ -118,7 +142,7 @@ sub cmd_test_webservices {
         prove_cmd => [
             'prove', '-qf', '-I/app',
             '-I/app/local/lib/perl5',
-            sub { glob('webservice_*.t') },
+            sub { glob 'webservice_*.t' },
         ],
         prove_dir => '/app/qa/t',
     );
@@ -141,23 +165,27 @@ sub cmd_test_selenium {
         prove_cmd => [
             'prove', '-qf', '-Ilib', '-I/app',
             '-I/app/local/lib/perl5',
-            sub { glob('test_*.t') }
+            sub { glob 'test_*.t' }
         ],
         prove_dir => '/app/qa/t',
     );
 }
 
 sub cmd_shell   { run( 'bash',  '-l' ); }
-sub cmd_prove   { run( "prove", "-I/app", "-I/app/local/lib/perl5", @_ ); }
+sub cmd_prove   {
+    my (@args) = @_;
+    run( 'prove', '-I/app', '-I/app/local/lib/perl5', @args );
+}
 sub cmd_version { run( 'cat',   '/app/version.json' ); }
 
 sub cmd_test_bmo {
+    my (@prove_args) = @_;
     check_data_dir();
     wait_for_db();
 
     $ENV{BZ_TEST_NEWBIE} = 'newbie@mozilla.example';
     $ENV{BZ_TEST_NEWBIE_PASS} = 'captain.space.bagel.ROBOT!';
-    create_user($ENV{BZ_TEST_NEWBIE}, $ENV{BZ_TEST_NEWBIE_PASS}, realname => "Newbie User");
+    create_user($ENV{BZ_TEST_NEWBIE}, $ENV{BZ_TEST_NEWBIE_PASS}, realname => 'Newbie User');
 
     $ENV{BZ_TEST_NEWBIE2} = 'newbie2@mozilla.example';
     $ENV{BZ_TEST_NEWBIE2_PASS} = 'captain.space.pants.time.lord';
@@ -165,15 +193,17 @@ sub cmd_test_bmo {
     prove_with_httpd(
         httpd_url => $ENV{BZ_BASE_URL},
         httpd_cmd => [ '/usr/sbin/httpd', '-f', '/app/httpd/httpd.conf',  '-DFOREGROUND' ],
-        prove_cmd => [ "prove", "-I/app", "-I/app/local/lib/perl5", @_ ],
+        prove_cmd => [ 'prove', '-I/app', '-I/app/local/lib/perl5', @prove_args ],
     );
 }
 
 sub prove_with_httpd {
     my (%param) = @_;
 
-    unless (-d "/app/logs") {
-        mkdir("/app/logs") or die "unable to mkdir(/app/logs): $!\n";
+    check_httpd_env();
+
+    unless (-d '/app/logs') {
+        mkdir '/app/logs' or die "unable to mkdir(/app/logs): $!\n";
     }
 
     my $httpd_cmd = $param{httpd_cmd};
@@ -182,15 +212,15 @@ sub prove_with_httpd {
     my $loop = IO::Async::Loop->new;
 
     my $httpd_exit_f = $loop->new_future;
-    warn "starting httpd\n";
+    say 'starting httpd';
     my $httpd = IO::Async::Process->new(
         code => sub {
             setsid();
-            exec(@$httpd_cmd);
+            exec @$httpd_cmd;
         },
         setup => [
-             stdout => ["open", ">", "/app/logs/access.log"],
-             stderr => ["open", ">", "/app/logs/error.log"],
+             stdout => ['open', '>', '/app/logs/access.log'],
+             stderr => ['open', '>', '/app/logs/error.log'],
         ],
         on_finish => on_finish($httpd_exit_f),
         on_exception => on_exception('httpd', $httpd_exit_f),
@@ -203,10 +233,10 @@ sub prove_with_httpd {
     my $prove_exit_f = $loop->new_future;
     my $prove = IO::Async::Process->new(
         code => sub {
-            chdir($param{prove_dir}) if $param{prove_dir};
+            chdir $param{prove_dir} if $param{prove_dir};
             my @cmd = (map { ref $_ eq 'CODE' ? $_->() : $_ } @$prove_cmd);
             warn "run @cmd\n";
-            exec(@cmd);
+            exec @cmd;
         },
         on_finish    => on_finish($prove_exit_f),
         on_exception => on_exception('prove', $prove_exit_f),
@@ -236,7 +266,7 @@ sub wait_for_httpd {
             my ($timer) = @_;
             if ( $process->is_running ) {
                 my $resp = get("$url/__lbheartbeat__");
-                if ($resp && $resp =~ /^httpd OK$/) {
+                if ($resp && $resp =~ /^httpd OK/) {
                     $timer->stop;
                     $is_running_f->done($resp);
                 }
@@ -244,7 +274,7 @@ sub wait_for_httpd {
             }
             elsif ( $process->is_exited ) {
                 $timer->stop;
-                $is_running_f->fail("httpd process exited early");
+                $is_running_f->fail('httpd process exited early');
             }
             elsif ( $ticks++ > 60 ) {
                 $timer->stop;
@@ -258,7 +288,7 @@ sub wait_for_httpd {
 }
 
 sub copy_qa_extension {
-    say "copying the QA extension...";
+    say 'copying the QA extension...';
     dircopy('/app/qa/extensions/QA', '/app/extensions/QA');
 }
 
@@ -271,7 +301,7 @@ sub wait_for_db {
     my $dsn = "dbi:mysql:database=$c->{db_name};host=$c->{db_host}";
     my $dbh;
     foreach (1..12) {
-        say "checking database..." if $_ > 1;
+        say 'checking database...' if $_ > 1;
         $dbh = DBI->connect(
             $dsn,
             $c->{db_user},
@@ -280,7 +310,7 @@ sub wait_for_db {
         );
         last if $dbh;
         say "database $dsn not available, waiting...";
-        sleep(10);
+        sleep 10;
     }
     die "unable to connect to $dsn as $c->{db_user}\n" unless $dbh;
 }
@@ -306,28 +336,39 @@ sub on_finish {
     my ($f) = @_;
     return sub {
         my ($self, $exitcode) = @_;
+        say "exit code: $exitcode";
         $f->done(WEXITSTATUS($exitcode));
     };
 }
 
 sub check_user {
-    die "Effective UID must be 10001!" unless $EUID == 10001;
+    die 'Effective UID must be 10001!' unless $EUID == 10_001;
     my $user = getpwuid($EUID)->name;
     die "Name of EUID must be app, not $user" unless $user eq 'app';
 }
 
 sub check_data_dir {
-    die "/app/data must be writable by user 'app' (id: $EUID)" unless -w "/app/data";
-    die "/app/data/params must exist" unless -f "/app/data/params";
+    die "/app/data must be writable by user 'app' (id: $EUID)" unless -w '/app/data';
+    die '/app/data/params must exist' unless -f '/app/data/params';
 }
 
 sub check_env {
     my (@require_env) = @_;
     my @missing_env = grep { not exists $ENV{$_} } @require_env;
     if (@missing_env) {
-        die "Missing required environmental variables: ", join(", ", @missing_env), "\n";
+        die 'Missing required environmental variables: ', join(', ', @missing_env), "\n";
     }
 }
+sub check_httpd_env {
+    check_env(qw(
+        HTTPD_StartServers
+        HTTPD_MinSpareServers
+        HTTPD_MaxSpareServers
+        HTTPD_ServerLimit
+        HTTPD_MaxClients
+        HTTPD_MaxRequestsPerChild
+    ))
+}
 
 sub fix_path {
     $ENV{PATH} = "/app/local/bin:$ENV{PATH}";
@@ -336,7 +377,7 @@ sub fix_path {
 sub run {
     my (@cmd) = @_;
     say "+ @cmd";
-    my $rv = system(@cmd);
+    my $rv = system @cmd;
     if ($rv != 0) {
         exit 1;
     }
index 95b64cf51fa354a9ba62fe440dd663b47e2c0d86..c99d45394b10e9ed906c4559af905d93904f4407 100755 (executable)
@@ -116,7 +116,7 @@ chmod Bugzilla::Install::Filesystem::CGI_WRITE, $filename
     or warn install_string('chmod_failed', { path => $filename,
                                              error => $! });
 
-my $urlbase = correct_urlbase();
+my $urlbase = Bugzilla->localconfig->{urlbase};
 
 print $fh "digraph G {";
 print $fh qq(
@@ -245,9 +245,7 @@ if ($bug_count > MAX_WEBDOT_BUGS) {
 my $webdotbase = Bugzilla->params->{'webdotbase'};
 
 if ($webdotbase =~ /^https?:/) {
-     # Remote dot server. We don't hardcode 'urlbase' here in case
-     # 'sslbase' is in use.
-     $webdotbase =~ s/%([a-z]*)%/Bugzilla->params->{$1}/eg;
+     $webdotbase =~ s/%(?:sslbase|urlbase)%/Bugzilla->localconfig->{urlbase}/eg;
      my $url = $webdotbase . $filename;
      $vars->{'image_url'} = $url . ".gif";
      $vars->{'map_url'} = $url . ".map";
index 8d21a03b6d33ea2bde8037523548730ecdbd21aa..fc5e3d6eb8bdf125629137d788c0bdd4e8857ba9 100644 (file)
@@ -1,12 +1,11 @@
 $VAR1 = [
           {
-            'Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes' => 29,
             'Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitLongChainsOfMethodCalls' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings' => 0,
             'Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames' => 0,
             'Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace' => 0,
-            'Perl::Critic::Policy::Variables::ProhibitUnusedVariables' => 0,
+            'Perl::Critic::Policy::Variables::ProhibitUnusedVariables' => 1,
             'Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan' => 0,
             'Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline' => 0,
@@ -30,7 +29,7 @@ $VAR1 = [
             'Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect' => 0,
             'Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation' => 16,
             'Perl::Critic::Policy::Freenode::ModPerl' => 0,
-            'Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings' => 1,
+            'Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings' => 0,
             'Perl::Critic::Policy::Freenode::IndirectObjectNotation' => 0,
             'Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils' => 0,
             'Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode' => 0,
@@ -48,12 +47,10 @@ $VAR1 = [
             'Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists' => 0,
             'Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames' => 0,
             'Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations' => 0,
-            'Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin' => 1,
-            'Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals' => 272,
+            'Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals' => 255,
             'Perl::Critic::Policy::Freenode::Wantarray' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators' => 0,
-            'Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint' => 15,
-            'Perl::Critic::Policy::CodeLayout::RequireTidyCode' => 50,
+            'Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint' => 14,
             'Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms' => 0,
             'Perl::Critic::Policy::Modules::RequireExplicitPackage' => 0,
             'Perl::Critic::Policy::CodeLayout::ProhibitHardTabs' => 0,
@@ -61,19 +58,18 @@ $VAR1 = [
             'Perl::Critic::Policy::Freenode::OverloadOptions' => 0,
             'Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros' => 0,
-            'Perl::Critic::Policy::CodeLayout::RequireTrailingCommas' => 3,
+            'Perl::Critic::Policy::CodeLayout::RequireTrailingCommas' => 2,
             'Perl::Critic::Policy::Miscellanea::ProhibitUnrestrictedNoCritic' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect' => 0,
             'Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters' => 3,
             'Perl::Critic::Policy::NamingConventions::Capitalization' => 0,
-            'Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish' => 1,
-            'Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching' => 37,
-            'Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer' => 1,
+            'Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish' => 0,
+            'Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator' => 0,
             'Perl::Critic::Policy::Miscellanea::ProhibitFormats' => 0,
             'Perl::Critic::Policy::Variables::RequireInitializationForLocalVars' => 0,
-            'Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins' => 83,
+            'Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins' => 76,
             'Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep' => 4,
@@ -81,7 +77,7 @@ $VAR1 = [
             'Perl::Critic::Policy::Modules::RequireEndWithOne' => 0,
             'Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen' => 2,
             'Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion' => 0,
-            'Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls' => 168,
+            'Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls' => 3,
             'Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars' => 0,
             'Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict' => 0,
             'Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks' => 0,
@@ -96,14 +92,14 @@ $VAR1 = [
             'Perl::Critic::Policy::Freenode::WarningsSwitch' => 19,
             'Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest' => 0,
             'Perl::Critic::Policy::Variables::ProhibitPunctuationVars' => 14,
-            'Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches' => 2,
+            'Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches' => 1,
             'Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless' => 0,
             'Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock' => 0,
             'Perl::Critic::Policy::InputOutput::RequireCheckedOpen' => 0,
             'Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters' => 1,
             'Perl::Critic::Policy::RegularExpressions::ProhibitUselessTopic' => 0,
+            'Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators' => 0,
             'Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration' => 1,
-            'Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators' => 1,
             'Perl::Critic::Policy::Freenode::DiscouragedModules' => 5,
             'Perl::Critic::Policy::Subroutines::ProtectPrivateSubs' => 1,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitComplexVersion' => 0,
@@ -115,16 +111,14 @@ $VAR1 = [
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines' => 55,
             'Perl::Critic::Policy::Modules::RequireBarewordIncludes' => 0,
             'Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles' => 2,
-            'Perl::Critic::Policy::InputOutput::RequireCheckedClose' => 1,
+            'Perl::Critic::Policy::InputOutput::RequireCheckedClose' => 0,
             'Perl::Critic::Policy::ControlStructures::ProhibitDeepNests' => 0,
             'Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops' => 2,
             'Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop' => 0,
             'Perl::Critic::Policy::Freenode::WhileDiamondDefaultAssignment' => 0,
             'Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture' => 0,
-            'Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest' => 1,
             'Perl::Critic::Policy::Modules::ProhibitAutomaticExportation' => 0,
-            'Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything' => 38,
-            'Perl::Critic::Policy::Subroutines::RequireArgUnpacking' => 2,
+            'Perl::Critic::Policy::Subroutines::RequireArgUnpacking' => 0,
             'Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline' => 0,
             'Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines' => 0,
             'Perl::Critic::Policy::Documentation::RequirePodAtEnd' => 4,
@@ -142,6 +136,6 @@ $VAR1 = [
             'Perl::Critic::Policy::Subroutines::ProhibitReturnSort' => 0,
             'Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters' => 0,
             'Perl::Critic::Policy::Variables::RequireNegativeIndices' => 0,
-            'Perl::Critic::Policy::InputOutput::RequireBriefOpen' => 4
+            'Perl::Critic::Policy::InputOutput::RequireBriefOpen' => 3
           }
         ];
index a23c602ae018f5a4c4576d36d769afbe0fb019b3..75885b3f477169ae684338d3a4af7114793f2bf9 100644 (file)
@@ -19,7 +19,7 @@
   #                 Frédéric Buclin <LpSolit@gmail.com>
   #%]
 
-[% 
+[%
    title = "Advanced"
    desc = "Settings for advanced configurations."
 %]
@@ -29,7 +29,7 @@
   <a href="https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security">Strict-Transport-Security</a>
   header along with HTTP responses on SSL connections. This adds greater
   security to your SSL connections by forcing the browser to always
-  access your domain over SSL and never accept an invalid certificate. 
+  access your domain over SSL and never accept an invalid certificate.
   However, it should only be used if you have the <code>ssl_redirect</code>
   parameter turned on, [% terms.Bugzilla %] is the only thing running
   on its domain (i.e., your <code>urlbase</code> is something like
 [% END %]
 
 [% param_descs = {
-  cookiedomain => 
-    "If your website is at 'www.foo.com', setting this to"
-    _ " '.foo.com' will also allow 'bar.foo.com' to access"
-    _ " $terms.Bugzilla cookies. This is useful if you have more than"
-    _ " one hostname pointing at the same web server, and you"
-    _ " want them to share the $terms.Bugzilla cookie.",
-
   inbound_proxies =>
     "When inbound traffic to $terms.Bugzilla goes through a proxy,"
     _ " $terms.Bugzilla thinks that the IP address of every single"
@@ -71,7 +64,7 @@
     _ " If set to a *, $terms.Bugzilla will trust the first value in the "
     _ " X-Forwarded-For header.",
 
-  proxy_url => 
+  proxy_url =>
     "$terms.Bugzilla may have to access the web to get notifications about"
     _ " new releases (see the <tt>upgrade_notification</tt> parameter)."
     _ " If your $terms.Bugzilla server is behind a proxy, it may be"
index bdd20c6763859341a486b05a7a2021e7a05ed149..0858a1044d1ae58ff10c3d1919f6a0197b3c22c5 100644 (file)
     _ "<p>It is highly recommended that you set the <tt>attachment_base</tt>"
     _ " parameter if you turn this parameter on.",
 
-  attachment_base => 
-    "When the <tt>allow_attachment_display</tt> parameter is on, it is "
-    _ " possible for a malicious attachment to steal your cookies or"
-    _ " perform an attack on $terms.Bugzilla using your credentials."
-    _ "<p>If you would like additional security on attachments to avoid"
-    _ " this, set this parameter to an alternate URL for your $terms.Bugzilla"
-    _ " that is not the same as <tt>urlbase</tt> or <tt>sslbase</tt>."
-    _ " That is, a different domain name that resolves to this exact"
-    _ " same $terms.Bugzilla installation.</p>"
-    _ "<p>Note that if you have set the"
-    _ " <a href=\"editparams.cgi?section=advanced#cookiedomain_desc\"><tt>cookiedomain</tt>"
-    _" parameter</a>, you should set <tt>attachment_base</tt> to use a"
-    _ " domain that would <em>not</em> be matched by"
-    _ " <tt>cookiedomain</tt>.</p>"
-    _ "<p>For added security, you can insert <tt>%bugid%</tt> into the URL,"
-    _ " which will be replaced with the ID of the current $terms.bug that"
-    _ " the attachment is on, when you access an attachment. This will limit"
-    _ " attachments to accessing only other attachments on the same"
-    _ " ${terms.bug}. Remember, though, that all those possible domain names "
-    _ " (such as <tt>1234.your.domain.com</tt>) must point to this same"
-    _ " $terms.Bugzilla instance.",
-
   allow_attachment_deletion =>
     "If this option is on, administrators will be able to delete " _
     "the content of attachments.",
diff --git a/template/en/default/admin/params/core.html.tmpl b/template/en/default/admin/params/core.html.tmpl
deleted file mode 100644 (file)
index b1578f4..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-[%# The contents of this file are subject to the Mozilla Public
-  # License Version 1.1 (the "License"); you may not use this file
-  # except in compliance with the License. You may obtain a copy of
-  # the License at http://www.mozilla.org/MPL/
-  #
-  # Software distributed under the License is distributed on an "AS
-  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-  # implied. See the License for the specific language governing
-  # rights and limitations under the License.
-  #
-  # The Original Code is the Bugzilla Bug Tracking System.
-  #
-  # The Initial Developer of the Original Code is Netscape Communications
-  # Corporation. Portions created by Netscape are
-  # Copyright (C) 1998 Netscape Communications Corporation. All
-  # Rights Reserved.
-  #
-  # Contributor(s): Dave Miller <justdave@bugzilla.org>
-  #                 Frédéric Buclin <LpSolit@gmail.com>
-  #%]
-
-[% 
-   title = "Required Settings"
-   desc = "Settings that are required for proper operation of $terms.Bugzilla" 
-%]
-
-[% param_descs = {
-  urlbase => "The URL that is the common initial leading part of all $terms.Bugzilla " _
-             "URLs.",
-
-  sslbase => "The URL that is the common initial leading part of all HTTPS " _
-             "(SSL) $terms.Bugzilla URLs.",
-
-  ssl_redirect => 
-    "When this is enabled, $terms.Bugzilla will ensure that every page is"
-    _ " accessed over SSL, by redirecting any plain HTTP requests to HTTPS"
-    _ " using the <tt>sslbase</tt> parameter. Also, when this is enabled,"
-    _ " $terms.Bugzilla will send out links using <tt>sslbase</tt> in emails"
-    _ " instead of <tt>urlbase</tt>.",
-
-  cookiepath => "Path, relative to your web document root, to which to restrict " _
-                "$terms.Bugzilla cookies. Normally this is the URI portion of your URL " _
-                "base. Begin with a / (single slash mark). For instance, if " _
-                "$terms.Bugzilla serves from 'http://www.somedomain.com/bugzilla/', set " _
-                "this parameter to /bugzilla/. Setting it to / will allow " _
-                "all sites served by this web server or virtual host to read " _
-                "$terms.Bugzilla cookies.",
-} %]
index a7aed895e5ed4c3e659bbba8a42295b82c477eb0..9baecbb53b23b3d52fcbce6831ccbae1f62576b6 100644 (file)
@@ -96,7 +96,6 @@
   <head>
     [%- js_BUGZILLA = {
             param => {
-                cookiepath => Param('cookiepath'),
                 maxusermatches => Param('maxusermatches'),
             },
             constant => {
index c4948efe5afd387d739042d4fdf63182f77f19be..7ef83c0f154ad17ecc1c30a5c2d9dc25fbe781d6 100644 (file)
@@ -2,7 +2,7 @@ User-agent: *
 Disallow: /
 Crawl-delay: 30
 
-[% IF NOT urlbase.matches("bugzilla-dev") %]
+[% IF NOT Bugzilla.localconfig.urlbase.matches("bugzilla-dev") %]
 
 Allow: /$
 Allow: /index.cgi
index 9a8e3b9d17035dff5e1df2f32c7d9099805d7939..35a771ff397109c6cebe8b44af17ebd8f43f6426 100644 (file)
@@ -105,6 +105,24 @@ END
     lc_old_vars => <<'END',
 The following variables are no longer used in ##localconfig##, and
 have been moved to ##old_file##: ##vars##
+END
+    localconfig_attachment_base => <<'END',
+When the runtime allow_attachment_display parameter is on, it is
+possible for a malicious attachment to steal your cookies or
+perform an attack using your credentials.
+
+If you would like additional security on attachments to avoid
+this, set this parameter to an alternate URL for your $terms.Bugzilla
+that is not the same as urlbase.
+That is, a different domain name that resolves to this exact
+same installation.
+
+For added security, you can insert %bugid% into the URL,
+which will be replaced with the ID of the current bug that
+the attachment is on, when you access an attachment. This will limit
+attachments to accessing only other attachments on the same
+bug. Remember, though, that all those possible domain names
+ must point to this same instance.
 END
     localconfig_create_htaccess => <<'END',
 If you are using Apache as your web server, Bugzilla can create .htaccess
@@ -180,7 +198,7 @@ here.
 END
     localconfig_memcached_servers => <<'END',
 If this option is set, Bugzilla will integrate with Memcached.
-Specify one or more servers, separated by spaces, using hostname:port 
+Specify one or more servers, separated by spaces, using hostname:port
 notation (for example: 127.0.0.1:11211).
 END
     localconfig_memcached_namespace => <<'END',
@@ -197,6 +215,9 @@ END
 This hash is used by BMO to override select data/params values on a per-webhead
 basis. Keys set to undef will default to the value in data/params.
 Only the keys listed below can be overridden.
+END
+    localconfig_urlbase => <<'END',
+The URL that is the common initial leading part of all URLs.
 END
     localconfig_use_suexec => <<'END',
 Set this to 1 if Bugzilla runs in an Apache SuexecUserGroup environment.
index e37008fc7d690fcce820f41f57d318f596ef5501..11d70a6ead3a420bdbea13732f9f7a7ca91c46cd 100644 (file)
   parameters for this installation; among others:</p>
 
   <ul>
-    <li><a href="editparams.cgi?section=core#urlbase_desc">urlbase</a>, which is the URL
-    pointing to this installation and which will be used in emails (which is also the
-    reason you see this page: as long as this parameter is not set, you will see this
-    page again and again).</li>
-
-    <li><a href="editparams.cgi?section=core#cookiepath_desc">cookiepath</a> is important
-    for your browser to manage your cookies correctly.</li>
-
     <li><a href="editparams.cgi?section=general#maintainer_desc">maintainer</a>,
       the person responsible for this installation if something is
       running wrongly.</li>
index 00771ceac32229ecbffcf3a8aa60fec3d34171ea..e70b9780a98f2d057d34cbf35eaacbdc2a872e98 100755 (executable)
@@ -208,7 +208,7 @@ sub DisableAccount {
     $user->update();
 
     Bugzilla->logout();
-    print Bugzilla->cgi->redirect(correct_urlbase());
+    print Bugzilla->cgi->redirect(Bugzilla->localconfig->{urlbase});
     exit;
 }