Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
Since in Python functions are values, we can assign any function to any variable. This also applies to sources and sinks. At the moment, we rely on the sources and sinks to be named in a certain way for us to recognize them (recognition by name). This works for the majority of the use cases, but will not work for all since it is fundamentally not how Python works. Instead, we should fully qualify sinks and sources by their absolute names and propagate them through assignments as if they were variables. Only when these variables are called, we should interpret them as sources/sinks and mark them as such.
Example:
In the above example, we would fully qualify the function
os.systemto be a sink. This sink is introduced into the variablesystemin the import call(1).The sink-tainted system-variable is then used in the
__init__-closure and, as such, sink-taints the valuesystemin the assignment at(2).in
(6), this sink-taintedsystemvariable is propagated intoself.worker. The call at(7)with a taint gets put into the sink-tainedself.workerin(3). Only here, we resolveself.workerto be a sink function, since it is called.We will, at
(4)then in turn be able to remove the sink-taint fromself.workerand be able to detect(8)not to be problematic.As such, sources and sinks should propagate through the code like taint does.