Skip to content

Commit 0fc79c5

Browse files
committed
README: revert run example ruleset changes
... and two more tiny grammar fixes.
1 parent fed2e1b commit 0fc79c5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ It currently has core PHP rules as well as Drupal 7 specific rules.
2222

2323
The tool also checks for CVE issues and security advisories related to the CMS/framework. This enables you to follow the versioning of components during static code analysis.
2424

25-
The main reason for this project being an extension of PHP_CodeSniffer is to have easy integration into continuous integration systems. It also allow for finding security bugs that are not detected with some object oriented analysis (such as [PHPMD](http://phpmd.org/)).
25+
The main reason for this project being an extension of PHP_CodeSniffer is to have easy integration into continuous integration systems. It also allows for finding security bugs that are not detected with some object oriented analysis (such as [PHPMD](http://phpmd.org/)).
2626

2727
phpcs-security-audit in its beginning was backed by Pheromone (later on named Floe design + technologies) and written by [Jonathan Marcil](https://twitter.com/jonathanmarcil).
2828

@@ -57,26 +57,26 @@ Usage
5757

5858
Simply set the standard to `Security` or point to any XML ruleset file and to a folder to scan:
5959
```
60-
phpcs --standard=Security /your/php/files/ --extensions=php,inc,lib,module,info
60+
phpcs --extensions=php,inc,lib,module,info --standard=./vendor/pheromone/phpcs-security-audit/example_base_ruleset.xml /your/php/files/
6161
```
6262

6363
Specifying extensions is important since, for example, PHP code is within `.module` files in Drupal.
6464

6565
To have a quick example of output you can use the provided `tests.php` file:
6666
```
67-
$ phpcs --standard=Security ./vendor/pheromone/phpcs-security-audit/tests.php
67+
$ phpcs --extensions=php,inc,lib,module,info --standard=./vendor/pheromone/phpcs-security-audit/example_base_ruleset.xml ./vendor/pheromone/phpcs-security-audit/tests.php
6868
6969
FILE: tests.php
7070
--------------------------------------------------------------------------------
71-
FOUND 22 ERRORS AND 37 WARNINGS AFFECTING 52 LINES
71+
FOUND 18 ERRORS AND 36 WARNINGS AFFECTING 44 LINES
7272
--------------------------------------------------------------------------------
7373
74-
6 | ERROR | Easy XSS detected because of direct user input with $_POST on echo
75-
8 | WARNING | db_query() is deprecated except when doing a static query
76-
8 | WARNING | db_query() is deprecated except when doing a static query
77-
8 | ERROR | Potential SQL injection found in db_query()
78-
8 | ERROR | Potential SQL injection found in db_query()
79-
9 | WARNING | Usage of preg_replace with /e modifier is not recommended.
74+
6 | WARNING | Possible XSS detected with . on echo
75+
6 | ERROR | Easy XSS detected because of direct user input with $_POST on echo
76+
9 | WARNING | Usage of preg_replace with /e modifier is not recommended.
77+
10 | WARNING | Usage of preg_replace with /e modifier is not recommended.
78+
10 | ERROR | User input and /e modifier found in preg_replace, remote code execution possible.
79+
11 | ERROR | User input found in preg_replace, /e modifier could be used for malicious intent.
8080
...
8181
```
8282

@@ -176,7 +176,7 @@ As with any security tool, this one comes with it's share of annoyance. At first
176176

177177
* It's a generator of false positives. This can actually help you learn what are the weak functions in PHP. Paranoia mode will fix that by doing a major cut-off on warnings when set to 0.
178178
* This tool was created around 10 years ago. Some of its parts might look outdated, and support for old PHP code will still be present. The reality is that many code base scanned with it might be as old as the tool.
179-
* It's slow. On big Drupal modules and core it can take too much time (and RAM, reconfigure `cli/php.ini` to use 512M if needed) to run. Not sure if it's because of bugs in PHPCS or this set of rules, but will be investigated last. Meanwhile you can configure PHPCS to ignore big contrib modules (and run another instance of PHPCS for `.info` parsing only for them). An example is og taking hours, usually everything runs under 1-2 minutes and sometimes around 5 minute. You can try using the `--parallel=8` (or another number) option to try and speed things up on supported OSes. Possible workaround is to use `phpcs --ignore=folder` to skip scanning of those parts.
179+
* It's slow. On big Drupal modules and core it can take too much time (and RAM, reconfigure `cli/php.ini` to use 512M if needed) to run. Not sure if it's because of bugs in PHPCS or this set of rules, but will be investigated last. Meanwhile you can configure PHPCS to ignore big contrib modules (and run another instance of PHPCS for `.info` parsing only for them). An example is og taking hours, usually everything runs under 1-2 minutes and sometimes around 5 minute. You can try using the `--parallel=8` (or another number) option to try and speed things up on supported OSes. Possible work-around is to use `phpcs --ignore=folder` to skip scanning of those parts.
180180
* For Drupal advisories checking: a module with multiple versions might be secure if a lesser fixed version exists and you'll still get the error or warning. Keep everything updated at latest as recommended on Drupal's website.
181181

182182

0 commit comments

Comments
 (0)