Add tests.

This commit is contained in:
Taus Brock-Nannestad
2019-01-17 14:44:23 +01:00
parent 7c3dc929ac
commit ad429f5ae1
4 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1 @@
| InsecureTemporaryFile.py:4:16:4:23 | ControlFlowNode for mktemp() | Call to deprecated function mktemp may be insecure. |

View File

@@ -0,0 +1,7 @@
from tempfile import mktemp
def write_results(results):
filename = mktemp()
with open(filename, "w+") as f:
f.write(results)
print("Results written to", filename)

View File

@@ -0,0 +1 @@
Security/CWE-377/InsecureTemporaryFile.ql

View File

@@ -0,0 +1,6 @@
from tempfile import NamedTemporaryFile
def write_results(results):
with NamedTemporaryFile(mode="w+", delete=False) as f:
f.write(results)
print("Results written to", f.name)