Skip to content

Commit da55fc4

Browse files
🐛 Avoid leaking auth credentials for ext. need warnings (#1512)
Changes for [issue #1476](#1476): When a warning is triggered due to unknown keys in external sources, it includes the URL of the source. If the URL contains basic authentication details, those credentials will be exposed in the warning message. FIX is simply to use the existing "clean_log" method to obfuscate the url Co-authored-by: cedric.dos-santos.e <cedric.dos-santos.e@thalesdigital.io>
1 parent 7b19721 commit da55fc4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sphinx_needs/external_needs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ def load_external_needs(
198198
location = source.get("json_url", "") or source.get("json_path", "")
199199
log_warning(
200200
log,
201-
f"External need {ext_need_id!r} in {location!r} could not be added: {err.message}",
201+
clean_log(
202+
f"External need {ext_need_id!r} in {location!r} could not be added: {err.message}"
203+
),
202204
"load_external_need",
203205
location=None,
204206
)
@@ -207,14 +209,18 @@ def load_external_needs(
207209
if unknown_keys:
208210
log_warning(
209211
log,
210-
f"Unknown keys in external need source {source_str!r}: {sorted(unknown_keys)!r}",
212+
clean_log(
213+
f"Unknown keys in external need source {source_str!r}: {sorted(unknown_keys)!r}"
214+
),
211215
"unknown_external_keys",
212216
location=None,
213217
)
214218
if non_string_extra_keys:
215219
log_warning(
216220
log,
217-
f"Non-string values in extra options of external need source {source_str!r}: {sorted(non_string_extra_keys)!r}",
221+
clean_log(
222+
f"Non-string values in extra options of external need source {source_str!r}: {sorted(non_string_extra_keys)!r}"
223+
),
218224
"mistyped_external_values",
219225
location=None,
220226
)

0 commit comments

Comments
 (0)