From 3dc37a14af940286c4d4a89e311545ebb96678c4 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Mon, 6 Jul 2020 17:09:51 -0700 Subject: [PATCH] shell: Demonstrate that ->restrict( RESTRICT_NONE ) is broken Adds an intentionally failing test to demonstrate that calling Command::restrict( Shell:RESTRICT_NONE ) is broken. Bug: T257278 Change-Id: I0c305ae6ca8e5811f3c7b87ad5892985de19314c --- tests/phpunit/includes/shell/CommandTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/includes/shell/CommandTest.php b/tests/phpunit/includes/shell/CommandTest.php index 4aef7bb5326..985a8b50eaf 100644 --- a/tests/phpunit/includes/shell/CommandTest.php +++ b/tests/phpunit/includes/shell/CommandTest.php @@ -1,6 +1,7 @@ execute(); $this->assertSame( '', $result->getStdout() ); } + + /** + * @see T257278 + * @group Broken + */ + public function testDisablingRestrictions() { + $command = TestingAccessWrapper::newFromObject( new Command() ); + // As CommandFactory does for the firejail case: + $command->restrict( Shell::RESTRICT_DEFAULT ); + // Disable restrictions + $command->restrict( Shell::RESTRICT_NONE ); + $this->assertSame( 0, $command->restrictions ); + } }