]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 594990: Make the Strict-Transport-Security HTTP header only be sent
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 28 Sep 2010 03:18:46 +0000 (20:18 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 28 Sep 2010 03:18:46 +0000 (20:18 -0700)
if a particular parameter is enabled.
r=glob, a=mkanat

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

index e2d238f5a250ecbef48683001bd986fd1c5664ff..447c0749b921ba2139550addbd8ffd16addf643b 100644 (file)
@@ -287,8 +287,8 @@ sub header {
     }
 
     # Add Strict-Transport-Security (STS) header if this response
-    # is over SSL and ssl_redirect is enabled.
-    if ($self->https && Bugzilla->params->{'ssl_redirect'}) {
+    # 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);
     }
 
index 1acf76f38bfa487959cefeb023706e70c3fe13a2..e15a429630ca07fbc552d16b21f16f1a7b766391 100644 (file)
@@ -52,6 +52,12 @@ use constant get_param_list => (
    type => 't',
    default => ''
   },
+
+  {
+   name => 'strict_transport_security',
+   type => 'b',
+   default => 0,
+  },
 );
 
 1;
index 4caa2f1dc56004e75de052ebd05ea5b116be2773..2414a46fb4f043c35a47d719cf3db8ba8778e3dc 100644 (file)
    desc = "Settings for advanced configurations."
 %]
 
+[% sts_desc = BLOCK %]
+  Enables the sending of the 
+  <a href="http://en.wikipedia.org/wiki/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. 
+  However, it should only be used if you have the <code>ssl_redirect</code>
+  parameter turned on, Bugzilla is the only thing running
+  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.
+[% END %]
+
 [% param_descs = {
   cookiedomain => 
     "If your website is at 'www.foo.com', setting this to"
@@ -47,4 +60,6 @@
     _ " necessary to enter its URL if the web server cannot access the"
     _ " HTTP_PROXY environment variable. If you have to authenticate,"
     _ " use the <code>http://user:pass@proxy_url/</code> syntax.",
+
+  strict_transport_security => sts_desc,
 } %]