Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e8cbbd

Browse files
committed
Python: Add concept FileSystemAccess
1 parent a6abee9 commit 2e8cbbd

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

python/ql/src/experimental/semmle/python/Concepts.qll

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,37 @@ module SystemCommandExecution {
4040
}
4141
}
4242

43+
/**
44+
* A data-flow node that performs a file system access, including reading and writing data,
45+
* creating and deleting files and folders, checking and updating permissions, and so on.
46+
*
47+
* Extend this class to refine existing API models. If you want to model new APIs,
48+
* extend `FileSystemAccess::Range` instead.
49+
*/
50+
class FileSystemAccess extends DataFlow::Node {
51+
FileSystemAccess::Range self;
52+
53+
FileSystemAccess() { this = self }
54+
55+
/** Gets an argument to this file system access that is interpreted as a path. */
56+
DataFlow::Node getAPathArgument() { result = self.getAPathArgument() }
57+
}
58+
59+
/** Provides a class for modeling new file-system access APIs. */
60+
module FileSystemAccess {
61+
/**
62+
* A data-flow node that performs a file system access, including reading and writing data,
63+
* creating and deleting files and folders, checking and updating permissions, and so on.
64+
*
65+
* Extend this class to model new APIs. If you want to refine existing API models,
66+
* extend `FileSystemAccess` instead.
67+
*/
68+
abstract class Range extends DataFlow::Node {
69+
/** Gets an argument to this file system access that is interpreted as a path. */
70+
abstract DataFlow::Node getAPathArgument();
71+
}
72+
}
73+
4374
/**
4475
* A data-flow node that decodes data from a binary or textual format. This
4576
* is intended to include deserialization, unmarshalling, decoding, unpickling,

0 commit comments

Comments
 (0)