Repository navigation
fix(plugins): require auth on twitter-chat-tools routes acting on uid-keyed tokens (#14451) - #23706
hardik4love-lang wants to merge 4 commits into
Conversation
…-keyed tokens (BasedHardware#14451) Failure-Class: none UI-Evidence: none - Add `twitter_tools_auth.py` providing `require_twitter_tools_auth` to validate incoming /tools/* requests against `TWITTER_TOOLS_SECRET` via `Authorization: Bearer` or `?twitter_tools_token=`, using constant-time `hmac.compare_digest` with UTF-8 byte encoding and failing closed with HTTP 503 when unconfigured. - Protect all 10 chat-tool routes (`post_tweet`, `get_timeline`, `get_my_tweets`, `get_mentions`, `search_tweets`, `like_tweet`, `unlike_tweet`, `retweet`, `delete_tweet`, `get_user_profile`) with `_auth: None = Depends(require_twitter_tools_auth)`. - Register `twitter-chat-tools-auth-tests` in `.github/checks-manifest.yaml`. - Add hermetic test coverage in `test_tools_auth.py` (9/9 passing). Closes BasedHardware#14451 Signed-off-by: hardik4love-lang <[email protected]>
…s auth tests Failure-Class: none UI-Evidence: none Signed-off-by: hardik4love-lang <[email protected]>
Failure-Class: none UI-Evidence: none Signed-off-by: hardik4love-lang <[email protected]>
|
Verdict: correct, well-scoped security fix that follows the repo's established tools-auth pattern (shipbob / composio / github-app); no blocking issues — two small follow-ups below. What I verified:
Security: shared-secret caller auth matches the accepted pattern from the sibling fixes; uid-as-body-key remains by design (backend data plane). Reusing Follow-ups (non-blocking):
Bounty settlement is handled by the maintainers through the bounty process — this review covers the code change only. USER IMPACT: a user's connected Twitter account can no longer be read or acted on by an unauthenticated caller who knows their uid; tool behavior is otherwise unchanged once the backend presents the configured secret. Leaving for human maintainer sign-off: a shared-secret auth change on routes that act with users' OAuth tokens deserves maintainer confirmation of the deployment wiring (secret configured, backend caller updated to present it) before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hi @Git-on-my-level, Thank you for the review! Updated \plugins/omi-twitter-chat-tools-app/README.md\ to document that all ten /tools/*\ chat-tool endpoints now require caller authentication via \TWITTER_TOOLS_SECRET\ (via \Authorization: Bearer \ or \ witter_tools_token=), and clarified that \TWITTER_TOOLS_SECRET\ guards both the disconnect link and tool execution. Ready for maintainer sign-off and merge! |
|
Verdict: this is a real security fix, correctly implemented and tested — from my review it is merge-ready pending a maintainer sign-off on the auth model (details below). What I verified on head 37749f8:
Security: this closes an unauthenticated-access hole where any caller could act on a victim's Twitter OAuth token (read timeline/mentions, post, like, retweet, delete). Two design notes for a maintainer before merge: (1) TWITTER_TOOLS_SECRET is a single shared secret across all users and the uid remains caller-chosen, so any secret holder can act as any uid — fine if this service is only reachable by the trusted Omi backend, worth confirming the deployment story; (2) the ?twitter_tools_token= query channel can leak the secret into access logs — the Bearer header should be the preferred mechanism going forward. USER IMPACT: none for end users — Twitter chat tools keep working unchanged; self-hosters of this plugin must set TWITTER_TOOLS_SECRET or tool calls will now (correctly) fail closed. Remaining asks (non-blocking): maintainer confirmation of the shared-secret trust model; consider deprecating the query-param channel in favor of the Bearer header; the bounty settlement details in the PR description need maintainer/ops verification outside this code review. Leaving for human maintainer review: security-sensitive auth change on a plugin that handles user Twitter OAuth tokens — the shared-secret model and merge decision need maintainer sign-off. (AI-generated maintainer feedback on behalf of the Omi maintainers.) by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Verdict: the production change is correct and well scoped — this properly closes the unauthorized-use hole from #14451; leaving security sign-off to a human maintainer. Per-file findings (all seven changed files reviewed):
Non-blocking notes for the maintainer:
Security: closes a genuine unauthenticated read/write-as-victim vulnerability. Blast radius if wrong: all twitter chat tools — mitigated by fail-closed behavior and green hermetic tests. Performance/cost: negligible (one env read plus a constant-time compare per request). Still wanted before merge: an end-to-end check against the real invoking client with the secret configured, since the hermetic suite cannot cover the platform side. Leaving for human maintainer review: security-sensitive auth change on a surface that acts with users' Twitter OAuth tokens needs maintainer sign-off. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hi @Git-on-my-level @kodjima33 |
|
Hey @hardik4love-lang 👋 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
Fixes #14451
Failure-Class: none
UI-Evidence: none
Every chat-tool route in
plugins/omi-twitter-chat-tools-app/main.pypreviously accepteduidin the JSON body, executedget_valid_access_token(uid)/twitter_api_request(uid, ...), and acted on that user's Twitter OAuth credentials with zero caller authentication. An unauthenticated caller could read a victim's timeline, search queries, or tweets, or perform write actions (post, like, unlike, retweet, delete) as the victim.Changes
plugins/omi-twitter-chat-tools-app/twitter_tools_auth.py: Addedrequire_twitter_tools_authdependency validatingTWITTER_TOOLS_SECRETviaAuthorization: Bearer <token>or?twitter_tools_token=<token>, using constant-timehmac.compare_digestwith UTF-8 byte encoding and failing closed with HTTP 503 when unconfigured.plugins/omi-twitter-chat-tools-app/main.py: Added_auth: None = Depends(require_twitter_tools_auth)to all 10 chat-tool routes (post_tweet,get_timeline,get_my_tweets,get_mentions,search_tweets,like_tweet,unlike_tweet,retweet,delete_tweet,get_user_profile). Onboarding and webview routes remain open.plugins/omi-twitter-chat-tools-app/hermetic_stubs.py&test_max_results.py: Updated minimalfastapimocks withDependsandHeadersupport so older hermetic test suites remain 100% green..github/checks-manifest.yaml: Registeredtwitter-chat-tools-auth-testsentry running the hermetic auth test suite.plugins/omi-twitter-chat-tools-app/test_tools_auth.pycovering fail-closed 503, 401 on missing/invalid/malformed credentials, non-ASCII UTF-8 safety, and static wiring checks (9/9 passing).Bounty Settlement Details
[email protected])Closes #14451