Repository navigation
Conversation
GET /disconnect deleted stored tokens for any uid in the query string. The settings link now carries an HMAC and the handler rejects a missing or wrong signature. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @aryanorastar — this closes a real hole: GET /disconnect previously deleted any user's Twitter tokens from a bare uid, and the signed-link fix matches the pattern already used elsewhere (whoop app, #14454).
Verified per file:
plugins/omi-twitter-chat-tools-app/twitter_link_auth.py— correct construction: stripped-secret lookup, HMAC-SHA256 over the uid,hmac.compare_digestwith an explicit length pre-check, fail-closed 503 whenTWITTER_TOOLS_SECRETis unset and 401 on missing/wrong sig. I exercised the module directly: empty, wrong, truncated, and cross-uid signatures all raise 401; a valid signature passes; the unset secret raises 503.plugins/omi-twitter-chat-tools-app/main.py— the settings page now emits/disconnect?uid=<quoted>&sig=<hmac>(line 1055) and the handler callsrequire_signed_link(uid, sig)beforedelete_twitter_tokens(lines 1273–1280); the redirect now URL-encodes the uid. Good.plugins/omi-twitter-chat-tools-app/test_twitter_link_auth.py— the strongest test is the handler-level one: it patchesdelete_twitter_tokensand proves it is not called until the signature matches. That is exactly the pin this bug class needed..github/checks-manifest.yamland.github/failure-classes/FC-unsigned-disconnect-deletes-tokens.json— the failure-class write-up is accurate and the pinned check is the right idea.plugins/omi-twitter-chat-tools-app/README.md— theTWITTER_TOOLS_SECRETrow is accurate (required; unset fails closed).
One blocking issue — the new check fails in CI as authored. Hygiene fails because twitter-chat-tools-disconnect-auth-tests hits ModuleNotFoundError: No module named 'fastapi' at test_twitter_link_auth.py:12: the ci lane runs a bare python3, and the sibling check in the same lane (test_max_results.py) only passes because it stubs its imports via importlib/ModuleType instead of importing the app's real deps. As written, this PR ships a red required check and the advertised hermetic pin never actually runs in CI. Please make the check lane-hermetic the same way (stub fastapi.HTTPException, or otherwise avoid the hard fastapi import) and push. For clarity, the other Hygiene annotations (main.py at 1399 lines, the 188-line get_omi_tools_manifest) are pre-existing on main and not caused by this diff.
Two residual points I'm flagging for maintainers rather than blocking on: deployments that haven't provisioned TWITTER_TOOLS_SECRET will fail closed on disconnect (503) after this merges — worth a deploy note; and GET /setup/twitter?uid= still trusts a bare uid, which issue #14505 also names and the PR description consciously leaves alone.
Requesting changes solely for the CI check. The auth logic itself is sound. Security sign-off on the deployment semantics of the new required secret is left for maintainer review.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Auth logic is sound (Git-on-my-level verified the HMAC signing/verification directly) and closes a real hole (bare-uid Twitter disconnect). Holding at approve, not merging: independently confirmed the CI-blocking defect Git-on-my-level flagged is still present at head 230a225 -- test_twitter_link_auth.py:12 does 'from fastapi import HTTPException', which will ModuleNotFoundError in the hermetic ci lane the same way the sibling test_max_results.py avoids by stubbing. The advertised pinned check does not actually run.
twitter-chat-tools-disconnect-auth-tests failed in Hygiene with ModuleNotFoundError: No module named 'fastapi' test_twitter_link_auth.py:12 That lane runs a bare python3 with only pyyaml installed, so the required check was red and the hermetic pin it advertises never actually ran. It passed locally only because a developer machine has fastapi installed. Two import sites needed covering, not one: the test's own `from fastapi import HTTPException`, and the same import at module scope in twitter_link_auth.py. The handler-level test additionally imports main.py, which pulls fastapi, fastapi.responses, dotenv, requests, db and models. New plugins/omi-twitter-chat-tools-app/hermetic_stubs.py holds the stubs: - ensure_fastapi() registers a minimal fastapi when it is absent, so modules doing `from fastapi import HTTPException` load. - http_exception() returns the real HTTPException when installed and a stub carrying status_code/detail otherwise, which is what the assertions read. - load_main() imports main.py against stubs *always*, not only when fastapi is missing: a real fastapi validates response models against the stubbed models.ChatToolResponse and rejects it, so stubbing one side only moves the failure rather than removing it. The response stubs are classes rather than str/dict because the disconnect path constructs RedirectResponse(url=...). Verified 5 passed in both environments -- with fastapi installed, and with fastapi, dotenv and requests all hidden to reproduce the lane. Mutation-checked that the security pin still bites: stubbing out the require_signed_link call in main.py fails the suite in both environments, and main.py is unchanged. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Blocking CI item fixed on You were right that the check shipped red and the advertised pin never ran. Two import sites needed covering, not one — the test's own New
I put this in its own helper rather than inlining a second copy of the block in Verified
The pin was mutation-checked so the hermeticity work cannot have hollowed it out: stubbing out the Diff is 7 files, Your two non-blocking points are untouched and still maintainer calls: the |
Summary
GET /disconnecton the Twitter chat-tools app deleted stored tokens for anyuidin the query string.Failure-Class: new
Test plan
python3 plugins/omi-twitter-chat-tools-app/test_twitter_link_auth.py(5 tests: unconfigured, bad signature, matching signature, per-uid, delete not called until the signature matches)GET /setup/twitter?uid=is still the platform setup probe (apps.pyappends?uid=), so this change does not lock that route.Fixes #14505