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

Type checks such as is_string() and is_array() make taint detection fail #3680

Closed
TysonAndre opened this issue Jun 25, 2020 · 1 comment
Closed
Labels

Comments

@TysonAndre
Copy link
Contributor

E.g. https://psalm.dev/r/6a3bc2a667

Expected: TaintedInput should be emitted whether or not there is an is_string() condition. Other conditions such as is_numeric() may be allowed to remove taintedness?
Observed: When if (is_string($var)) is added, psalm fails to infer the variable is tainted.

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/6a3bc2a667
<?php // --taint-analysis

$input = $_GET['input'];
// Adding the is_string() or is_array() or condition makes taint detection fail.
if (is_string($input)) {
    echo "$input";
}
Psalm output (using commit 9837a60):

No issues!

@muglug muglug added the bug label Jun 25, 2020
@muglug muglug closed this as completed in 07f7e5c Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants