Skip to content

PHP_CodeSniffer standard for detecting security vulnerabilities in your code

Notifications You must be signed in to change notification settings

nth-root/phpcs-security-sniffs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpcs-security-sniffs

phpcs-security-sniffs is a collection of security-focused sniffs for PHP_CodeSniffer. These sniffs will report security vulnerabilities in your PHP code.

This project is inspired by phpcs-security-audit, a similar but no longer maintained project.

Usage

Run PHP_CodeSniffer with the Security standard:

vendor/bin/phpcs --standard=Security /path/to/code

Example output:

FILE: /path/to/file.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------------------------
  5 | ERROR | Passing user input to require_once() can lead to remote file inclusion (CWE-98)
  9 | ERROR | Passing user input to shell_exec() can lead to OS command injection (CWE-78)
 11 | ERROR | Outputting unsanitized user input can lead to cross-site scripting (CWE-79)
 11 | ERROR | Passing user input to file_get_contents() can lead to path traversal attacks (CWE-22)
 13 | ERROR | Cleartext transmission of data over HTTP is a security risk (CWE-319)
 15 | ERROR | The sha1 algorithm is not safe for password hashing (CWE-916), use password_hash() for hashing passwords
-----------------------------------------------------------------------------------------------------------------------

About

PHP_CodeSniffer standard for detecting security vulnerabilities in your code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages