Skip to content

Commit

Permalink
Merge pull request #40 from igorhrcek/issue-39
Browse files Browse the repository at this point in the history
feat: Removed obsolete security header
  • Loading branch information
igorhrcek authored Apr 5, 2022
2 parents 56e7b1c + 776f66f commit 03df726
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wp secure flush
```

### Add Security Headers
Adds the HSTS, Referrer-Policy, X-Content-Type-Options, X-Frame-Options and X-XSS-Protection
Adds the HSTS, Referrer-Policy, X-Content-Type-Options and X-Frame-Options

You can choose to add all above or only one or more by using `--headers` argument.

Expand Down
3 changes: 1 addition & 2 deletions src/SubCommands/AddSecurityHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function getTemplateVars() : array {
'Strict-Transport-Security' => '"max-age=63072000; includeSubDomains; preload"',
'Referrer-Policy' => 'strict-origin-when-cross-origin',
'X-Content-Type-Options' => 'nosniff',
'X-Frame-Options' => 'SAMEORIGIN',
'X-XSS-Protection' => '"1; mode=block"'
'X-Frame-Options' => 'SAMEORIGIN'
];

$headers = $this->commandArguments['headers'] ?? array_keys($default_headers);
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/AddSecurityHeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function testItWillContainAllHeadersOnNginx() : void {
$this->assertNotEmpty($response->getHeaderLine( 'Referrer-Policy' ));
$this->assertNotEmpty($response->getHeaderLine( 'x-content-type-options' ));
$this->assertNotEmpty($response->getHeaderLine( 'X-Frame-Options' ));
$this->assertNotEmpty($response->getHeaderLine( 'X-XSS-Protection' ));
}

public function testItWillContainAllHeadersOnApache() : void {
Expand All @@ -35,6 +34,5 @@ public function testItWillContainAllHeadersOnApache() : void {
$this->assertNotEmpty($response->getHeaderLine( 'Referrer-Policy' ));
$this->assertNotEmpty($response->getHeaderLine( 'x-content-type-options' ));
$this->assertNotEmpty($response->getHeaderLine( 'X-Frame-Options' ));
$this->assertNotEmpty($response->getHeaderLine( 'X-XSS-Protection' ));
}
}

0 comments on commit 03df726

Please sign in to comment.