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

Taintedness of function return values is only tracked if function has a declared return type #3652

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

Comments

@TysonAndre
Copy link
Contributor

TysonAndre commented Jun 23, 2020

<?php

// Edit: adding @return string or even @return mixed will make Psalm properly warn about this
function rawinput() {
    return $_GET['rawinput'];
}

echo rawinput();

Observed: Does not emit TaintedInput for the echo
Expected: Should have some way to warn. function identity($x) { return $x; } has the same issue.

Also, it seems like labels for functions in namespaces may have issues - at a glance, they may be called ns\foo in one label but foo in another

@TysonAndre TysonAndre changed the title Support tracking taintedness of function return values? Taintedness of function return values is only tracked if function has a declared return type Jun 23, 2020
@muglug muglug added the bug label Jun 23, 2020
@TysonAndre
Copy link
Contributor Author

TysonAndre commented Jun 23, 2020

It seems like src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php handleTaints() ends up getting called. I wonder if $inferred_type->parent_nodes is somehow different due to early return or due to some other issue

EDIT: it gets called whether or not there's a return type, the issue's probably elsewhere

@muglug muglug closed this as completed in 13fc8a7 Jun 23, 2020
TysonAndre pushed a commit to TysonAndre/psalm that referenced this issue Jun 24, 2020
TysonAndre pushed a commit to TysonAndre/psalm that referenced this issue Jun 29, 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