Repository navigation
fix(plugins): harden setup templates and redirect URLs in linear, hive, and shopify (#15018) - #15019
kaleidoscopeAI wants to merge 4 commits into
Conversation
…e, and shopify plugins
💳 Bounty Disbursement DetailsUpon review and merge, the bounty reward can be disbursed directly via:
Thank you! |
|
@kodjima33 — requesting maintainer review of this multi-plugin security hardening PR. The current head covers Linear, Hive, and Shopify setup/OAuth/redirect sinks with regression verification documented in the PR. Please review and merge if it satisfies the bounty requirements. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @kaleidoscopeAI — well-scoped hardening pass. I verified this against the site list in #15018 and ran the new suite in a clean container with the plugin-pinned dependencies (fastapi 0.111.1): 12/12 pass, including a re-run with network access disabled, so the hermetic claim holds.
Per-file notes:
plugins/omi-linear-app/main.py—home()computesuid_q = urllib.parse.quote(uid, safe="")and uses it foroauth_url;linear_callbackanddisconnect_linearquote before building/?uid=redirects. Correct. (linear_authwas already safe viaurllib.parse.urlencode— sensibly untouched.)plugins/omi-hive-app/main.py— addsimport urllib.parse;connect_api_keyquotes once up front and reusessafe_uidin both the error and success redirects;disconnect_hivelikewise. Correct.plugins/omi-shopify-app/main.py—home()suppliesuid_q;shopify_callback(whose uid comes from the signed state param) anddisconnect_shopifyquote their redirects. Correct.plugins/omi-linear-app/templates/setup.html— Reconnect/Disconnect links render{{ uid_q|default(uid) }};setDefaultTeam()wrapsuid,teamId, andteamNameinencodeURIComponent()with a|| ''null-guard. Good.plugins/omi-hive-app/templates/setup.html— Disconnect link and the/settings/api-keyform action useuid_q;setDefaultProject()encodesuid,projectId,projectNamethe same way. Good.plugins/omi-shopify-app/templates/setup.html— Disconnect link usesuid_q;connectStore()now encodes bothuidandshopDomainin the OAuth redirect. Good. No raw{{ uid }}query interpolation remains in any of the three templates.plugins/test_plugins_setup_url_hardening.py— genuinely hermetic (network/db layers mocked), covers context values, rendered output, and redirect locations for all three apps, asserting both the presence of encoded uid and the absence of the raw value. Nice negative-assertion pattern..github/checks-manifest.yaml—plugins-setup-url-hardening-testsregistered with a correct command, triggers covering all three plugin dirs plus the test file, and both lanes.
Two minor, non-blocking observations:
- The
|default(uid)fallback keeps a raw-uid path alive if a future render context forgetsuid_q. All three current call sites pass it, so this is only a robustness note — dropping the fallback would make the invariant stricter. plugins/omi-hive-app/main.py:425still mentions a uid-bearing URL in a 400 errordetailstring (helper text, not a functional URL) — fine to leave, flagged for completeness.
This lands real value: the previous code interpolated a raw uid into redirects, hrefs, a form action, and client-side fetches, so a crafted uid could inject extra query parameters or corrupt attributes. Leaving the merge call to the maintainers since this touches OAuth redirect/auth surfaces across three plugins and resolves bounty issue #15018, which also needs a payout ruling.
🤖 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.
|
Keeping this open on unique shopify+hive setup.html URL hardening vs #13659; extra production so not CLOSE; 0-CI/FTC. I am not approving or merging this SHA. |
|
Maintainer action requested: this PR addresses #15018 and the security review has verified the fixes across Linear, Hive, and Shopify. Please merge if accepted and confirm the $75 bounty payout. Payout details can be provided privately. |
|
These 8 PRs fix the same underlying class of bug — unescaped/unsanitized values (uid, callback params, settings fields) flowing into inline scripts, HTML, or redirect URLs across different app plugins: #15019, #15015, #15013, #15008, #15000, #14891, #14889, #14887 (Two related PRs — #15102 and #14898 — covered the same pattern but were auto-closed as stale/duplicate; #14878 was closed as superseded by a parallel fix in #14877.) All 8 have completed technical/security review (several went through a CHANGES_REQUESTED → fix → re-review cycle, e.g. #14889 and #14887 both closed out a Happy to consolidate any of these into a single PR if that's easier to review as a batch. |
|
Hive, Linear, and Shopify setup on main still put a raw — Astar, on behalf of @aryanorastar |
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
|
Thanks again @kaleidoscopeAI - the hardening itself checks out on this head: I re-verified every changed file and found no remaining raw uid interpolation in the setup templates or redirects. One thing needs attention before merge: the Hygiene check is failing, and the root cause is the new test suite rather than the plugin code. The established pattern for CI-lane manifest tests is stdlib-only module stubbing - see
Option 1 keeps the stronger behavioral coverage and is what I'd suggest. The production changes themselves ( Since this touches OAuth/redirect parameter handling across three plugin apps, maintainer sign-off on the security surface is still needed before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
@aryanorastar — the DIRTY state you flagged is resolved.
Conflict scope: CI: checks are now actually running on this head (Repo Checks, Hygiene, Typecheck, backend shards, desktop-core-e2e). Hygiene, Formatting and Typecheck were all in flight when I looked. That should clear the
No assertion was weakened and no test was skipped; the branch head is otherwise byte-identical to what you verified on |
Tree starts from main and applies this branch's changes on top, so every change main made since this branch was cut is preserved. Six plugin main.py files had moved on main; each was resolved as a real three-way merge (in omi-dropbox-app both sides touched the same disconnect href, keeping main's uid_q quoting and this branch's &sig=). .github/checks-manifest.yaml resolved by keeping main's manifest verbatim and appending plugins-setup-url-hardening-tests at the end of the checks list. Valid YAML, no duplicate ids.
…e CI lane
The Hygiene lane installs only pyyaml, so loading any of the three plugin mains
died on `import requests` / `from fastapi import ...` before a single
assertion ran. This registers stdlib stubs for fastapi, fastapi.responses,
fastapi.staticfiles, fastapi.templating, requests, dotenv, pydantic and
omi_plugin_sdk in sys.modules before load_plugin_main() executes, following
plugins/iq_rating/test_main.py, plugins/omi-shipbob-app/test_main.py and
plugins/chatgpt/test_main.py. omi_plugin_sdk is stubbed because it is
first-party but imports pydantic, which the lane also lacks.
jinja2 cannot be reproduced faithfully without writing a template engine, so
Jinja2Templates captures the render context instead of rendering. The three
tests that previously called resp.template.render() now assert the two things
that actually carry the security property: that main.py hands the template a
correctly percent-encoded uid_q, and that the template interpolates
{{ uid_q|default(uid) }} rather than the raw uid in its links and form action.
Redirect assertions still read resp.headers['location'], matching Starlette.
Assertions are load-bearing, proven by mutation:
- reverting uid_q to the raw uid in all three apps -> 6 failures
- oauth_url interpolating raw uid instead of uid_q -> 1 failure
- the linear setup.html disconnect link dropping uid_q -> 1 failure
Passes both hermetically (stdlib + pyyaml only) and with real
fastapi/jinja2/pydantic installed.
9008dde to
64f9d07
Compare
Correction: the merge I posted earlier was wrong — please use
|
|
CI is green on this head — ready to merge. Head: Fix ( Tests (
Registered in |
|
Follow-up on the new head ( The Thanks @kaleidoscopeAI — the hardening and its coverage look solid; leaving the final sign-off for a human maintainer since this touches OAuth/redirect surfaces. 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 |
|
Since my last review: addressed — nothing was outstanding on Verdict: the hardening is correct and verified on this head — nothing blocking from me. What remains is the human security sign-off and the bounty decision. How I verified the merges: I diffed every PR file at Per-file notes:
Security: closes reflected parameter injection and parameter-carrying/broken URLs for the client-controlled Still wanted (non-blocking): the same raw Left for a human maintainer: security sign-off on the OAuth/redirect surfaces, and the bounty adjudication for #15018 (the proposal was filed by this PR's author, so the payout call belongs to a maintainer). by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
22794c81a3a4f98b930463e8af84e49d7d12e75d
plugins/omi-hive-app/templates/setup.html — template falls open to raw uid.
Resolves #15018
Summary
Hardens
plugins/omi-linear-app,plugins/omi-hive-app, andplugins/omi-shopify-appagainst query parameter injection, attribute corruption, and unencoded client-side fetch requests across their setup pages and OAuth/disconnect redirects:Linear App (
plugins/omi-linear-app):main.py: computesuid_q = urllib.parse.quote(uid, safe="") if uid else ""inhome()and uses it inoauth_url.main.py: percent-encodesuidviaurllib.parse.quote(uid, safe="")inlinear_callbackanddisconnect_linearredirect URLs.setup.html: renders{{ uid_q|default(uid) }}in/auth/linear?uid=and/disconnect?uid=links.setup.html: wrapsuidandteamIdwithencodeURIComponent()insetDefaultTeam()fetch call.Hive App (
plugins/omi-hive-app):main.py: importsurllib.parse, computesuid_q = urllib.parse.quote(uid, safe="") if uid else ""inhome().main.py: percent-encodesuidinconnect_api_key(both error and success redirects) anddisconnect_hive.setup.html: renders{{ uid_q|default(uid) }}in/disconnect?uid=and/settings/api-key?uid=targets.setup.html: wrapsuidandprojectIdwithencodeURIComponent()insetDefaultProject()fetch call.Shopify App (
plugins/omi-shopify-app):main.py: computesuid_q = urllib.parse.quote(uid, safe="") if uid else ""inhome().main.py: percent-encodesuidinshopify_callbackanddisconnect_shopifyredirect URLs.setup.html: renders{{ uid_q|default(uid) }}in/disconnect?uid=.setup.html: wrapsuidandshopDomainwithencodeURIComponent()inconnectStore()client redirect.Testing & Verification:
plugins/test_plugins_setup_url_hardening.pywith 12 tests covering all template rendering, parameter encoding, and redirect contexts across all 3 plugins.plugins-setup-url-hardening-testsin.github/checks-manifest.yaml.Verification
/claim #15018
💳 Bounty Disbursement Details
Upon review and merge, the bounty reward can be disbursed directly via:
[email protected]Failure-Class: none