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

Skip to content

Commit b69977b

Browse files
committed
Python: FastAPI: Ignore scheme as tainted
reasoning highlighted in the comment
1 parent bd8eec8 commit b69977b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

python/ql/test/library-tests/frameworks/fastapi/taint_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ async def websocket_test(websocket: WebSocket):
113113

114114
websocket.url, # $ MISSING: tainted
115115

116-
websocket.url.scheme, # $ MISSING: tainted
117116
websocket.url.netloc, # $ MISSING: tainted
118117
websocket.url.path, # $ MISSING: tainted
119118
websocket.url.query, # $ MISSING: tainted
@@ -124,7 +123,6 @@ async def websocket_test(websocket: WebSocket):
124123
websocket.url.port, # $ MISSING: tainted
125124

126125
websocket.url.components, # $ MISSING: tainted
127-
websocket.url.components.scheme, # $ MISSING: tainted
128126
websocket.url.components.netloc, # $ MISSING: tainted
129127
websocket.url.components.path, # $ MISSING: tainted
130128
websocket.url.components.query, # $ MISSING: tainted
@@ -149,6 +147,12 @@ async def websocket_test(websocket: WebSocket):
149147
await websocket.receive_json(), # $ MISSING: tainted
150148
)
151149

150+
# scheme seems very unlikely to give interesting results, but very likely to give FPs.
151+
ensure_not_tainted(
152+
websocket.url.scheme,
153+
websocket.url.components.scheme,
154+
)
155+
152156
async for data in websocket.iter_bytes():
153157
ensure_tainted(data) # $ MISSING: tainted
154158

0 commit comments

Comments
 (0)