Skip to content

Commit 40b61fa

Browse files
committed
python: fix qldocs and clean-up dead code
1 parent f4ce382 commit 40b61fa

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module TarSlip {
9090
}
9191
}
9292

93-
/* Members argument to extract method */
93+
/** The `members` argument `extractall` is considered a sink. */
9494
class ExtractMembersSink extends Sink {
9595
ExtractMembersSink() {
9696
exists(DataFlow::CallCfgNode call |
@@ -105,6 +105,10 @@ module TarSlip {
105105
}
106106
}
107107

108+
/**
109+
* For a "check-like function name" (matching `"%path"`), `checkPath`,
110+
* and a call `checkPath(info.name)`, the variable `info` is considered checked.
111+
*/
108112
class TarFileInfoSanitizer extends SanitizerGuard {
109113
ControlFlowNode tarInfo;
110114

@@ -117,29 +121,15 @@ module TarSlip {
117121
attr.getObject() = tarInfo
118122
|
119123
// Assume that any test with "path" in it is a sanitizer
120-
call.getAChild*().(AttrNode).getName().matches("%path")
124+
call.getAChild*().(AttrNode).getName().toLowerCase().matches("%path")
121125
or
122-
call.getAChild*().(NameNode).getId().matches("%path")
126+
call.getAChild*().(NameNode).getId().toLowerCase().matches("%path")
123127
)
124128
}
125129

126130
override predicate checks(ControlFlowNode checked, boolean branch) {
127131
checked = tarInfo and
128132
branch in [true, false]
129133
}
130-
131-
DataFlow::ExprNode shouldGuard() {
132-
tarInfo.dominates(result.asCfgNode()) and
133-
// exists(EssaDefinition def |
134-
// def.getAUse() = tarInfo and
135-
// def.getAUse() = result.asCfgNode()
136-
// ) and
137-
exists(SsaSourceVariable v |
138-
v.getAUse() = tarInfo and
139-
v.getAUse() = result.asCfgNode()
140-
)
141-
}
142134
}
143-
144-
DataFlow::ExprNode getAGuardedNode(TarFileInfoSanitizer tfis) { result = tfis.getAGuardedNode() }
145135
}

0 commit comments

Comments
 (0)