Skip to content

Commit 6885962

Browse files
committed
When logging API error responses, include request method and payload
This could potentially leak sensitive information into the logs, however we don't use the Nautobot API client to post any sensitive data and API authentication is done via HTTP headers that are not logged.
1 parent 41a92ee commit 6885962

File tree

1 file changed

+6
-2
lines changed
  • python/neutron-understack/neutron_understack

1 file changed

+6
-2
lines changed

python/neutron-understack/neutron_understack/nautobot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class NautobotRequestError(exc.NeutronException):
14-
message = "Nautobot API returned error %(code)s for %(url)s: %(body)s"
14+
message = "Nautobot API ERROR %(code)s for %(url)s %(method)s %(payload)s: %(body)s"
1515

1616

1717
class NautobotOSError(exc.NeutronException):
@@ -68,7 +68,11 @@ def make_api_request(
6868
response_data = response_data.get("error", response_data)
6969

7070
raise NautobotRequestError(
71-
code=response.status_code, url=full_url, body=response_data
71+
code=response.status_code,
72+
url=full_url,
73+
method=method,
74+
payload=payload,
75+
body=response_data,
7276
)
7377

7478
caller_function = inspect.stack()[1].function

0 commit comments

Comments
 (0)