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

Skip to content

Commit 5424666

Browse files
committed
Python: Add test-case to password_in_cookie
1 parent 3ad43f3 commit 5424666

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

python/ql/test/query-tests/Security/CWE-312/CleartextLogging.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
edges
22
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
3+
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
34
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
45
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
56
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
edges
22
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
33
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
4+
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
5+
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
46
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
57
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
68
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
79
#select
810
| password_in_cookie.py:9:33:9:40 | password | 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 | Attribute() | a request parameter containing a password |
11+
| password_in_cookie.py:16:33:16:40 | password | password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password | Sensitive data from $@ is stored here. | password_in_cookie.py:14:16:14:43 | Attribute() | a request parameter containing a password |
912
| test.py:22:20:22:23 | cert | test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key | Sensitive data from $@ is stored here. | test.py:20:12:20:21 | get_cert() | a call returning a certificate or key |

python/ql/test/query-tests/Security/CWE-312/password_in_cookie.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import Flask, make_response, request
1+
from flask import Flask, make_response, request, Response
22

33
app = Flask("Leak password")
44

@@ -8,3 +8,10 @@ def index():
88
resp = make_response(render_template(...))
99
resp.set_cookie("password", password)
1010
return resp
11+
12+
@app.route('/')
13+
def index2():
14+
password = request.args.get("password")
15+
resp = Response(...)
16+
resp.set_cookie("password", password)
17+
return resp

0 commit comments

Comments
 (0)