From: Reed Loden Date: Wed, 29 Sep 2010 18:53:13 +0000 (-0700) Subject: Bug 600475 - Support the 'includeSubDomains' flag as an option for the 'Strict-Transp... X-Git-Tag: bugzilla-4.0rc1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18ad400e49ac27b4e028effb4ff7ca313a1ca883;p=thirdparty%2Fbugzilla.git Bug 600475 - Support the 'includeSubDomains' flag as an option for the 'Strict-Transport-Security' advanced option in order to protect subdomains. [r=glob a=mkanat] --- diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 447c0749b9..9355ef7dd4 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -288,8 +288,12 @@ sub header { # Add Strict-Transport-Security (STS) header if this response # is over SSL and the strict_transport_security param is turned on. - if ($self->https && Bugzilla->params->{'strict_transport_security'}) { - unshift(@_, '-strict-transport-security' => 'max-age=' . MAX_STS_AGE); + if ($self->https && Bugzilla->params->{'strict_transport_security'} ne 'off') { + my $sts_opts = 'max-age=' . MAX_STS_AGE; + if (Bugzilla->params->{'strict_transport_security'} eq 'include_subdomains') { + $sts_opts .= '; includeSubDomains'; + } + unshift(@_, '-strict_transport_security' => $sts_opts); } return $self->SUPER::header(@_) || ""; diff --git a/Bugzilla/Config/Advanced.pm b/Bugzilla/Config/Advanced.pm index e15a429630..fada813f15 100644 --- a/Bugzilla/Config/Advanced.pm +++ b/Bugzilla/Config/Advanced.pm @@ -55,8 +55,10 @@ use constant get_param_list => ( { name => 'strict_transport_security', - type => 'b', - default => 0, + type => 's', + choices => ['off', 'this_domain_only', 'include_subdomains'], + default => 'off', + checker => \&check_multi }, ); diff --git a/template/en/default/admin/params/advanced.html.tmpl b/template/en/default/admin/params/advanced.html.tmpl index 10a1fb678d..a8e8a297bb 100644 --- a/template/en/default/admin/params/advanced.html.tmpl +++ b/template/en/default/admin/params/advanced.html.tmpl @@ -35,6 +35,22 @@ on its domain (i.e., your urlbase is something like http://bugzilla.example.com/), and you never plan to disable the ssl_redirect parameter. + [% END %] [% param_descs = {