Repository navigation
fix(dropbox-app): prevent internal exception text from leaking into HTTP and chat tool responses - #15497
fix(dropbox-app): prevent internal exception text from leaking into HTTP and chat tool responses#15497Evos09 wants to merge 2 commits into
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Security hardening verified working; one blocking test-harness regression.
plugins/omi-dropbox-app/main.py - the production changes check out. Every client-facing error path now returns generic text: /auth/dropbox raises HTTPException(status_code=500, detail="OAuth initialization failed"), the callback returns plain Token exchange failed (400) / Error during authorization (500), the three /tools/* handlers return generic "Failed to ..." error dicts, and /audio returns "Failed to process audio". A sweep of the file finds no remaining {e} / {error} / response.text interpolation into responses, while the new print(...) lines keep the details in server logs for operators. Correct approach.
Blocking: the test changes break the repo's deterministic check lane. .github/checks-manifest.yaml checks run in a Python-stdlib-only environment (repo-checks.yml: "These manifest checks consume only Python stdlib + Git; do not install code-test tools"). The previous test_token_refresh_and_tools.py handled that by stubbing tenacity (identity_retry) and importing dropbox_client inside the patch.dict(sys.modules, stubs) window. This PR removes the tenacity stub and moves from dropbox_client import DropboxClient outside that window, so both test_token_refresh_and_tools.py (a check that is green on main today) and the new test_error_handling.py now fail at import with ModuleNotFoundError: No module named 'tenacity' in that environment (main.py:34 -> dropbox_client.py:9). Reproduced in a clean stdlib container: base test passes, both head tests fail. The "6/6 passing" verification in the PR description only holds where requests/tenacity are installed.
Fix (mechanical): in both test files, either restore a tenacity stub module and import dropbox_client inside the stubbed window as before, or add a dropbox_client stub to stubs the way db and models are stubbed (simplest for test_error_handling.py, which only needs a patchable DropboxClient). The patch.object(dropbox_main.DropboxClient, ...) rename is fine - same class object; only the import placement matters.
Two notes:
- Dropping
response.textfrom the callback 400 also removes the failure reason visible to end users (expired code vs denied). Keeping it server-side is the right call for a security fix - just flagging the support/UX trade-off. .github/checks-manifest.yamlentry itself is well-formed (id/command/triggers/lanes/reason match the existing schema and the command path exists).
Once hermetic execution is restored so both manifest checks pass stdlib-only, this is in good shape - the sanitization itself is verified. Leaving the OAuth error-path behavior for maintainer sign-off.
🤖 Automated review on behalf of the maintainers.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Dropbox on main still returns search, list, and read errors as — Astar, on behalf of @aryanorastar |
0c07ce6 to
7be8ef7
Compare
…TTP and chat tool responses - Sanitize exception text across /auth/dropbox, /auth/dropbox/callback, /tools/search, /tools/list, /tools/read, and /audio endpoints - Ensure raw tracebacks, internal URLs, network sockets, and host paths are logged server-side rather than bubbled to caller - Fix import stubs in test_token_refresh_and_tools.py to properly support requests.exceptions and requests.Response - Add hermetic test_error_handling.py test suite covering 11 error isolation and sanitization scenarios - Register dropbox-error-handling-tests in .github/checks-manifest.yaml
7be8ef7 to
18694e2
Compare
|
@Git-on-my-level Updated in
|
aryanorastar
left a comment
There was a problem hiding this comment.
Reviewed 18694e2.
plugins/omi-dropbox-app/main.py still returns str(e) from PDF read, generic read, and the audio status path (Error reading PDF, Read error, message: str(e)). Mask those three as well.
…ging in PDF read, generic read, and audio status
|
@aryanorastar Verified and updated in commit
|
aryanorastar
left a comment
There was a problem hiding this comment.
Dropbox search, list, read, audio, and the OAuth HTML path still return str(e) or response.text. This head replaces those client strings. Tests load main.py and assert the secret is absent. Hygiene passed on 72022d3b61af.
Dismissing this stale automated CHANGES_REQUESTED (was against commit 0c07ce6): its sole blocking concern — the test-harness regression in plugins/omi-dropbox-app/test_token_refresh_and_tools.py (missing requests.exceptions / requests.Response stubs) — is resolved on the current head 72022d3. Both dropbox-app test suites were re-run hermetically against 72022d3 and pass (11/11 error-handling tests, 6/6 token-refresh/tool tests). A human maintainer has also approved this head.
|
Follow-up verification on head 72022d3 — the blocking concern from the earlier automated review is resolved, and the remediation checks out end to end. Verified per file:
Both suites were also re-executed in an isolated no-network container against this head: 11/11 and 6/6 pass. CI is green on this head, and a maintainer has approved it. This is a genuine security improvement — raw exception text, internal paths, and upstream response bodies no longer leak into HTTP or chat-tool responses. Thanks @Evos09 for the careful remediation and the thorough test coverage. Positive signal from the automated review; the final merge call stays with the maintainers given the OAuth-touching surface. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Verified this end to end — thanks for a clean, focused hardening pass. File-by-file:
One non-blocking thought: since logs now record only the exception class name (e.g. This head already carries a maintainer approval; the by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Closing and withdrawing this pull request. Our prior 7 merged contributions totaling $350 (Support Tickets #141289328 / #141291126) remain unpaid by BasedHardware. We are freezing all pending contributions. |
|
Hey @Evos09 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
Remediates sensitive exception leakage across HTTP and Chat-Tool response boundaries in
plugins/omi-dropbox-app:/auth/dropbox): Encapsulates state generation and storage in a protected execution block. Unexpected exceptions raiseHTTPException(status_code=500, detail="OAuth initialization failed")instead of leaking internal state store or database errors./auth/dropbox/callback): Replaced rawresponse.textreflection on token exchange failure with a generic safe responseToken exchange failed(HTTP 400). Sanitized unexpected exceptions in OAuth callback from raw HTMLError during authorization: {str(e)}to safe genericError during authorization(HTTP 500)./tools/search: Replaced raw{str(e)}with safe error response{"error": "Failed to search files due to an internal error."}and sanitized client errors to{"error": "Failed to search files."}./tools/list: Replaced raw{str(e)}with safe error response{"error": "Failed to list folder contents due to an internal error."}and sanitized client errors to{"error": "Failed to list folder contents."}./tools/read: Replaced raw{str(e)}with safe error response{"error": "Failed to read file due to an internal error."}, sanitized client download errors to{"error": "Failed to download file."}, and sanitized PDF text extraction failures to{"error": "Failed to extract text from PDF."}./audio): Replaced rawmessage: str(e)reflection with{"status": "error", "message": "Failed to process audio"}.plugins/omi-dropbox-app/test_token_refresh_and_tools.pyframework stubs to supply missingrequests.exceptionsandrequests.Responseattributes, and updated mock targets to ensure 100% test passage (6/6 passing).test_error_handling.pycovering 11 error isolation and sanitization scenarios with sensitive trace injection assertions, registered in.github/checks-manifest.yaml.Verification
python -m unittest plugins/omi-dropbox-app/test_error_handling.py: 11/11 passing.python -m unittest plugins/omi-dropbox-app/test_token_refresh_and_tools.py: 6/6 passing.Failure-Class: none
Bounty Payout Destination (EVM - Base Mainnet):
0x7badCdA295Dd7113f374aEA1008e7d5870D48556