Skip to content

Commit 3229b90

Browse files
Copilothvitved
andauthored
Apply suggestion: use exists(var | range | formula) idiom in OsPathBasenameCall
Agent-Logs-Url: https://github.com/github/codeql/sessions/a319e151-8e8f-4770-b87c-12b5cdb268b8 Co-authored-by: hvitved <3667920+hvitved@users.noreply.github.com>
1 parent 3a512ae commit 3229b90

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,10 @@ module PathInjection {
118118
private class OsPathBasenameCall extends Sanitizer, DataFlow::CallCfgNode {
119119
OsPathBasenameCall() {
120120
exists(API::Node osPathModule |
121-
(
122-
osPathModule = API::moduleImport("os").getMember("path")
123-
or
124-
osPathModule = API::moduleImport(["posixpath", "ntpath", "genericpath"])
125-
) and
121+
osPathModule = API::moduleImport("os").getMember("path")
122+
or
123+
osPathModule = API::moduleImport(["posixpath", "ntpath", "genericpath"])
124+
|
126125
this = osPathModule.getMember("basename").getACall()
127126
)
128127
}

0 commit comments

Comments
 (0)