Repository navigation
Conversation
- Add `import html` to safely sanitize dynamic values rendered in HTML
- Escape `error` in OAuth failure callback (<p>{html.escape(error)}</p>)
- Escape `username` in connected homepage (<p>Connected as @{...}</p>)
- Escape `username` in post-auth success page (<p>Your Twitter account @{...}</p>)
LF line endings preserved.
11 stdlib-only unit tests covering unauthenticated callback error, connected status username, success page username, and URL encoding of uid.
|
Verified this end to end - nice, surgical security fix. plugins/omi-twitter-chat-tools-app/main.py - confirmed all three sinks at head now escape before interpolation: the OAuth callback plugins/omi-twitter-chat-tools-app/test_twitter_html_escaping.py - ran the suite locally: 11/11 pass, hermetic and stdlib-only. Two accuracy notes, neither blocking:
The deconfliction table checks out - #13658 and #14504 touch different lines and don't overlap these sinks. Thanks for the clean writeup and the regression tests. Since this modifies the OAuth callback pages and resolves bounty issue #14881, the merge call (and bounty adjudication) stays with the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Verified on
Not approving: hosted CI/preflight is not green on this fork SHA, and the suite must exercise the real callback/setup HTML (not a reimplemented template). I am not merging. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verified the fix at head b2c32db — this is a real, minimal XSS fix, thank you.
plugins/omi-twitter-chat-tools-app/main.py
import html(line 8) resolves to the stdlib module; no shadowing module exists in the plugin directory.- All three previously raw sinks are now escaped with
html.escape(..., quote=True): connected-page username (line 1028), OAuth callbackerror(line 1092), and callback success username (line 1199). Sinceerroris an unauthenticatedQueryparam (line 1081), that sink was a genuine reflected XSS; the username escapes add sound stored/reflected defense-in-depth for values sourced from/users/me(line 1182) and the token store (line 1014). - No raw
{error}/{username}interpolations remain in anyHTMLResponseblock; both changed files parse cleanly.
plugins/omi-twitter-chat-tools-app/test_twitter_html_escaping.py
- Hermetic, stdlib-only, no network: I ran it locally — all 11 tests pass.
- One drift:
_render_success_pageURL-quotesuid(url_quote(uid or "", safe="")), but the shipped success template still emits<a href="/?uid={uid}">with raw{uid}(main.py:1202).test_uid_url_encoded_in_continue_linktherefore asserts behavior this PR does not implement — uid encoding is open PR #13658's scope per your own deconfliction table. Please align the helper with the actual template (or scope that assertion to what this PR ships) so the suite can't pass against a template the plugin no longer has.
Two changes needed before merge:
- PR Metadata Preflight is failing:
failure-class-protocol (missing_declaration)— a commit subject starting withfix:requires exactly one acceptedFailure-Class:declaration in the PR body (Failure-Class: FC-<lower-kebab-slug>,Failure-Class: new, orFailure-Class: none). This PR adds no failure-class definition, soFailure-Class: noneis the matching form; re-run preflight after editing the body. - The uid test drift above.
Leaving the remaining raw {uid} href (main.py:1202) and {str(e)} (main.py:1222) sinks to #13658/#14504 is the right call — nice deconfliction.
Because this edits an auth-callback rendering surface and is tied to bounty issue #14881, it needs a human maintainer's sign-off before merge.
🤖 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.
|
Addressed review feedback at head
Ready for final review @aryanorastar @Git-on-my-level. Thank you! |
|
Verified on The suite now drives production I am not approving or merging this SHA. GitHub reports CONFLICTING/DIRTY because The PR body still needs a Leave the raw |
|
Addressed review feedback at head
Ready for final review @aryanorastar. Thank you! |
…conflict Failure-Class: none
Failure-Class: none
…witter check Failure-Class: none
aryanorastar
left a comment
There was a problem hiding this comment.
Verified on 10813163261b.
Origin/main still interpolates raw {error} and {username}. This head escapes all three HTML sinks with html.escape(..., quote=True), and the suite drives production root / twitter_callback. Against current main, .github/checks-manifest.yaml is a +5 union (twitter-chat-tools-app-tests only). Failure-Class: none is in the body. Hygiene is green.
{uid} href and {str(e)} stay with #13658 / #14504. Git-on-my-level CHANGES_REQUESTED is still b2c32db; I am not dismissing that review.
I am not merging.
|
Hi @Git-on-my-level — all items from your review on �2c32db have been fully addressed at head 1081316:
All 33 checks are passing and @aryanorastar has approved the PR on 1081316. Could you please review the latest head to clear the stale changes-requested status so this can be merged? Thank you! |
Failure-Class: none
|
Twitter HTML escaping on — Astar, on behalf of @aryanorastar |
|
@aryanorastar @Git-on-my-level — All 33/33 required checks are green and the branch is conflict-free. All previous review feedback has been addressed. Ready for final merge. CI: 33/33 checks pass (all SUCCESS/NEUTRAL/SKIPPED). Branch mergeable: ✅ |
aryanorastar
left a comment
There was a problem hiding this comment.
On fbb740fc919f, plugins/omi-twitter-chat-tools-app/main.py escapes three <p> sinks, but the same callback still returns Token exchange failed: {response.text} and Authentication error: {str(e)} as HTML.
|
@aryanorastar @Git-on-my-level — addressed in
All callback HTML reflection sinks are now closed. Ready for re-review! |
… to satisfy log safety contract
|
@aryanorastar @Git-on-my-level — addressed in \25ba451f25:
Hygiene check is now PASS (green). All tests passing. |
aryanorastar
left a comment
There was a problem hiding this comment.
origin/main plugins/omi-twitter-chat-tools-app/main.py has zero html.escape and :1261 returns HTMLResponse Authentication error: {str(e)}. Tests pin that hole. Required checks are green.
|
Hi team! 👋 |
aryanorastar
left a comment
There was a problem hiding this comment.
25ba451f25bf65a424663c087316b8ce902ad3bb plugins/omi-twitter-chat-tools-app/main.py puts str(e) back into chat-tool errors.
…ools and API requester Sanitizes raw str(e) exception strings in twitter_api_request and across all 10 chat tool handlers (post_tweet, get_timeline, get_my_tweets, get_mentions, search_tweets, like_tweet, unlike_tweet, retweet, delete_tweet, get_user_profile) to ensure internal error details are never reflected into ChatToolResponse payloads. Addresses review feedback from @aryanorastar.
|
Thanks @aryanorastar for catching that! Resolved in commit
|
|
@aryanorastar @Git-on-my-level — All 33/33 required checks are green and the branch is conflict-free. All previous review feedback has been addressed. Ready for final merge. CI: 33/33 checks pass (all SUCCESS/NEUTRAL/SKIPPED). Branch mergeable: ✅ |
Outdated at this head: both concerns are resolved. The uid-encoding drift assertion was removed from the test suite (it now pins shipped behavior, 12/12 passing), and Failure-Class: none is declared in the PR body. The subsequent review rounds (raw response.text / str(e) HTML sinks, chat-tool str(e) reflection) are also addressed at 4b72ab0.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verified at head 4b72ab0 — both previously blocking threads are resolved. Thank you for the careful iterations.
plugins/omi-twitter-chat-tools-app/main.py
- The three HTML sinks remain correctly escaped with html.escape(..., quote=True): connected-page username (line 1026), OAuth callback error (line 1090), and success-page username (line 1197).
- The callback's two remaining raw HTML sinks are now static — "Token exchange failed" (line 1156) and "Authentication error" (line 1220) no longer reflect response.text or str(e). That closes out the concerns from the 09-24 and 09-27 change-request rounds.
- All 11 chat-tool handlers plus twitter_api_request now return static error strings instead of interpolating str(e); log() still records the detail server-side, so debuggability is preserved.
- One pre-existing, non-blocking leftover: the non-2xx branch of twitter_api_request (line 172) still returns response.text in a JSON dict — unchanged by this PR and not an HTML sink, just noting it for completeness.
plugins/omi-twitter-chat-tools-app/test_twitter_html_escaping.py
- Ran the suite locally against this head: 12/12 pass. Hermetic stdlib-only design (stubbed fastapi/db/requests modules, no network), and it now pins shipped behavior — including test_oauth_exception_does_not_leak_exception_string, which directly guards the regression from the 09-27 review. The earlier uid-encoding drift assertion is gone.
.github/checks-manifest.yaml
- New twitter-chat-tools-app-tests check is correctly scoped (plugin-path triggers, local+ci lanes) and runs the hermetic suite.
The prior automated change request (uid test drift, failure-class declaration) is resolved at this head and I've dismissed it. Failure-Class: none is present in the body.
Still leaving the final call to a human maintainer: this edits the OAuth callback rendering surface tied to #14881, and the security-review/needs-maintainer-review labels stay until a maintainer signs 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.
|
Closing per the maintainer's bounty-policy ruling (2026-10-01). The maintainer reviewed this batch of exception-sanitization PRs: the underlying issues are real but minor, and the ask (per-PR bounties on a templated sweep) doesn't fit how bounties are awarded here. The genuinely valuable fix in this family — Firebase ID token verification error reflection on the OAuth token endpoint (#16029) — has been cherry-picked and re-landed with full credit at #20168. The remainder of the sweep is being closed rather than paid or merged piecemeal. If you believe a specific PR in this set addresses a serious issue (user-visible crash, data exposure beyond error-detail hygiene, security impact beyond internal message leakage), comment on it and a maintainer will take a direct look — that path stays open. Thanks for the contributions; the oauth fix was good work. by AI on behalf of David — if you need David's attention urgently, please @Git-on-my-level and escalate with |
|
Hey @Mateidslx 👋 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! |
What changed and why
plugins/omi-twitter-chat-tools-app/main.pyrendered dynamic values directly into HTML withouthtml.escape:GET /auth/twitter/callback?error=...reflected raw attacker input in<p>{error}</p>(unauthenticated reflected XSS).GET /and callback success page reflected{username}into<p>elements without entity encoding.Closes #14881
Failure-Class: none
Fix
Minimal 4-point surgical patch using stdlib
html(zero new dependencies, all LF endings):Deconfliction
uidpercent-encoding in redirect hrefsstr(e)in exception blockNeither PR covers
{error}or{username}in these HTML templates.Tests
New hermetic regression suite
test_twitter_html_escaping.py(stdlib-only, zero network, zero external deps):ErrorPageEscapingTestConnectedPageEscapingTestSuccessPageEscapingTest