Skip to content

Commit b7a2d2a

Browse files
authored
chore(iast): fix iast multiprocess issues and add mcp streaming tests (#15141)
### Summary This PR addresses a IAST stability issues in multiprocess contexts and adds comprehensive validation for streaming request handling with MCP (Model Context Protocol) servers ### Main Changes - **IAST Disabled in Subprocesses:** When an active request runs in a subprocess with open socket connections (e.g., streaming endpoints), IAST experienced memory corruption and segmentation faults - **Improved Code Injection Detection:** Enhanced retrieval of globals and locals in the `eval()` function wrapper - **MCP Server Streaming Validation:** Added comprehensive test suite for MCP servers (Model Context Protocol) with FastAPI. Validated IAST functionality with: - HTTP/SSE (Server-Sent Events) bidirectional streaming - In-memory MCP connections - Multiple concurrent streaming operations - Header tainting through streaming requests - Vulnerability detection (CMDI) during streaming ### Fixes - **Streaming Request Safety**: Validates IAST handles streaming responses without crashes - **MCP Protocol Support**: Full test coverage for MCP servers (critical for AI/LLM applications) - **Subprocess Stability**: Prevents memory corruption in subprocess contexts - **Better Code Injection Detection**: Enhanced eval() wrapper for improved vulnerability detection
1 parent fd9e58b commit b7a2d2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2497
-1249
lines changed

.riot/requirements/1021fa1.txt

Lines changed: 0 additions & 43 deletions
This file was deleted.

.riot/requirements/19fed8a.txt renamed to .riot/requirements/10f75ab.txt

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,52 @@
22
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --cert=None --client-cert=None --index-url=None --no-annotate --pip-args=None .riot/requirements/19fed8a.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/10f75ab.in
66
#
77
annotated-types==0.7.0
88
anyio==4.11.0
9-
attrs==25.3.0
10-
certifi==2025.8.3
11-
charset-normalizer==3.4.3
9+
attrs==25.4.0
10+
certifi==2025.10.5
11+
cffi==2.0.0
12+
charset-normalizer==3.4.4
1213
click==8.3.0
13-
coverage[toml]==7.10.7
14+
coverage[toml]==7.11.0
15+
cryptography==46.0.3
1416
fastapi==0.114.2
1517
h11==0.16.0
1618
httpcore==1.0.9
1719
httpx==0.27.2
20+
httpx-sse==0.4.3
1821
hypothesis==6.45.0
19-
idna==3.10
20-
iniconfig==2.1.0
22+
idna==3.11
23+
iniconfig==2.3.0
2124
jinja2==3.1.6
25+
jsonschema==4.25.1
26+
jsonschema-specifications==2025.9.1
2227
markupsafe==3.0.3
28+
mcp==1.20.0
2329
mock==5.2.0
2430
opentracing==2.4.0
2531
packaging==25.0
2632
pluggy==1.6.0
27-
pydantic==2.11.9
28-
pydantic-core==2.33.2
33+
pycparser==2.23
34+
pydantic==2.12.4
35+
pydantic-core==2.41.5
36+
pydantic-settings==2.11.0
2937
pygments==2.19.2
38+
pyjwt[crypto]==2.10.1
3039
pytest==8.4.2
40+
pytest-asyncio==1.2.0
3141
pytest-cov==7.0.0
3242
pytest-mock==3.15.1
43+
python-dotenv==1.2.1
3344
python-multipart==0.0.20
45+
referencing==0.37.0
3446
requests==2.32.5
47+
rpds-py==0.28.0
3548
sniffio==1.3.1
3649
sortedcontainers==2.4.0
50+
sse-starlette==3.0.3
3751
starlette==0.38.6
3852
typing-extensions==4.15.0
3953
typing-inspection==0.4.2

.riot/requirements/1828fcc.txt renamed to .riot/requirements/1235f1e.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# This file is autogenerated by pip-compile with Python 3.9
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1828fcc.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1235f1e.in
66
#
77
anyio==3.7.1
8-
attrs==25.3.0
9-
certifi==2025.8.3
10-
charset-normalizer==3.4.3
8+
attrs==25.4.0
9+
backports-asyncio-runner==1.2.0
10+
certifi==2025.10.5
11+
charset-normalizer==3.4.4
1112
click==8.1.8
1213
coverage[toml]==7.10.7
1314
exceptiongroup==1.3.0
@@ -16,7 +17,7 @@ h11==0.16.0
1617
httpcore==1.0.9
1718
httpx==0.27.2
1819
hypothesis==6.45.0
19-
idna==3.10
20+
idna==3.11
2021
iniconfig==2.1.0
2122
jinja2==3.1.6
2223
markupsafe==3.0.3
@@ -27,14 +28,15 @@ pluggy==1.6.0
2728
pydantic==1.10.24
2829
pygments==2.19.2
2930
pytest==8.4.2
31+
pytest-asyncio==1.2.0
3032
pytest-cov==7.0.0
3133
pytest-mock==3.15.1
3234
python-multipart==0.0.20
3335
requests==2.32.5
3436
sniffio==1.3.1
3537
sortedcontainers==2.4.0
3638
starlette==0.20.4
37-
tomli==2.2.1
39+
tomli==2.3.0
3840
typing-extensions==4.15.0
3941
urllib3==2.5.0
4042
uvicorn==0.33.0

.riot/requirements/1489f78.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1489f78.in
6+
#
7+
annotated-doc==0.0.3
8+
annotated-types==0.7.0
9+
anyio==4.11.0
10+
attrs==25.4.0
11+
certifi==2025.10.5
12+
cffi==2.0.0
13+
charset-normalizer==3.4.4
14+
click==8.3.0
15+
coverage[toml]==7.11.0
16+
cryptography==46.0.3
17+
fastapi==0.121.0
18+
h11==0.16.0
19+
httpcore==1.0.9
20+
httpx==0.27.2
21+
httpx-sse==0.4.3
22+
hypothesis==6.45.0
23+
idna==3.11
24+
iniconfig==2.3.0
25+
jinja2==3.1.6
26+
jsonschema==4.25.1
27+
jsonschema-specifications==2025.9.1
28+
markupsafe==3.0.3
29+
mcp==1.20.0
30+
mock==5.2.0
31+
opentracing==2.4.0
32+
packaging==25.0
33+
pluggy==1.6.0
34+
pycparser==2.23
35+
pydantic==2.12.4
36+
pydantic-core==2.41.5
37+
pydantic-settings==2.11.0
38+
pygments==2.19.2
39+
pyjwt[crypto]==2.10.1
40+
pytest==8.4.2
41+
pytest-asyncio==1.2.0
42+
pytest-cov==7.0.0
43+
pytest-mock==3.15.1
44+
python-dotenv==1.2.1
45+
python-multipart==0.0.20
46+
referencing==0.37.0
47+
requests==2.32.5
48+
rpds-py==0.28.0
49+
sniffio==1.3.1
50+
sortedcontainers==2.4.0
51+
sse-starlette==3.0.3
52+
starlette==0.49.3
53+
typing-extensions==4.15.0
54+
typing-inspection==0.4.2
55+
urllib3==2.5.0
56+
uvicorn==0.33.0

.riot/requirements/1554154.txt

Lines changed: 0 additions & 41 deletions
This file was deleted.

.riot/requirements/2c0f966.txt renamed to .riot/requirements/18474a9.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# This file is autogenerated by pip-compile with Python 3.8
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --no-annotate .riot/requirements/2c0f966.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/18474a9.in
66
#
77
anyio==3.7.1
88
attrs==25.3.0
9-
certifi==2025.8.3
10-
charset-normalizer==3.4.3
9+
certifi==2025.10.5
10+
charset-normalizer==3.4.4
1111
click==8.1.8
1212
coverage[toml]==7.6.1
1313
exceptiongroup==1.3.0
@@ -16,7 +16,7 @@ h11==0.16.0
1616
httpcore==1.0.9
1717
httpx==0.27.2
1818
hypothesis==6.45.0
19-
idna==3.10
19+
idna==3.11
2020
iniconfig==2.1.0
2121
jinja2==3.1.6
2222
markupsafe==2.1.5
@@ -26,14 +26,15 @@ packaging==25.0
2626
pluggy==1.5.0
2727
pydantic==1.10.24
2828
pytest==8.3.5
29+
pytest-asyncio==0.24.0
2930
pytest-cov==5.0.0
3031
pytest-mock==3.14.1
3132
python-multipart==0.0.20
3233
requests==2.32.4
3334
sniffio==1.3.1
3435
sortedcontainers==2.4.0
3536
starlette==0.20.4
36-
tomli==2.2.1
37+
tomli==2.3.0
3738
typing-extensions==4.13.2
3839
urllib3==2.2.3
3940
uvicorn==0.33.0

.riot/requirements/1a0cd9b.txt renamed to .riot/requirements/196a8f0.txt

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,52 @@
22
# This file is autogenerated by pip-compile with Python 3.13
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --cert=None --client-cert=None --index-url=None --no-annotate --pip-args=None .riot/requirements/1a0cd9b.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/196a8f0.in
66
#
77
annotated-types==0.7.0
88
anyio==4.11.0
9-
attrs==25.3.0
10-
certifi==2025.8.3
11-
charset-normalizer==3.4.3
9+
attrs==25.4.0
10+
certifi==2025.10.5
11+
cffi==2.0.0
12+
charset-normalizer==3.4.4
1213
click==8.3.0
13-
coverage[toml]==7.10.7
14+
coverage[toml]==7.11.0
15+
cryptography==46.0.3
1416
fastapi==0.114.2
1517
h11==0.16.0
1618
httpcore==1.0.9
1719
httpx==0.27.2
20+
httpx-sse==0.4.3
1821
hypothesis==6.45.0
19-
idna==3.10
20-
iniconfig==2.1.0
22+
idna==3.11
23+
iniconfig==2.3.0
2124
jinja2==3.1.6
25+
jsonschema==4.25.1
26+
jsonschema-specifications==2025.9.1
2227
markupsafe==3.0.3
28+
mcp==1.20.0
2329
mock==5.2.0
2430
opentracing==2.4.0
2531
packaging==25.0
2632
pluggy==1.6.0
27-
pydantic==2.11.9
28-
pydantic-core==2.33.2
33+
pycparser==2.23
34+
pydantic==2.12.4
35+
pydantic-core==2.41.5
36+
pydantic-settings==2.11.0
2937
pygments==2.19.2
38+
pyjwt[crypto]==2.10.1
3039
pytest==8.4.2
40+
pytest-asyncio==1.2.0
3141
pytest-cov==7.0.0
3242
pytest-mock==3.15.1
43+
python-dotenv==1.2.1
3344
python-multipart==0.0.20
45+
referencing==0.37.0
3446
requests==2.32.5
47+
rpds-py==0.28.0
3548
sniffio==1.3.1
3649
sortedcontainers==2.4.0
50+
sse-starlette==3.0.3
3751
starlette==0.38.6
3852
typing-extensions==4.15.0
3953
typing-inspection==0.4.2

.riot/requirements/a0d16bc.txt renamed to .riot/requirements/197fd3a.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --cert=None --client-cert=None --index-url=None --no-annotate --pip-args=None .riot/requirements/a0d16bc.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/197fd3a.in
66
#
77
anyio==4.11.0
8-
attrs==25.3.0
9-
certifi==2025.8.3
10-
charset-normalizer==3.4.3
8+
attrs==25.4.0
9+
certifi==2025.10.5
10+
charset-normalizer==3.4.4
1111
click==8.3.0
12-
coverage[toml]==7.10.7
12+
coverage[toml]==7.11.0
1313
fastapi==0.94.1
1414
h11==0.16.0
1515
httpcore==1.0.9
1616
httpx==0.27.2
1717
hypothesis==6.45.0
18-
idna==3.10
19-
iniconfig==2.1.0
18+
idna==3.11
19+
iniconfig==2.3.0
2020
jinja2==3.1.6
2121
markupsafe==3.0.3
2222
mock==5.2.0
@@ -26,6 +26,7 @@ pluggy==1.6.0
2626
pydantic==1.10.24
2727
pygments==2.19.2
2828
pytest==8.4.2
29+
pytest-asyncio==1.2.0
2930
pytest-cov==7.0.0
3031
pytest-mock==3.15.1
3132
python-multipart==0.0.20

0 commit comments

Comments
 (0)