mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
v1
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
testFailures
|
||||
failures
|
||||
@@ -0,0 +1,2 @@
|
||||
import python
|
||||
import experimental.meta.ConceptsTest
|
||||
@@ -0,0 +1,20 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.DataFlow
|
||||
import semmle.python.Concepts
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
private import semmle.python.dataflow.new.internal.PrintNode
|
||||
|
||||
module FileSystemAccessTest implements TestSig {
|
||||
string getARelevantTag() { result = "getAPathArgument" }
|
||||
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(location.getFile().getRelativePath()) and
|
||||
exists(FileSystemAccess a, DataFlow::Node path |
|
||||
path = a.getAPathArgument() and
|
||||
location = a.getLocation() and
|
||||
element = path.toString() and
|
||||
value = prettyNodeForInlineTest(path) and
|
||||
tag = "getAPathArgument"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
from aiofile import async_open, AIOFile
|
||||
|
||||
AIOFile("file", 'r') # $ getAPathArgument="file"
|
||||
async_open("file", "r") # $ getAPathArgument="file"
|
||||
@@ -0,0 +1,3 @@
|
||||
import aiofiles
|
||||
|
||||
aiofiles.open("file", mode='r') # $ getAPathArgument="file"
|
||||
@@ -0,0 +1,8 @@
|
||||
import anyio
|
||||
from anyio.streams.file import FileReadStream, FileWriteStream
|
||||
from anyio import Path
|
||||
|
||||
anyio.open_file("file", 'r') # $ getAPathArgument="file"
|
||||
FileReadStream.from_path("file") # $ getAPathArgument="file"
|
||||
FileWriteStream.from_path("file") # $ getAPathArgument="file"
|
||||
Path("file") # $ getAPathArgument="file"
|
||||
@@ -0,0 +1,4 @@
|
||||
from sanic import response
|
||||
|
||||
response.file("file") # $ getAPathArgument="file"
|
||||
response.file_stream("file") # $ getAPathArgument="file"
|
||||
@@ -0,0 +1,5 @@
|
||||
from starlette.responses import FileResponse
|
||||
from baize.asgi import FileResponse as baizeFileResponse
|
||||
|
||||
baizeFileResponse("file") # $ getAPathArgument="file"
|
||||
FileResponse("file") # $ getAPathArgument="file"
|
||||
@@ -1,2 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
failures
|
||||
|
||||
@@ -20,6 +20,8 @@ builtins.open(file="file") # $ getAPathArgument="file"
|
||||
|
||||
io.open("file") # $ getAPathArgument="file"
|
||||
io.open(file="file") # $ getAPathArgument="file"
|
||||
io.open_code("file") # $ getAPathArgument="file"
|
||||
io.FileIO("file") # $ getAPathArgument="file"
|
||||
|
||||
f = open("path") # $ getAPathArgument="path"
|
||||
f.write("foo") # $ getAPathArgument="path" fileWriteData="foo"
|
||||
|
||||
Reference in New Issue
Block a user