-
Notifications
You must be signed in to change notification settings - Fork 2k
Python: Add Server-side Request Forgery sinks #8275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b23e28a
add Server-side Request Forgery sinks
haby0 be40b54
add test
haby0 40feb1f
Python: SPURIOUS results for httpx
RasmusWL 56901ea
Python: Make new SSRF sink modules private
RasmusWL 7d6d8be
Python: Fix httpx modeling
RasmusWL c65839b
Python: improve urllib3 modeling
RasmusWL 02a97b0
Python: Move `urllib` and `urllib2` to be part of stdlib modeling
RasmusWL 866e615
Python: Add PyPI links in qldocs
RasmusWL 75bc532
Python: Avoid `toString` usage :O
RasmusWL d86284b
Python: Update frameworks.rst
RasmusWL e47f726
Python: Add change-note
RasmusWL f620e25
Merge branch 'main' into py/add-ssrf-sinks
RasmusWL 7e6666b
Merge branch 'main' into py/add-ssrf-sinks
haby0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add test
- Loading branch information
commit be40b54b9fd02b674504a0e92f50c34d30ee60d0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
python/ql/test/library-tests/frameworks/aiohttp/client_request.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import aiohttp | ||
| import asyncio | ||
|
|
||
| s = aiohttp.ClientSession() | ||
| resp = s.request("method", "url") # $ clientRequestUrlPart="url" | ||
| resp = s.request("method", url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| with aiohttp.ClientSession() as session: | ||
| resp = session.get("url") # $ clientRequestUrlPart="url" | ||
| resp = session.request(method="GET", url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| # other methods than GET | ||
| s = aiohttp.ClientSession() | ||
| resp = s.post("url") # $ clientRequestUrlPart="url" | ||
| resp = s.patch("url") # $ clientRequestUrlPart="url" | ||
| resp = s.options("url") # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/httpx/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import httpx | ||
|
|
||
| httpx.get("url") # $ clientRequestUrlPart="url" | ||
| httpx.post("url") # $ clientRequestUrlPart="url" | ||
| httpx.patch("url") # $ clientRequestUrlPart="url" | ||
| httpx.options("url") # $ clientRequestUrlPart="url" | ||
| httpx.request("method", url="url") # $ clientRequestUrlPart="url" | ||
| httpx.stream("method", url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| client = httpx.Client() | ||
| response = client.get("url") # $ clientRequestUrlPart="url" | ||
| response = client.post("url") # $ clientRequestUrlPart="url" | ||
| response = client.patch("url") # $ clientRequestUrlPart="url" | ||
| response = client.options("url") # $ clientRequestUrlPart="url" | ||
| response = client.request("method", url="url") # $ clientRequestUrlPart="url" | ||
| response = client.stream("method", url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| client = httpx.AsyncClient() | ||
| response = client.get("url") # $ clientRequestUrlPart="url" | ||
| response = client.post("url") # $ clientRequestUrlPart="url" | ||
| response = client.patch("url") # $ clientRequestUrlPart="url" | ||
| response = client.options("url") # $ clientRequestUrlPart="url" | ||
| response = client.request("method", url="url") # $ clientRequestUrlPart="url" | ||
| response = client.stream("method", url="url") # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/libtaxii/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from libtaxii.common import parse | ||
|
|
||
| result = parse("url", allow_url=True) # $ clientRequestUrlPart="url" | ||
| result = parse(s="url", allow_url=True) # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/pycurl/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import pycurl | ||
|
|
||
| c = pycurl.Curl() | ||
| c.setopt(pycurl.URL, "url") # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/urllib/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from urllib.request import Request, urlopen | ||
|
|
||
| Request("url") # $ clientRequestUrlPart="url" | ||
| Request(url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| urlopen("url") # $ clientRequestUrlPart="url" | ||
| urlopen(url="url") # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/urllib2/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import urllib2 | ||
|
|
||
| resp = urllib2.Request("url") # $ clientRequestUrlPart="url" | ||
| resp = urllib2.Request(url="url") # $ clientRequestUrlPart="url" | ||
|
|
||
| resp = urllib2.urlopen("url") # $ clientRequestUrlPart="url" | ||
| resp = urllib2.urlopen(url="url") # $ clientRequestUrlPart="url" |
Empty file.
2 changes: 2 additions & 0 deletions
2
python/ql/test/library-tests/frameworks/urllib3/ConceptsTest.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import python | ||
| import experimental.meta.ConceptsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import urllib3 | ||
|
|
||
| http = urllib3.PoolManager() | ||
|
|
||
| resp = http.request("method", "url") # $ clientRequestUrlPart="url" | ||
| resp = http.request("method", url="url") # $ clientRequestUrlPart="url" | ||
| resp = http.urlopen("method", "url") # $ clientRequestUrlPart="url" | ||
| resp = http.urlopen("method", url="url") # $ clientRequestUrlPart="url" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.