You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Meta token refresh that fails writes Meta's raw HTTP response body to the configure log.
_call_refresh_api embeds the whole response body in the exception message:
# mureo/auth.py:532-535ifresp.status_code!=200:
raiseValueError(
f"Meta token refresh failed with status {resp.status_code}: "f"{resp.text}"
)
and refresh_meta_token_if_needed logs that with a full traceback:
# mureo/auth.py:449-453try:
new_token, new_obtained_at=await_call_refresh_api(credentials)
exceptException:
logger.warning("Failed to refresh Meta Ads token", exc_info=True)
returncredentials
resp.text is unbounded content returned by Graph. Until #581 there was no logging handler, so this went nowhere. Now it lands in ~/.mureo/logs/configure.log.
Why it matters
This is the same shape as #603: raw exception text logged via exc_info=True around a token-bearing HTTP call. The outgoing request here is POST-with-body, so mureo's own app_secret / access_token are not in a URL — the exposure is whatever Graph chooses to put in an error body, written verbatim and unbounded to a file on disk.
It is also inconsistent with how the same Graph API is handled elsewhere in the same codebase. mureo/meta_ads/accounts.py scrubs str(exc) and breaks the exception chain with raise ... from None, specifically documenting that an httpx HTTPStatusError embeds the request URL in its __str__. refresh_meta_token_if_needed never received that treatment.
Note this is the same swallowed-failure path #578 was about: the refresh fails silently on every Meta call, and this log line is the only record. So the fix must keep it diagnosable — dropping the line entirely is not the answer.
Suggested direction
Stop interpolating resp.text into the exception message. Log resp.status_code plus a curated field from Graph's JSON error body (error.message / error.code / error_subcode), truncated, rather than the whole body.
Consider whether the AST regression guard added in google_ads logs SDK exceptions with exc_info=True, which prints request metadata #603 (tests/test_google_ads_log_exc_info.py, which sweeps mureo/google_ads/) should be widened to cover mureo/auth.py and the other credential-adjacent modules, so this class of problem cannot come back anywhere.
Provenance
Raised as a MEDIUM finding by the security review of PR #599 (the review that also surfaced #603's HIGH). The HIGH and the directory-permission MEDIUM were fixed in #599 / #604; this one was not, and is tracked here so it is not lost.
What happens
A Meta token refresh that fails writes Meta's raw HTTP response body to the configure log.
_call_refresh_apiembeds the whole response body in the exception message:and
refresh_meta_token_if_neededlogs that with a full traceback:resp.textis unbounded content returned by Graph. Until #581 there was no logging handler, so this went nowhere. Now it lands in~/.mureo/logs/configure.log.Why it matters
This is the same shape as #603: raw exception text logged via
exc_info=Truearound a token-bearing HTTP call. The outgoing request here is POST-with-body, so mureo's ownapp_secret/access_tokenare not in a URL — the exposure is whatever Graph chooses to put in an error body, written verbatim and unbounded to a file on disk.It is also inconsistent with how the same Graph API is handled elsewhere in the same codebase.
mureo/meta_ads/accounts.pyscrubsstr(exc)and breaks the exception chain withraise ... from None, specifically documenting that an httpxHTTPStatusErrorembeds the request URL in its__str__.refresh_meta_token_if_needednever received that treatment.Note this is the same swallowed-failure path #578 was about: the refresh fails silently on every Meta call, and this log line is the only record. So the fix must keep it diagnosable — dropping the line entirely is not the answer.
Suggested direction
resp.textinto the exception message. Logresp.status_codeplus a curated field from Graph's JSON error body (error.message/error.code/error_subcode), truncated, rather than the whole body.exc_info=Trueatauth.py:452in favour of the message text now that it carries the useful part — matching the pattern applied acrossmureo/google_ads/in google_ads logs SDK exceptions with exc_info=True, which prints request metadata #603 and used inmureo/amazon_ads/lwa.pyandmureo/meta_ads/accounts.py.tests/test_google_ads_log_exc_info.py, which sweepsmureo/google_ads/) should be widened to covermureo/auth.pyand the other credential-adjacent modules, so this class of problem cannot come back anywhere.Provenance
Raised as a MEDIUM finding by the security review of PR #599 (the review that also surfaced #603's HIGH). The HIGH and the directory-permission MEDIUM were fixed in #599 / #604; this one was not, and is tracked here so it is not lost.