Python: Refactor ExternalFileObject to use field

Instead of string matching. This brings it in line with what CollectionKind,
SequenceKind, and DictKind does.
This commit is contained in:
Rasmus Wriedt Larsen
2020-04-23 10:28:29 +02:00
parent da3292606c
commit c479a77d55

View File

@@ -183,10 +183,12 @@ private predicate urlparse(ControlFlowNode fromnode, CallNode tonode) {
/** A kind of "taint", representing an open file-like object from an external source. */
class ExternalFileObject extends TaintKind {
ExternalFileObject() { this = "file[" + any(ExternalStringKind key) + "]" }
ExternalStringKind valueKind;
ExternalFileObject() { this = "file[" + valueKind + "]" }
/** Gets the taint kind for the contents of this file */
TaintKind getValue() { this = "file[" + result + "]" }
TaintKind getValue() { result = valueKind }
override TaintKind getTaintOfMethodResult(string name) {
name = "read" and result = this.getValue()