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

echo $taintedObject; does not infer taintedness from __toString() #3697

Closed
TysonAndre opened this issue Jun 27, 2020 · 1 comment
Closed

Comments

@TysonAndre
Copy link
Contributor

Same for string encapsulation ("Trace: $myClass")

Expected: The examples in https://psalm.dev/r/43fab1bc2a should emit TaintedOutput

Related to #3696

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/43fab1bc2a
<?php // --taint-analysis

class MyClass {
    public function __toString() {
        return $_GET['blah'];
    }
}

// echo (new MyClass())->__toString(); emits TaintedInput
$x = new MyClass();
echo "x: $x\n";
echo $x;
Psalm output (using commit c95ebfe):

No issues!

TysonAndre added a commit to TysonAndre/psalm that referenced this issue Jun 28, 2020
Partially support vimeo#3697

There are other ways that objects can be cast to string that this PR
does not analyze.
@muglug muglug closed this as completed in 38977d7 Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant