Repository navigation
fix(plugins): sign twitter /disconnect links, verify on the endpoint - #14519
hridaya423 wants to merge 3 commits into
Conversation
All ten chat-tool routes took uid from the JSON body and acted with the stored Twitter OAuth token — post_tweet/like/retweet/delete write as the victim, timeline/mentions/profile read as the victim — with no caller authentication. Same defect class as zapier (BasedHardware#14428) and the paid mentor fix; this app was missed by both and by BasedHardware#13463. Adds twitter_tools_auth.py (shared-secret bearer/query-token guard, TWITTER_TOOLS_SECRET env) applied via Depends() to every tool route. Fails closed 503 when unconfigured, 401 on missing/wrong token. Verified: 9 tests + 64 subtests pass including 5 new guard tests; existing test stub gained a Depends attribute. Refs BasedHardware#14451
Reviewer asks: test_tools_auth.py was not in .github/checks-manifest.yaml (the existing max-results entry only runs test_max_results.py), and the docstring cited BasedHardware#14448 instead of the BasedHardware#14451 bounty issue. Registers twitter-chat-tools-auth-tests (PASS via run_checks.py --check-id) and corrects the reference. PR body now declares Failure-Class: none. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
/disconnect deleted a victim's Twitter tokens by uid alone — a GET link rendered in the settings page, so the Bearer tools guard cannot apply. The page now signs uid with the shared secret (disconnect_sig) and the endpoint verifies it (verify_disconnect_sig, fail-closed 503/401). Same pattern as the whoop /disconnect fix. Closes BasedHardware#14505.
|
Thanks @hridaya423 — clean follow-up to #14452, reusing the signed-link pattern from the whoop fix (#14454). Verified against head 95e985: Security review of the change
Residual properties — inherent to the signed-link pattern, same trade-off the whoop fix accepted, fine to merge with but worth being aware of:
Dependency note: this branch sits one commit on top of #14452's head, so that PR should merge first. The uid-as-authentication hole is closed and the implementation matches the established pattern. The remaining call is a maintainer one — sign-off on the shared-secret auth posture (one TWITTER_TOOLS_SECRET guarding both bearer tool calls and signed disconnect links) for this plugin. (Automated maintainer review on behalf of David · AI-generated feedback) by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Closing as a later duplicate of #14452, opened earlier for the same file class. Both PRs still change overlapping production files ( |
|
Hey @hridaya423 👋 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! |
Problem
GET /disconnect?uid=deleted a victim's stored Twitter tokens for any supplied uid, no authentication. It's a browser-rendered GET link on the settings page, so the Bearer/twitter_tools_tokentools guard from #14452 can't apply directly./setup/twitter?uid=still returns only anis_setup_completedboolean: same shape as the setup check intentionally left open in the whoop PR (#14454), no mutation.Flagged in review on #14452 → #14505.
Fix
Same signed-link pattern as the whoop
/disconnectfix:disconnect_sig(uid)signs the uid withTWITTER_TOOLS_SECRET(HMAC-SHA256, truncated hex); the settings page renders/disconnect?uid=…&sig=….verify_disconnect_sig(uid, sig)runs beforedelete_twitter_tokens: 503 whenTWITTER_TOOLS_SECRETis unset (fail-closed, same posture as the tools guard), 401 on missing/bad signature (hmac.compare_digest).Verification
python3 test_tools_auth.py: 9/9 pass, incl. newTestDisconnectSig(valid sig accepted, wrong-uid sig 401, missing sig 401, unconfigured secret 503).run_checks.py --lane local --check-id twitter-chat-tools-auth-tests→ PASS.Failure-Class: none
Depends on #14452 (extends
twitter_tools_auth.pyintroduced there). Closes #14505.