(transport)
| 122 | |
| 123 | |
| 124 | def 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 | |
| 146 | def test_request_headers_local_is_scrubbed(transport): |
nothing calls this directly
no test coverage detected