Repository navigation
fix: stop plugins printing OAuth tokens, API keys, webhook URLs, and transcripts to logs - #13778
Conversation
…n logs OAuth success paths dumped raw provider responses to stdout. The Notion token-exchange body contains the user's fresh access_token; ClickUp logged its full OAuth response; Slack/Hive/Twitter logged token prefixes and the Notion conversation handler printed the stored access token as api_key. Deployed plugin logs are broadly visible, so these secrets were recoverable from log output. Remove the secret-bearing prints entirely; keep status-only diagnostics (HTTP status, token received/missing, token type). Add a hermetic regression test asserting token-exchange and database responses never reach stdout. Verified: python3 plugins/oauth/test_client_log_safety.py (4 tests, 3 fail pre-fix), py_compile on all touched files, slack manifest tests (13 pass). Failure-Class: new
Same defect class across the OAuth surface the first commit missed:
- omi-hive-app: full api_key printed via REST headers dict, plus GraphQL
response bodies and user data dumps in verify_api_key
- token-exchange failure paths (clickup, github, notion-app, whoop,
google-calendar, twitter refresh): raw response.text moved into
exceptions and log lines, then rendered into callback HTML; now
status-code only
- zapier: print({'uid', target_url}) leaked the bearer webhook URL on
subscribe/unsubscribe; print(ok)/print(result) dumped conversation
models; RequestException str(e) embedded the hook URL in the error dict
- hey_omi: OpenAI key suffix print; notification message text and
exception str(e) (URL carries uid+message params) in logs
- omi-twitter-app: transcript segment text, accumulated buffer, and
extracted content prints trimmed to counts/status
- _multion: request payload, API response, and error-body prints removed
- oauth error paths: print status only, not the raw error body
Extend the log-safety test into a static tripwire scanning every touched
plugin file for log calls naming credential variables, response bodies,
webhook URLs, or transcript buffers; add FC-secret-printed-to-plugin-logs.
Verified: python3 plugins/oauth/test_client_log_safety.py (5 tests).
Failure-Class: FC-secret-printed-to-plugin-logs
Same class as the oauth cleanup: raw transcript segments, accumulated text, and extracted trigger content printed verbatim. Trim to counts and presence booleans; composed outgoing messages still logged (they are posted to the destination anyway). Extend the static tripwire to cover both files. Verified: python3 plugins/oauth/test_client_log_safety.py (5 tests). Failure-Class: FC-secret-printed-to-plugin-logs
There was a problem hiding this comment.
🟡 Changes recommended
Critical provider-response and transcript/PII logging paths remain unresolved, along with gaps in the safety checks.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR reduces credential, webhook, provider-response, and transcript data exposure in plugin logs, with added regression checks and failure-class metadata.
Changes:
- Removes direct secret and transcript logging.
- Sanitizes OAuth and HTTP error handling.
- Adds safety tests, CI registration, and a failure-class definition.
File summaries
| File | Review summary |
|---|---|
plugins/zapier/conversation_created.py |
Removes webhook and conversation-model logging. |
plugins/zapier/client.py |
Critical (1 vote): The HTTPError path still builds and prints errors from resp.text(); the same issue appears on line 259. |
plugins/omi-whoop-app/main.py |
Critical (3 votes): whoop_api_request still logs and returns response.text on API errors. |
plugins/omi-twitter-app/twitter_client.py |
Removes token-prefix logging. |
plugins/omi-twitter-app/main_simple.py |
Critical (1 vote): accumulated_text reaches storage that prints update kwargs. Moderate (1 vote): auth_callback still interpolates str(e) into failure HTML. |
plugins/omi-slack-app/slack_client.py |
Removes Slack token-prefix logging. |
plugins/omi-slack-app/main.py |
Critical (1 vote): Transcript text still reaches storage diagnostics. Moderate (1 vote): The timeout path logs message[:50]. |
plugins/omi-notion-app/main.py |
Sanitizes OAuth callback errors. |
plugins/omi-hive-app/main.py |
Critical (3 votes): Provider response text still enters returned errors and is printed by API-key verification and REST-helper paths. |
plugins/omi-google-calendar-app/main.py |
Critical (3 votes): Calendar API errors still log and return response.text. |
plugins/omi-github-app/github_client.py |
Critical (2 votes): Several error paths still log raw provider bodies through error_msg. |
plugins/omi-clickup-app/main.py |
Critical (1 vote): Transcript text still reaches storage diagnostics through update_session. |
plugins/omi-clickup-app/clickup_client.py |
Critical (2 votes): create_task still prints an error built from response.text. |
plugins/oauth/test_client_log_safety.py |
Moderate (1 vote): The hard-coded scan list can omit future plugin files. Moderate (3 votes): The tripwire misses logging wrappers, indirect values, and response text propagated through returned dictionaries. |
plugins/oauth/conversation_created.py |
Removes stored-token and response logging. |
plugins/oauth/client.py |
Critical (1 vote): Returned errors still copy provider messages, and conversation_created.py prints them on error paths; the issue also appears on line 153. |
plugins/notifications/hey_omi.py |
Critical (2 votes): The plugin still logs request data, transcript segments, collected question text, and OpenAI prompt/response content. |
plugins/_multion/router.py |
Sanitizes Multion API error logging. |
.github/failure-classes/FC-secret-printed-to-plugin-logs.json |
Defines the new secret-logging failure class. |
.github/checks-manifest.yaml |
Registers the log-safety check. |
Review details
Suppressed comments (5)
plugins/oauth/client.py:153
- The client now logs only the status, but the returned error still copies the provider's message from
resp_json;plugins/oauth/conversation_created.pyprints that error dict on the callback path. The new test captures the client in isolation, so the real callback can still emit provider response content; sanitize the returned/logged error consistently.
print(f"Error: HTTP_{resp.status_code}")
plugins/oauth/test_client_log_safety.py:127
- The manifest selects this check for every
plugins/omi-*/**change, butSCAN_FILESis a hard-coded list of only the files touched by this PR. A future plugin file can therefore trigger the check without being scanned, allowing a new secret-bearing log to pass; derive the scan set from the plugin tree or scan all plugin files.
SCAN_FILES = [
"plugins/oauth/client.py",
"plugins/oauth/conversation_created.py",
"plugins/omi-clickup-app/clickup_client.py",
plugins/omi-slack-app/main.py:749
- The webhook's direct segment logs are removed, but the timeout-monitor branch still logs
message[:50]when the message is not sent at line 116. That value is extracted from the accumulated transcript and is precisely unsent user content; keep this path status-only too.
print(f" Content extracted: {'yes' if message_content else 'no'}", flush=True)
plugins/omi-twitter-app/main_simple.py:229
- These success logs no longer expose token prefixes, but
auth_callbackstill interpolatesstr(e)into its failure HTML at line 532.fetch_tokenerrors can carry the OAuth provider response, so a failed exchange still exposes response data to the browser; return a fixed error and log only the exception type.
access_status = 'received' if access_token else 'missing'
refresh_status = 'received' if refresh_token else 'missing'
print(f"🔑 Token data received:", flush=True)
print(f" Access token: {access_status}", flush=True)
print(f" Refresh token: {refresh_status}", flush=True)
plugins/zapier/client.py:259
- The changed
RequestExceptionbranch is status-safe, but theHTTPErrorbranch above still builds its error fromresp.text()and then printserr. That leaves provider response content in logs (andResponse.textis a property, not a callable); sanitize this branch too.
"message": f"RequestException {type(e).__name__}",
- Files reviewed: 20/20 changed files
- Comments generated: 12
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| params = {"uid": uid, "message": message} | ||
|
|
||
| logger.info(f"Sending notification to OMI for uid {uid}: {message}") | ||
| logger.info(f"Sending notification to OMI for uid {uid}") |
| if resp.status_code != 200: | ||
| resp_json = resp.json() | ||
| print(f"Error: HTTP_{resp.status_code} {resp_json}") | ||
| print(f"Error: HTTP_{resp.status_code}") |
| } | ||
| else: | ||
| raise Exception(f"Token exchange failed: {response.status_code} - {response.text}") | ||
| raise Exception(f"Token exchange failed: {response.status_code}") |
|
|
||
| print(f"📝 Segment {segments_count}/5: '{full_text}'", flush=True) | ||
| print(f"📚 Full accumulated: '{accumulated[:150]}...'", flush=True) | ||
| print(f"📝 Segment {segments_count}/5 received", flush=True) |
| raise Exception("No access token in token exchange response") | ||
| else: | ||
| raise Exception(f"Token exchange failed: {response.status_code} - {response.text}") | ||
| raise Exception(f"Token exchange failed: {response.status_code}") |
|
|
||
| print(f"📝 Segment {segments_count}/5: '{full_text}'", flush=True) | ||
| print(f"📚 Full accumulated: '{accumulated[:150]}...'", flush=True) | ||
| print(f"📝 Segment {segments_count}/5 received", flush=True) |
|
|
||
| print(f"📝 Segment {segments_count}/3: '{full_text}'", flush=True) | ||
| print(f"📚 Full accumulated: '{accumulated[:150]}...'", flush=True) | ||
| print(f"📝 Segment {segments_count}/3 received", flush=True) |
| return response.json() | ||
| else: | ||
| log(f"Token refresh failed: {response.status_code} - {response.text}") | ||
| log(f"Token refresh failed: {response.status_code}") |
| err = { | ||
| "error": { | ||
| "message": f"RequestException {e}", | ||
| "message": f"RequestException {type(e).__name__}", |
| ] | ||
|
|
||
| def test_no_log_call_emits_secrets_or_response_bodies(self): | ||
| log_line = re.compile(r"(?:print|logger\.(?:info|warning|error|debug))\((.*)") |
There was a problem hiding this comment.
1 issue found across 20 files
Confidence score: 5/5
- In
plugins/zapier/conversation_created.py, removingprint(result)leavesresult = ok["result"]unused; clean up the dead assignment to avoid unnecessary code.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="plugins/zapier/conversation_created.py">
<violation number="1" location="plugins/zapier/conversation_created.py:244">
P3: Removing `print(result)` makes the `result = ok["result"]` assignment dead code. Delete that line too, since nothing reads `result` anymore.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| raise HTTPException(status_code=err["status"] if "status" in err else 500, detail='Can not create memory') | ||
| return | ||
| result = ok["result"] | ||
| print(result) |
There was a problem hiding this comment.
P3: Removing print(result) makes the result = ok["result"] assignment dead code. Delete that line too, since nothing reads result anymore.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/zapier/conversation_created.py, line 244:
<comment>Removing `print(result)` makes the `result = ok["result"]` assignment dead code. Delete that line too, since nothing reads `result` anymore.</comment>
<file context>
@@ -92,7 +92,6 @@ async def subscribe_zapier_trigger(subscriber: ZapierSubcribeModel, uid: str):
if status != "enabled":
raise HTTPException(status_code=401, detail="Unauthorized")
- print({'uid': uid, 'target_url': subscriber.target_url})
store_zapier_subscribes(uid, subscriber.target_url)
return {}
@@ -114,7 +113,6 @@ async def unsubscribe_zapier_trigger(subscriber: ZapierSubcribeModel, uid: str):
if status != "enabled":
</file context>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @ajanraj - this is a genuinely valuable security cleanup, and the direction is right: every changed line strictly reduces what reaches plugin stdout. I ran python3 plugins/oauth/test_client_log_safety.py from the repo root and it passes 5/5, and the hermetic stdout-capture pattern on the Notion token-exchange path is a nice piece of work. The changes requested below are about completeness of the sweep and the new guard's coverage, not the approach.
What's solid, file by file:
plugins/oauth/client.py- success-pathprint(resp.json())gone at all three sites; token-exchange bodies no longer reach stdout.plugins/oauth/conversation_created.py- removing the{'uid', 'api_key', 'database_id'}print is the single most important line in this PR.plugins/notifications/hey_omi.py- OpenAI key-suffix print and exception strings carrying?uid=...&message=are gone.plugins/_multion/router.py- good catch that RequestErrorstr(e)embeds the full URL; type-name-only logging is the right call.plugins/zapier/conversation_created.py-target_url(bearer-capable webhook URLs) prints removed on subscribe/unsubscribe.plugins/omi-slack-app/slack_client.py,plugins/omi-twitter-app/twitter_client.py,plugins/omi-twitter-app/main_simple.py- token-prefix logging replaced with type/presence booleans; the webhook transcript-segment dumps are gone from the three segment-collector apps.
Three things I'd like addressed before merge, all verified on the current head:
-
The new tripwire passes green while its own contract is violated.
test_client_log_safety.py's regex only seesprint(/logger.<level>(on the opening line, but whoop, google-calendar, and notion-app log through a module-localdef log()helper. Inside files already inSCAN_FILES, withresponse.textalready inBANNED_TOKENS:plugins/omi-whoop-app/main.py:150-log(f"Whoop API error: {response.status_code} - {response.text}")plugins/omi-google-calendar-app/main.py:158-log(f"Calendar API error: {response.status_code} - {response.text}")plugins/omi-notion-app/main.py:1115-1117-log(f"OAuth error: {e}")plustraceback.print_exc()
Parsing each file withastand scanning the full span of every log call would also close the multi-line gap (plugins/zapier/conversation_created.py:178already has a multi-lineprint().
-
Check scope vs trigger scope. The manifest trigger covers
plugins/omi-*/**(~30 plugin dirs) butSCAN_FILESscans 17 files. A future change to any of the other ~22 plugins - includingomi-dropbox-app, which your own scope note says still prints user content - selects and passes this check without being scanned. Please derive the scan set from the plugin tree (my preference) or narrow the triggers to match the list. -
The sweep is incomplete in this PR's own touched files:
plugins/omi-hive-app/main.py:100,168,173-response.textstill returned in error dicts and printed downstream via the GraphQL error path.plugins/omi-github-app/github_client.py:192-196,331-335-error_msg = response.json().get("message", response.text)printed and returned.plugins/omi-clickup-app/clickup_client.py:354-create_taskstill builds its error fromresponse.text.plugins/zapier/client.py:182,237- the HTTPError branch still builds errors fromresp.text()and thenprint(err)fires; noteResponse.textis a property, soresp.text()raises when this branch actually executes.plugins/oauth/client.py:122,158,186+plugins/oauth/conversation_created.py:54,72- returned error dicts still copyresp_json["message"], which the callback path re-prints.plugins/notifications/hey_omi.py:173-logger.info(f"Received data: {request.dict()}")logs the full incoming webhook payload (transcripts); also 214/233/274/290 (text,question_part,full_question) and 144/292 (OpenAI responses). These are incoming transcripts, not the composed outgoing messages your carve-out covers, and transcripts are in the PR title.plugins/omi-twitter-app/main_simple.py:532-str(e)still rendered into the failure HTML;fetch_tokenerrors can carry the provider response.plugins/omi-slack-app/main.py:116-message[:50]of unsent transcript content on the insufficient-content path.
Items 1 and 2 matter most: landing the failure-class contract and manifest entry on top of a checker with these blind spots would give future PRs a green light that doesn't mean anything, which is worse than no check. Either sweep the lines above the same way you did their siblings, or narrow the PR's claims to match what's actually enforced.
The core work here is real and welcome - fixing the guard and finishing the sweep should make this an easy merge. Since it changes credential-logging behavior across OAuth flows in a dozen plugins and installs a repo-wide check, it needs maintainer sign-off before merge even after these are addressed.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Second ring found by adversarial review of the first commits: - simple_storage (twitter/slack/clickup): update_session printed kwargs, which carried accumulated_text — transcript content leaked through the storage layer; log only the updated keys - hey_omi: question text, OpenAI prompts/answers, full webhook payload, and buffer contents were logged on every request; keep flow markers and lengths only - API error paths (whoop, google-calendar, notion-app, clickup, hive, github): response.text copied into returned error dicts and logs; return status codes / extracted provider message fields only - composio omi_api, omi_notifications, claude_coder, chatgpt, manual-import: same-class response-body and str(e) leaks (request exception strings embed request URLs carrying uid/message params) The static tripwire now scans every plugins/**/*.py file (not just the files this PR touched) for log calls naming credential variables, response bodies, webhook URLs, transcript buffers, or str(e), and the manifest trigger covers plugins/**/*.py so any plugin change re-runs it. Verified: python3 plugins/oauth/test_client_log_safety.py (5 tests — tripwire scans clean repo-wide), slack/notion/hey_omi suites pass. Failure-Class: FC-secret-printed-to-plugin-logs
|
Addressed the review — the residual leaks were real. Second sweep now covers:
The tripwire now scans all of |
kodjima33
left a comment
There was a problem hiding this comment.
Security fix (stop plugins logging OAuth tokens/credentials/transcripts) — right direction and broadest sweep of the two duplicate PRs for #13777, includes regression test + failure-class + CI guard. Approve only, not merging: independent reviews (cubic 3/5, Git-on-my-level) found multiple still-unresolved critical leaks (whoop/google-calendar/notion/hive/github/clickup response.text, hey_omi transcript logging, twitter auth_callback str(e)) plus blind spots in the new test's tripwire (multiline logs, log() wrapper). Below the 4/5 confidence bar; needs another pass before merge.
- zapier HTTPError branches built errors from resp.text() — a property, so the branch would raise TypeError when reached; now returns HTTP_<status> - notion-app OAuth error path logged the exception and dumped traceback; HTML now returns a generic message - twitter/slack auth callback failure pages rendered str(e) to the user's browser; now a generic message - oauth error-path print(err) emitted the provider message dict on the callback path; prints status only - shipbob and twitter-chat-tools had the same token-endpoint response.text logs the tripwire now catches - tripwire rewritten on ast: covers module-local log() helpers and multi-line call spans, scanning all of plugins/**/*.py Verified: python3 plugins/oauth/test_client_log_safety.py (5 tests, repo-wide AST scan clean). Failure-Class: FC-secret-printed-to-plugin-logs
|
@Git-on-my-level all three items addressed:
Kept intentionally: composed outgoing messages (posted to the destination anyway), Verified: |
…fication prints
- clickup token exchange: params= -> data= so client_secret/code stay out of
the URL; transport errors re-raise as type name only (matches github_client)
- clickup/slack/twitter webhook handlers: response_message no longer printed
(carries AI-extracted speech); status/length logged instead
- twitter_client.post_tweet: drop traceback.print_exc and str(e) returns
- clickup client: sanitize remaining {e} prints and traceback dumps
- tripwire: ban response_message/cleaned_content in log calls
Failure-Class: FC-secret-printed-to-plugin-logs
|
Cross-checked the review on the parallel PR for this issue and closed the same two residuals on this head:
Also sanitized the remaining |
Dismissing this automated changes-requested review: all three concerns (AST-blind tripwire, scan-vs-trigger scope mismatch, and the named residual response.text/str(e) leak sites in whoop/gcal/notion/hive/github/clickup/zapier/twitter/slack/hey_omi) are verified resolved on head ab06d02 — the rewritten AST tripwire passes 5/5 with zero hits tree-wide and each cited line was re-checked against the head files.
|
Follow-up verification on ab06d02 — all three items from the earlier review are confirmed resolved, checked against the tree at this head:
Three additive notes, none blocking:
Thanks @ajanraj — rewriting the checker on AST after its blind spots were pointed out, then sweeping the six sites it immediately caught, is exactly the right loop. This removes a real credential-exposure class from the plugin fleet. Since it rewrites credential-adjacent logging across a dozen OAuth flows, final merge sign-off on this head belongs to a human maintainer; the items above are non-blocking follow-ups. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Legitimate security-hardening fix, not an abuse signal: removes prints/logs of OAuth token-exchange bodies, stored access tokens, API key fragments, webhook bearer URLs, and raw transcript text across ~30 plugin files — no new credential handling added, no auth checks weakened, doesn't touch backend/auth/. Adds a hermetic stdout-capture test plus a static tripwire scanning plugins/**/*.py for credential-bearing log calls, registered in checks-manifest.yaml. fixes #13777, CI green. Large diff (528 lines/31 files) but mechanical/systematic in nature.
Fixes #13777
Summary
Plugin code prints credentials and user data to stdout, and plugin stdout lands in broadly visible deployment logs.
plugins/oauth/client.py,plugins/oauth/conversation_created.py); that body contains the user's freshaccess_token. Token-exchange/refresh failure paths in ClickUp, GitHub, Notion, Whoop, Google Calendar, and Twitter embedded rawresponse.textin exceptions and log lines; several are rendered into the OAuth callback HTML returned to the user's browser.conversation_created.pyprinted the stored Notionaccess_tokenalongsideuid; Slack logged user-token prefixes; Hive logged an API-key prefix on one line and the fullapi_keyinside aheadersdict a few lines later.plugins/zapierprintedtarget_urlon subscribe/unsubscribe, dumpedConversationmodels viaprint(ok)/print(result), andRequestExceptionstr(e)embedded the full hook URL in returned error dicts.simple_storage.update_session, which printed all update kwargs;hey_omilogged the full webhook payload, question text, OpenAI prompts/answers, the OpenAI key suffix, and exception strings whose URLs carry?uid=...&message=<user text>.whoop,google-calendar,notion-app,clickup,hive, andgithubcopiedresponse.textinto returned{"error": ...}dicts that callers print or render.composio,omi_notifications,claude_coder,chatgpt, andmanual-importhad the same response-body/str(e)leaks.Fix
Remove secret-bearing prints and sanitize error paths to status codes, presence booleans (
received/missing), extracted provider message fields (e.g. GitHub'smessage), and exception type names. Composed outgoing messages (tweets, Slack messages) remain logged because that content is posted to the destination anyway. No functional behavior changes.Guard
New hermetic check
plugin-oauth-client-log-safety-tests(registered in.github/checks-manifest.yaml):requests, drives the Notion token-exchange/database success paths, asserts token and response content never reach stdout, asserts error path logs status only. Three of these assertions fail on the pre-fix code.plugins/**/*.pyfile for log calls naming credential variables, response bodies, webhook URLs, transcript buffers, orstr(e)(request exception strings embed URLs). Manifest trigger coversplugins/**/*.py, so any plugin change re-runs it. It caught four additional real leaks during development.New failure class
FC-secret-printed-to-plugin-logsdefinition included.Verification
python3 plugins/oauth/test_client_log_safety.py: 5 tests pass (3 fail pre-fix); tripwire scans clean across the whole plugin treepython3 plugins/omi-slack-app/test_slack_search.py/test_segments.py: 13 passpython3 plugins/omi-notion-app/test_main.py: 19 passpython3 plugins/notifications/test_hey_omi_extraction.py: passpython3 -m py_compileon all touched filesmake preflight+scripts/failure-class validate: cleanplugins/omi-github-app/test_github_client.pynot run locally:requestsnot installed in this env (pre-existing; test stubsrequestspost-import, runs in CI)Failure-Class: new