File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,7 @@ def log_request(handler, record_prometheus_metrics=True):
6262 except AttributeError :
6363 logger = access_log
6464
65- extra_param_keys = []
66- if hasattr (handler , "serverapp" ) and hasattr (handler .serverapp , "extra_log_scrub_param_keys" ):
67- extra_param_keys = handler .serverapp .extra_log_scrub_param_keys
65+ extra_param_keys = handler .settings .get ("extra_log_scrub_param_keys" , [])
6866
6967 if status < 300 or status == 304 :
7068 # Successes (or 304 FOUND) are debug-level
Original file line number Diff line number Diff line change @@ -442,6 +442,7 @@ def init_settings(
442442 "allow_remote_access" : jupyter_app .allow_remote_access ,
443443 "local_hostnames" : jupyter_app .local_hostnames ,
444444 "authenticate_prometheus" : jupyter_app .authenticate_prometheus ,
445+ "extra_log_scrub_param_keys" : jupyter_app .extra_log_scrub_param_keys ,
445446 # managers
446447 "kernel_manager" : kernel_manager ,
447448 "contents_manager" : contents_manager ,
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ def test_log_request_scrubs_sensitive_params_default(server_app_with_default_scr
3131 handler .request .remote_ip = "127.0.0.1"
3232 handler .request .uri = "http://example.com/path?token=secret123&normal=value"
3333 handler .request .request_time .return_value = 0.1
34- handler .serverapp = server_app_with_default_scrub_keys
34+ handler .settings = {
35+ "extra_log_scrub_param_keys" : server_app_with_default_scrub_keys .extra_log_scrub_param_keys
36+ }
3537 handler .log = Mock ()
3638 handler .current_user = None
3739
@@ -55,7 +57,9 @@ def test_log_request_scrubs_sensitive_params_extra(server_app_with_extra_scrub_k
5557 "http://example.com/path?password=secret123&token=default_token&normal=value"
5658 )
5759 handler .request .request_time .return_value = 0.1
58- handler .serverapp = server_app_with_extra_scrub_keys
60+ handler .settings = {
61+ "extra_log_scrub_param_keys" : server_app_with_extra_scrub_keys .extra_log_scrub_param_keys
62+ }
5963 handler .log = Mock ()
6064 handler .current_user = None
6165
You can’t perform that action at this time.
0 commit comments