Skip to content

Commit dfe7f53

Browse files
Update CopyFile.qll
1 parent 0d6d078 commit dfe7f53

File tree

1 file changed

+15
-2
lines changed
  • python/ql/src/experimental/semmle/python/frameworks

1 file changed

+15
-2
lines changed

python/ql/src/experimental/semmle/python/frameworks/CopyFile.qll

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ private import python
22
private import experimental.semmle.python.Concepts
33
private import semmle.python.dataflow.new.DataFlow
44
private import semmle.python.ApiGraphs
5-
5+
66
private module CopyFile {
7+
8+
/**
9+
* The `shutil` module provides methods to copy or move files.
10+
* See:
11+
* - https://docs.python.org/3/library/shutil.html#shutil.copyfile
12+
* - https://docs.python.org/3/library/shutil.html#shutil.copy
13+
* - https://docs.python.org/3/library/shutil.html#shutil.copy2
14+
* - https://docs.python.org/3/library/shutil.html#shutil.copytree
15+
* - https://docs.python.org/3/library/shutil.html#shutil.move
16+
*/
717
private class CopyFiles extends DataFlow::CallCfgNode, CopyFile::Range {
818
CopyFiles() {
919
this =
@@ -18,7 +28,10 @@ private module CopyFile {
1828

1929
override DataFlow::Node getfsrcArgument() { none() }
2030
}
21-
31+
32+
// TODO: once we have flow summaries, model `shutil.copyfileobj` which copies the content between its' file-like arguments.
33+
// See https://docs.python.org/3/library/shutil.html#shutil.copyfileobj
34+
2235
private class CopyFileobj extends DataFlow::CallCfgNode, CopyFile::Range {
2336
CopyFileobj() { this = API::moduleImport("shutil").getMember("copyfileobj").getACall() }
2437

0 commit comments

Comments
 (0)