Skip to content

Commit f49a329

Browse files
committed
Add usage instructions and example output to the README
1 parent 95889d9 commit f49a329

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,27 @@ These sniffs will report security vulnerabilities in your PHP code.
77
This project is inspired
88
by [phpcs-security-audit](https://github.com/FloeDesignTechnologies/phpcs-security-audit),
99
a similar but no longer maintained project.
10+
11+
## Usage
12+
13+
Run PHP_CodeSniffer with the `Security` standard:
14+
15+
```sh
16+
vendor/bin/phpcs --standard=Security /path/to/code
17+
```
18+
19+
Example output:
20+
21+
```text
22+
FILE: /path/to/file.php
23+
-----------------------------------------------------------------------------------------------------------------------
24+
FOUND 6 ERRORS AFFECTING 5 LINES
25+
-----------------------------------------------------------------------------------------------------------------------
26+
5 | ERROR | Passing user input to require_once() can lead to remote file inclusion (CWE-98)
27+
9 | ERROR | Passing user input to shell_exec() can lead to OS command injection (CWE-78)
28+
11 | ERROR | Outputting unsanitized user input can lead to cross-site scripting (CWE-79)
29+
11 | ERROR | Passing user input to file_get_contents() can lead to path traversal attacks (CWE-22)
30+
13 | ERROR | Cleartext transmission of data over HTTP is a security risk (CWE-319)
31+
15 | ERROR | The sha1 algorithm is not safe for password hashing (CWE-916), use password_hash() for hashing passwords
32+
-----------------------------------------------------------------------------------------------------------------------
33+
```

0 commit comments

Comments
 (0)