Page MenuHomePhabricator

Weird interaction between phan and taint-check: PhanUndeclaredVariable
Closed, ResolvedPublic

Description

Event Timeline

Fortunately this was an easy fix. The code analyzing property access (e.g. $foo->bar) has a special case for when $foo is a stdClass: in this case, accessing a $foo->bar would transfer foo's taintedness to bar. However, the code doing that didn't check whether the LHS of -> is a variable, hence it tried to parse a variable from the LHS even in cases like Foo::myFunc( 'myParam' )->bar. In turn, this would create a bogus variable named $Foo which phan wouldn't recognize.

Change 584121 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/tools/phan/SecurityCheckPlugin@master] Fix edge case with prop access confusing other parts of phan

https://gerrit.wikimedia.org/r/584121

Daimona triaged this task as High priority.Apr 6 2020, 4:34 PM

Change 584121 merged by jenkins-bot:
[mediawiki/tools/phan/SecurityCheckPlugin@master] Fix edge case with prop access confusing other parts of phan

https://gerrit.wikimedia.org/r/584121