Skip to content

Commit 412e7cb

Browse files
bump falcon requirement to <5 (#139)
falcon<4 doesn't support Python 3.13. Bump the requirement to allow the latest Python version. Also use the text attribute of responses instead of the deprecated body attribute, and fix an asgi RuntimeError.
1 parent 3409f2a commit 412e7cb

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
trigger_extras = {"PyYAML<7", "lxml>=4.3.1", "mock==3.*"}
1212
aiohttp_extras = {"aiohttp<4"} | trigger_extras
1313
django_extras = {"Django<6"} | trigger_extras
14-
falcon_extras = {"falcon<4", "falcon-multipart==0.2.0"} | trigger_extras
14+
falcon_extras = {"falcon<5", "falcon-multipart==0.2.0"} | trigger_extras
1515
flask_extras = {"Flask<4"} | trigger_extras
1616
fastapi_extras = {
1717
"fastapi<1",

src/vulnpy/falcon/vulnerable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def _set_response(resp, path):
114114
"""
115115
Set the response body and Content-Type
116116
"""
117-
resp.body = get_template(path)
117+
resp.text = get_template(path)
118118
resp.content_type = "text/html"
119119

120120

121121
def _set_xss_response(resp, path, user_input):
122122
template = get_template(path)
123123
template += "<p>XSS: " + user_input + "</p>"
124124

125-
resp.body = template
125+
resp.text = template
126126
resp.content_type = "text/html"

tests/falcon/test_vulnerable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@pytest.fixture(scope="module")
1515
def client():
16-
app = falcon.API()
16+
app = falcon.App()
1717
vulnpy.falcon.add_vulnerable_routes(app)
1818
return testing.TestClient(app)
1919

tests/falcon/test_vulnerable_asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@pytest.fixture(scope="module")
15-
def client():
15+
async def client():
1616
app = falcon.asgi.App()
1717
vulnpy.falcon.add_vulnerable_asgi_routes(app)
1818
return testing.TestClient(app)

0 commit comments

Comments
 (0)