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

Skip to content

Commit 8169383

Browse files
committed
Python: Add tests for clear-text storage and logging.
1 parent 15bb8b5 commit 8169383

7 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
edges
2+
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
3+
parents
4+
#select
5+
| test.py:8:35:8:42 | Taint sink | test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password | Sensitive data returned by $@ is stored here. | test.py:7:16:7:29 | Taint source | Call returning a password |
6+
| test.py:14:30:14:39 | Taint sink | test.py:14:30:14:39 | a certificate or key | test.py:14:30:14:39 | a certificate or key | Sensitive data returned by $@ is stored here. | test.py:14:30:14:39 | Taint source | Call returning a certificate or key |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Security/CWE-312/CleartextLogging.ql
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
edges
2+
| file:///usr/lib/python3.6/keyword.py:65:10:65:34 | an open file | file:///usr/lib/python3.6/keyword.py:66:18:66:19 | an open file |
3+
| file:///usr/lib/python3.6/keyword.py:70:10:70:22 | an open file | file:///usr/lib/python3.6/keyword.py:73:21:73:22 | an open file |
4+
| file:///usr/lib/python3.6/keyword.py:90:10:90:39 | an open file | file:///usr/lib/python3.6/keyword.py:91:9:91:10 | an open file |
5+
| password_in_cookie.py:7:16:7:27 | dict of externally controlled string | password_in_cookie.py:7:16:7:43 | externally controlled string |
6+
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
7+
| password_in_cookie.py:7:16:7:43 | externally controlled string | password_in_cookie.py:9:33:9:40 | externally controlled string |
8+
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
9+
parents
10+
#select
11+
| password_in_cookie.py:9:33:9:40 | Taint sink | password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password | Sensitive data from $@ is stored here. | password_in_cookie.py:7:16:7:43 | Taint source | a request parameter containing a password |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Security/CWE-312/CleartextStorage.ql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: -p ../lib/ --max-import-depth=3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import Flask, make_response, request
2+
3+
app = Flask("Leak password")
4+
5+
@app.route('/')
6+
def index():
7+
password = request.args.get("password")
8+
resp = make_response(render_template(...))
9+
resp.set_cookie("password", password)
10+
return resp
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import logging
2+
3+
def get_password():
4+
pass
5+
6+
def log_password():
7+
password = get_password()
8+
logging.info("Password '%s'", password)
9+
10+
def get_cert():
11+
pass
12+
13+
def log_cert():
14+
logging.debug("Cert=%s", get_cert())
15+

0 commit comments

Comments
 (0)