Mask tenant script key in fetch logs and error messages - #15
Merged
Merged
Conversation
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1790601174-mask-script-key
branch
from
September 28, 2026 13:29
798759b to
9f0587b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #14.
The key still goes over the wire unchanged (
build_script_urlis untouched, sorequests.getgets the real URL) — only what we print is scrubbed. Two new helpers onFetchService:get_superoffice_datanow logsmask_key(script_url, ...)and routes every error return throughfail(), instead ofprint(error); return None, error. Masking the whole error string (not just the URL we build) also covers the requests exceptions, which embed the full request URL — e.g.ConnectionError: Max retries exceeded with url: ...&key=<secret>...leaked the key too, not just the invalid-JSON message the issue names.Out of scope, flag if you want it changed:
crmfetch showstill prints the key in its details table, which looks deliberate.Verification
python -m pytest tests -q→ 87 passed. New tests cover: key absent from the invalid-JSON error, from a connection error containing the URL, and from--verbosestdout; plus a test that the real key is still sent torequests.get.pip install .,crmfetch --helpworks andtkinteris not imported.--verboseendpoint log printedkey=***, and grepping the whole CLI output for the real key value returned 0 hits.Not verified against SOD: the error paths (invalid JSON, connection/SSL/HTTP failures) — the tenant responded normally, so those were only exercised against a local stub endpoint and in unit tests.
Link to Devin session: https://app.devin.ai/sessions/6daa0b67c92f45619f580de2a1e3c212
Open in Devin Desktop: https://app.devin.ai/desktop/session/6daa0b67c92f45619f580de2a1e3c212?variant=devin
Requested by: @ehs5