Skip to content

Commit

Permalink
Merge pull request #584 from jrfnl/feature/issue-460-vip-ini-set
Browse files Browse the repository at this point in the history
Add two sections to the VIP.RestrictedFunctions sniff.
  • Loading branch information
westonruter authored Jul 11, 2016
2 parents 97c27b7 + eed3612 commit 0a5973a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
27 changes: 27 additions & 0 deletions WordPress/Sniffs/VIP/RestrictedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,33 @@ public function getGroups() {
),
),

'runtime_configuration' => array(
'type' => 'error',
'message' => '%s is prohibited, changing configuration at runtime is not allowed on VIP Production.',
'functions' => array(
'dl',
'error_reporting',
'ini_alter',
'ini_restore',
'ini_set',
'magic_quotes_runtime',
'set_magic_quotes_runtime',
'apache_setenv',
'putenv',
'set_include_path',
'restore_include_path',
),
),

'prevent_path_disclosure' => array(
'type' => 'error',
'message' => '%s is prohibited as it can lead to full path disclosure.',
'functions' => array(
'error_reporting',
'phpinfo',
),
),

);
}
}//end class
13 changes: 13 additions & 0 deletions WordPress/Tests/VIP/RestrictedFunctionsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,16 @@ get_adjacent_post(); // error
get_previous_post(); // error
get_next_post(); // error
parse_url( 'http://example.com/' ); // warning

dl(); // error
error_reporting(); // error
ini_alter(); // error
ini_restore(); // error
ini_set(); // error
magic_quotes_runtime(); // error
set_magic_quotes_runtime(); // error
apache_setenv(); // error
putenv(); // error
set_include_path(); // error
restore_include_path(); // error
phpinfo(); // error
12 changes: 12 additions & 0 deletions WordPress/Tests/VIP/RestrictedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public function getErrorList()
69 => 1,
70 => 1,
71 => 1,
74 => 1,
75 => 2,
76 => 1,
77 => 1,
78 => 1,
79 => 1,
80 => 1,
81 => 1,
82 => 1,
83 => 1,
84 => 1,
85 => 1,
);

}//end getErrorList()
Expand Down

0 comments on commit 0a5973a

Please sign in to comment.