Skip to content
Snippets Groups Projects
Commit 7fc1f2cd authored by Erick Hitter's avatar Erick Hitter
Browse files

Block recursive scheduling, no one really likes infinite loops

parent 797e802e
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,11 @@ function validate_command( $command ) {
* @return bool
*/
function is_command_allowed( $command ) {
// No recursion allowed.
if ( CLI_NAMESPACE === $command ) {
return false;
}
// Command explicitly disallowed.
if ( in_array( $command, get_command_blacklist(), true ) ) {
return false;
......
......@@ -128,6 +128,7 @@ class Plugin_Functions extends WP_UnitTestCase {
array( 'wp cli info' ), // Should fail, is a blocked event.
array( 'wp cli info' ), // Should fail as a blocked event, would otherwise fail as a duplicate.
array( 'cli info' ), // Should also fail as a blocked event, though normalization would also block it as a duplicate.
array( sprintf( '%s create', WP_CLI_Cron_Control_Offload\CLI_NAMESPACE ) ), // Don't permit recursive scheduling.
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment