Skip to content

Commit ebe259b

Browse files
sentrivanaclaude
andcommitted
ref: Expand scrubbing
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 891bffc commit ebe259b

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

sentry_sdk/integrations/_wsgi_common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"HTTP_SET_COOKIE",
3232
"HTTP_COOKIE",
3333
"HTTP_AUTHORIZATION",
34+
"HTTP_PROXY_AUTHORIZATION",
3435
"HTTP_X_API_KEY",
3536
"HTTP_X_FORWARDED_FOR",
3637
"HTTP_X_REAL_IP",

tests/integrations/fastapi/test_fastapi.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ async def test_original_request_not_scrubbed(
265265
async def _error(request: Request):
266266
logging.critical("Oh no!")
267267
assert request.headers["Authorization"] == "Bearer ohno"
268+
assert request.headers["Proxy-Authorization"] == "Basic ohno"
268269
assert await request.json() == {"password": "secret"}
269270

270271
return {"error": "Oh no!"}
@@ -273,12 +274,18 @@ async def _error(request: Request):
273274

274275
client = TestClient(app)
275276
client.post(
276-
"/error", json={"password": "secret"}, headers={"Authorization": "Bearer ohno"}
277+
"/error",
278+
json={"password": "secret"},
279+
headers={
280+
"Authorization": "Bearer ohno",
281+
"Proxy-Authorization": "Basic ohno",
282+
},
277283
)
278284

279285
event = events[0]
280286
assert event["request"]["data"] == {"password": "[Filtered]"}
281287
assert event["request"]["headers"]["authorization"] == "[Filtered]"
288+
assert event["request"]["headers"]["proxy-authorization"] == "[Filtered]"
282289

283290

284291
def test_response_status_code_ok_in_transaction_context(sentry_init, capture_envelopes):

tests/integrations/flask/test_flask.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,19 +903,26 @@ def index():
903903
logging.critical("oops")
904904
assert request.get_json() == {"password": "ohno"}
905905
assert request.headers["Authorization"] == "Bearer ohno"
906+
assert request.headers["Proxy-Authorization"] == "Basic ohno"
906907
return "ok"
907908

908909
events = capture_events()
909910

910911
client = app.test_client()
911912
client.post(
912-
"/", json={"password": "ohno"}, headers={"Authorization": "Bearer ohno"}
913+
"/",
914+
json={"password": "ohno"},
915+
headers={
916+
"Authorization": "Bearer ohno",
917+
"Proxy-Authorization": "Basic ohno",
918+
},
913919
)
914920

915921
(event,) = events
916922

917923
assert event["request"]["data"]["password"] == "[Filtered]"
918924
assert event["request"]["headers"]["Authorization"] == "[Filtered]"
925+
assert event["request"]["headers"]["Proxy-Authorization"] == "[Filtered]"
919926

920927

921928
def test_response_status_code_ok_in_transaction_context(

tests/integrations/starlette/test_starlette.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,7 @@ def test_original_request_not_scrubbed(sentry_init, capture_events):
954954
async def _error(request):
955955
logging.critical("Oh no!")
956956
assert request.headers["Authorization"] == "Bearer ohno"
957+
assert request.headers["Proxy-Authorization"] == "Basic ohno"
957958
assert await request.json() == {"password": "ohno"}
958959
return starlette.responses.JSONResponse({"status": "Oh no!"})
959960

@@ -967,12 +968,16 @@ async def _error(request):
967968
client.post(
968969
"/error",
969970
json={"password": "ohno"},
970-
headers={"Authorization": "Bearer ohno"},
971+
headers={
972+
"Authorization": "Bearer ohno",
973+
"Proxy-Authorization": "Basic ohno",
974+
},
971975
)
972976

973977
event = events[0]
974978
assert event["request"]["data"] == {"password": "[Filtered]"}
975979
assert event["request"]["headers"]["authorization"] == "[Filtered]"
980+
assert event["request"]["headers"]["proxy-authorization"] == "[Filtered]"
976981

977982

978983
@pytest.mark.skipif(STARLETTE_VERSION < (0, 24), reason="Requires Starlette >= 0.24")

0 commit comments

Comments
 (0)