@@ -35,13 +35,36 @@ def _clear_token_env(monkeypatch):
3535
3636@pytest .mark .parametrize (
3737 "name" ,
38- ["api_token" , "API_TOKEN" , "github_token" , "slack_webhook" , "client_secret" , "password" , "auth_header" , "api_key" ],
38+ [
39+ "api_token" ,
40+ "API_TOKEN" ,
41+ "github_token" ,
42+ "slack_webhook" ,
43+ "client_secret" ,
44+ "password" ,
45+ "auth_header" ,
46+ "api_key" ,
47+ "authorization" ,
48+ "ignore_authorization_token" ,
49+ ],
3950)
4051def test_credential_field_names_are_recognized (name ):
4152 assert is_sensitive_name (name )
4253
4354
44- @pytest .mark .parametrize ("name" , ["repo" , "branch" , "commit_sha" , "target_path" , "scm" , "enable_debug" ])
55+ @pytest .mark .parametrize (
56+ "name" ,
57+ [
58+ "repo" ,
59+ "branch" ,
60+ "commit_sha" ,
61+ "target_path" ,
62+ "scm" ,
63+ "enable_debug" ,
64+ "ignore_authorization" ,
65+ "IGNORE_AUTHORIZATION" ,
66+ ],
67+ )
4568def test_ordinary_field_names_are_not_recognized (name ):
4669 assert not is_sensitive_name (name )
4770
@@ -107,6 +130,15 @@ def test_config_to_redacted_dict_masks_the_api_token():
107130 assert TOKEN not in str (config .to_redacted_dict ())
108131
109132
133+ @pytest .mark .parametrize ("policy" , ["enforce" , "strict" , "off" ])
134+ def test_ignore_authorization_policy_remains_visible_in_config_debug_output (policy ):
135+ config = CliConfig .from_args (["--api-token" , TOKEN , "--repo" , "widgets" , "--ignore-authorization" , policy ])
136+ view = config .to_redacted_dict ()
137+ assert view ["ignore_authorization" ] == policy
138+ assert view ["api_token" ] == REDACTED
139+ assert redact_mapping ({"authorization" : f"Bearer { TOKEN } " })["authorization" ] == REDACTED
140+
141+
110142def test_every_credential_field_on_cliconfig_is_redacted ():
111143 """All credential-named config fields must be masked by the logging view."""
112144 config = CliConfig .from_args (["--api-token" , TOKEN , "--repo" , "widgets" ])
0 commit comments