]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 600475 - Support the 'includeSubDomains' flag as an option for the 'Strict-Transp...
authorReed Loden <reed@reedloden.com>
Wed, 29 Sep 2010 18:53:13 +0000 (11:53 -0700)
committerReed Loden <reed@reedloden.com>
Wed, 29 Sep 2010 18:53:13 +0000 (11:53 -0700)
[r=glob a=mkanat]

Bugzilla/CGI.pm
Bugzilla/Config/Advanced.pm
template/en/default/admin/params/advanced.html.tmpl

index 447c0749b921ba2139550addbd8ffd16addf643b..9355ef7dd4add52339b05b98c6c0f24717491def 100644 (file)
@@ -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(@_) || "";
index e15a429630ca07fbc552d16b21f16f1a7b766391..fada813f15b2bce4cf5181a3c82a97ac153c24fe 100644 (file)
@@ -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
   },
 );
 
index 10a1fb678d03fc7af488085d0d42c3e53fc885e1..a8e8a297bb6fd9fea5d967c5109bf99cd0918c89 100644 (file)
   on its domain (i.e., your <code>urlbase</code> is something like
   <code>http://bugzilla.example.com/</code>), and you never plan to disable
   the <code>ssl_redirect</code> parameter.
+  <ul>
+    <li>
+      off - Don't send the Strict-Transport-Security header with requests.
+    </li>
+    <li>
+      this_domain_only - Send the Strict-Transport-Security header with all
+      requests, but only support it for the current domain.
+    </li>
+    <li>
+      include_subdomains - Send the Strict-Transport-Security header along
+      with the <code>includeSubDomains</code> flag, which will apply the
+      security change to all subdomains. This is especially useful when
+      combined with an <code>attachment_base</code> that exists as (a)
+      subdomain(s) under the main [% terms.Bugzilla %] domain.
+    </li>
+  </ul>
 [% END %]
 
 [% param_descs = {