Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add two sections to the VIP.RestrictedFunctions sniff. #584

Merged
merged 1 commit into from
Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions WordPress/Sniffs/VIP/RestrictedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,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 @@ -55,6 +55,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