Skip to content

Conversation

@OndraM
Copy link
Contributor

@OndraM OndraM commented Nov 24, 2020

@OndraM OndraM changed the title Forbid more dangerous functions Forbid a few other dangerous functions Nov 25, 2020
posix_mkfifo: null # do not create named pipes in the script
posix_mknod: null # do not create special files in the script
proc_nice: null # changes the priority of the current process
putenv: null # might overwrite existing variables

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady stimhle bych byl opatrny, dost se to pouziva

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Envy bys v aplikaci nemel vytvaret, jen prijimat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Máš nějaký příklad?

V pár specifických případech se to asi používá oprávněně (třeba v command-line tools), tam bych si to pak dal do výjimek.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jop vetsinou se jedna o command-line, nebo o testy.

treba priklad

$input = new ArgvInput();
if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {
    putenv('APP_ENV='.$_ENV['APP_ENV']);
    // force loading .env files when --env is defined
    $_SERVER['APP_ENV'] = null;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tohle ale bude v nějakém bootstrap.php nebo index.php, kde už je beztak i require_once (načítá se composer autoloader), takže to stejně bude ve výjimkách, ne?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nejenom tam, vyuziva to napr. SF komponenta Dotenv

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hokypierce To jo, ale ty sám to ze svého kódu mimo nějaký index.php nevoláš, nebo jo? Kdyžtak mi hoď do Slacku link do bitbucket jestli to někde máte, kouknu.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OndraM mas pravdu ze to je jen z bootstrapu pri init app

@OndraM OndraM merged commit 68284bf into main Nov 25, 2020
@OndraM OndraM deleted the feature/add-forbidden-calls branch November 27, 2020 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants