Skip to content

Migrate phpcs-security-audit coverage to Semgrep-based analyzer

The phpcs-security-audit analyzer should have its coverage converted to Semgrep.

Semgrep's PHP support is now GA as of this 2022-06-21 and there are some rules ported from phpcs-security-audit.

@idawson notes that recent Semgrep improvements should help with this conversion.

The phpcs-security-audit analyzer has also suffered a lack of maintenance since about March 2020, per #361157 (closed).d

Implementation Plan

Rules Migrated from phpcs-security-audit to semgrep

As discussed here, we only added 9 rules to GitLab semgrep, however, there are 16 rules in GitLab phpcs-security-audit:

Number Migrated? GitLab phpcs-security-audit rule GitLab semgrep rule Notes
1 Security.BadFunctions.Asserts php_assert_rule-assert-use  
2 Security.BadFunctions.Backticks php_backticks_rule-backticks-use  
3 Security.BadFunctions.CryptoFunctions  
4 Security.BadFunctions.FilesystemFunctions php_file_rule-file-inclusion  
5 Security.BadFunctions.NoEvals php_eval_rule-eval-use  
6 Security.BadFunctions.Phpinfos php_phpinfo_rule-phpinfo-use  
7 Security.BadFunctions.SystemExecFunctions php_exec_rule-exec-use  
8 Security.BadFunctions.FringeFunctions php_ftp_rule-ftp-use  
9 Security.BadFunctions.CallbackFunctions    
10 Security.BadFunctions.EasyRFI    
11 Security.BadFunctions.EasyXSS    
12 Security.BadFunctions.ErrorHandling    
13 Security.BadFunctions.FunctionHandlingFunctions    
14 Security.BadFunctions.Mysqli    
15 Security.BadFunctions.PregReplace   Rule is no longer applicable
16 Security.BadFunctions.SQLFunctions    

We plan on adding more rules as part of https://gitlab.com/gitlab-org/gitlab/-/issues/457901+s.

Edited by Adam Cohen
OSZAR »