Skip to content

Commit 85c2fdd

Browse files
authored
Merge pull request #35 from igorhrcek/issue-32
Issue 32
2 parents 7c0b8e1 + 0f8f6d3 commit 85c2fdd

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ Removes all security rules.
2222
wp secure flush
2323
```
2424

25+
### Add Security Headers
26+
Adds the HSTS, Referrer-Policy, X-Content-Type-Options, X-Frame-Options and X-XSS-Protection
27+
28+
You can choose to add all above or only one or more by using `--headers` argument.
29+
30+
Example:
31+
```bash
32+
wp secure add-security-headers
33+
wp secure add-security-headers --headers=Strict-Transport-Security
34+
wp secure add-security-headers --headers=Strict-Transport-Security,X-Frame-Options
35+
```
36+
2537
### Block the access to sensitive files and directories
2638
```bash
2739
wp secure block-access <what-to-block>

secure-command.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,4 @@
1010
require_once __DIR__ . '/vendor/autoload.php';
1111
}
1212

13-
\WP_CLI::add_command('secure', SecureCommand::class);
14-
15-
//wp secure disable-directory-browsing
16-
//wp secure block-php-execution-in-uploads
17-
//wp secure block-php-execution-in-themes
18-
//wp secure block-php-execution-in-plugins
19-
//wp secure block-php-execution-in-wp-includes
20-
//wp secure block-access-to-htaccess
21-
//wp secure block-access-to-sensitive-files
22-
//wp secure block-access-to-sensitive-directories
23-
//wp secure block-author-scanning
24-
//wp secure block-access-to-xml-rpc
25-
26-
//wp secure add --rules=disable-directory-browsing,block-php-execution-in-uploads --output --path
27-
//wp secure remove --rules=disable-directory-browsing,block-php-execution-in-uploads
28-
//wp secure flush
29-
//wp secure block-access-to-htaccess --revert
30-
//wp secure block-access-to-htaccess --path=/path/to/htaccess --output
13+
\WP_CLI::add_command('secure', SecureCommand::class);

src/SecureCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ public function block_author_scanning($args, $assoc_args) : void {
306306
*
307307
* ## EXAMPLES
308308
*
309-
* $ wp secure add_security_headers
309+
* $ wp secure add-security-headers
310310
* Success: Add Security Headers rule has been deployed.
311311
*
312+
* @subcommand add-security-headers
312313
* @when before_wp_load
313314
*/
314315
public function add_security_headers($args, $assoc_args) : void {

0 commit comments

Comments
 (0)