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

Member variables set in child class ignored for taint flow #4605

Closed
LukasReschke opened this issue Nov 18, 2020 · 1 comment
Closed

Member variables set in child class ignored for taint flow #4605

LukasReschke opened this issue Nov 18, 2020 · 1 comment

Comments

@LukasReschke
Copy link
Contributor

This is currently not detected.

https://psalm.dev/r/0b40f43f27

<?php //--taint-analysis	

class TemplateResponse {
    public $taint = '';

    public function getTaint() : string {
        return $this->taint;
    }
}

class StandaloneTemplateResponse extends TemplateResponse {
    public function __construct($taint) {
        $this->taint = $taint; 
    }
}

$extended_response = new StandAloneTemplateResponse($_GET['bar']);
echo $extended_response->getTaint();
@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/0b40f43f27
<?php //--taint-analysis	

class TemplateResponse {
    public $taint = '';

    public function getTaint() : string {
        return $this->taint;
    }
}

class StandaloneTemplateResponse extends TemplateResponse {
    public function __construct($taint) {
        $this->taint = $taint; 
    }
}

$extended_response = new StandAloneTemplateResponse($_GET['bar']);
echo $extended_response->getTaint();
Psalm output (using commit 4bb84f7):

No issues!

@muglug muglug closed this as completed in be275ae Nov 18, 2020
danog pushed a commit to danog/psalm that referenced this issue Jan 29, 2021
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