MCPcopy Create free account
hub / github.com/Codeplain-ai/codeplain / test_local_variables_are_scrubbed

Function test_local_variables_are_scrubbed

tests/test_telemetry.py:124–143  ·  view source on GitHub ↗
(transport)

Source from the content-addressed store, hash-verified

122
123
124def test_local_variables_are_scrubbed(transport):
125 init_with_transport(transport)
126
127 def crash_with_sensitive_locals():
128 api_key = "super-secret-key" # noqa: F841
129 plain_source = "proprietary spec content" # noqa: F841
130 raise KeyError("boom")
131
132 try:
133 crash_with_sensitive_locals()
134 except KeyError:
135 exc_info = sys.exc_info()
136
137 assert capture_crash(exc_info, None, make_args())
138 sentry_sdk.flush(timeout=2)
139
140 frames = transport.events[0]["exception"]["values"][0]["stacktrace"]["frames"]
141 crash_frame_vars = frames[-1]["vars"]
142 assert crash_frame_vars["api_key"] == "[Filtered]"
143 assert crash_frame_vars["plain_source"] == "[Filtered]"
144
145
146def test_request_headers_local_is_scrubbed(transport):

Callers

nothing calls this directly

Calls 4

capture_crashFunction · 0.90
init_with_transportFunction · 0.85
make_argsFunction · 0.85

Tested by

no test coverage detected