summaryrefslogtreecommitdiffstats
path: root/tests/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-01-19 11:56:04 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-02 19:07:46 +0100
commitbbd5f2841561911461d992483cab54f5c18fa342 (patch)
tree113e9ab1919c8fb42a7fd90db79139b783a643c9 /tests/settings
parent1155ad6e389e47e110a415f22eddda1570dc9ff2 (diff)
downloadnextcloud-server-bbd5f2841561911461d992483cab54f5c18fa342.tar.gz
nextcloud-server-bbd5f2841561911461d992483cab54f5c18fa342.zip
Let users configure security headers in their Webserver
Doing this in the PHP code is not the right approach for multiple reasons: 1. A bug in the PHP code prevents them from being added to the response. 2. They are only added when something is served via PHP and not in other cases (that makes for example the newest IE UXSS which is not yet patched by Microsoft exploitable on ownCloud) 3. Some headers such as the Strict-Transport-Security might require custom modifications by administrators. This was not possible before and lead to buggy situations. This pull request moves those headers out of the PHP code and adds a security check to the admin settings performed via JS.
Diffstat (limited to 'tests/settings')
-rw-r--r--tests/settings/controller/securitysettingscontrollertest.php71
1 files changed, 0 insertions, 71 deletions
diff --git a/tests/settings/controller/securitysettingscontrollertest.php b/tests/settings/controller/securitysettingscontrollertest.php
index d89e4932368..56848d8df30 100644
--- a/tests/settings/controller/securitysettingscontrollertest.php
+++ b/tests/settings/controller/securitysettingscontrollertest.php
@@ -31,77 +31,6 @@ class SecuritySettingsControllerTest extends \PHPUnit_Framework_TestCase {
$this->securitySettingsController = $this->container['SecuritySettingsController'];
}
-
- public function testEnforceSSLEmpty() {
- $this->container['Config']
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('forcessl', false);
-
- $response = $this->securitySettingsController->enforceSSL();
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testEnforceSSL() {
- $this->container['Config']
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('forcessl', true);
-
- $response = $this->securitySettingsController->enforceSSL(true);
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testEnforceSSLInvalid() {
- $this->container['Config']
- ->expects($this->exactly(0))
- ->method('setSystemValue');
-
- $response = $this->securitySettingsController->enforceSSL('blah');
- $expectedResponse = array('status' => 'error');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testEnforceSSLForSubdomainsEmpty() {
- $this->container['Config']
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('forceSSLforSubdomains', false);
-
- $response = $this->securitySettingsController->enforceSSLForSubdomains();
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testEnforceSSLForSubdomains() {
- $this->container['Config']
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('forceSSLforSubdomains', true);
-
- $response = $this->securitySettingsController->enforceSSLForSubdomains(true);
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testEnforceSSLForSubdomainsInvalid() {
- $this->container['Config']
- ->expects($this->exactly(0))
- ->method('setSystemValue');
-
- $response = $this->securitySettingsController->enforceSSLForSubdomains('blah');
- $expectedResponse = array('status' => 'error');
-
- $this->assertSame($expectedResponse, $response);
- }
-
public function testTrustedDomainsWithExistingValues() {
$this->container['Config']
->expects($this->once())