Repository navigation
fix(slack-app): escape channel and workspace names and encode reflected uid parameter (#14876) - #14877
Conversation
|
Verified end to end - thank you for the clean fix and for shipping a hermetic regression suite with it. What I checked in plugins/omi-slack-app/main.py:
Verification: ran plugins/omi-slack-app/test_settings_page.py in isolation against both this branch (12/12 pass) and the pre-fix main.py (9 failures + 1 error, including the raw breakout string) - so the tests genuinely detect the vulnerability rather than passing vacuously. The manifest entry slack-app-settings-page-encoding-tests is registered with the standard triggers/lanes, and CI is green. Two non-blocking notes for the maintainer pass:
The bounty proposal in #14876 stays with the maintainers as a separate decision; this review covers the code only. 🤖 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 |
What changed and why
Multiple routes on
omi-slack-apprendered client-controlled or Slack-supplied inputs directly into HTML without output encoding or URL quoting:GET /(authenticated settings page) — channel and workspace name XSS:channel['id']andchannel['name']were interpolated into<option>tags using raw strings:</option><script>alert(1)</script>orC123" onfocus="alert(1)) executed arbitrary script inside the plugin origin.team_namewas rendered unescaped inConnected to <span class="username">{team_name}</span>.refreshChannels(),logoutUser()),{uid}was interpolated intofetchURLs without URL-safe percent-encoding.GET /auth/callback(OAuth redirect) — reflected XSS & breakout:team_namewas interpolated intoYour Slack workspace <strong>{team_name}</strong> is now linkedwithout escaping.Try againlink interpolated rawuidinto<a href="/auth?uid={uid}">.error: str = Query(None)and properly escapes error messages when authorization fails or is denied.GET /(unauthenticated connect page):auth_url = f"/auth?uid={uid}"reflected rawuidinto<a href="{auth_url}">. Auidof"><script>alert(1)</script>broke out of the attribute; query separators like&or#corrupted the flow.Fix
Following the pattern established by #14581 (google calendar app) and #13658:
html.escape()applied toteam_name,channel['id'],channel['name'], and OAutherror.quote(uid, safe="")applied to alluidreflections in URL/href and JavaScript contexts.Verification
New hermetic regression suite:
plugins/omi-slack-app/test_settings_page.py(stdlib only, zero network or external dependencies):test_channel_names_and_ids_are_escaped_in_picker: proves markup and quotes in channel IDs/names are escaped (<script>,").test_team_name_is_escaped_in_settings_page: proves workspace name cannot inject HTML elements.test_team_name_is_escaped_in_oauth_callback: proves workspace name is safe in callback success HTML.test_oauth_callback_error_is_escaped: proves OAuth error strings are escaped.test_unauthenticated_uid_is_url_encoded: proves breakout characters are percent-encoded in auth link.test_uid_query_separators_do_not_corrupt_link: proves&and#do not split or corrupt parameters.test_ordinary_inputs_render_normally: control test verifying standard user flows render unmodified.test_channel_resolution.py: 9/9 passed.test_segments.py: 8/8 passed.test_slack_search.py: 5/5 passed.slack-app-settings-page-encoding-testsin.github/checks-manifest.yaml(triggers onplugins/omi-slack-app/**). Manifest validated (239 checks, zero duplicates).Failure-Class: none
Fixes #14876
Payout Destination
TGKmfSUmt2dggErAo8BicaCoXhkMwLetxV1NkUnv23H65ZYJn64pseAcWRA6sJitxh2f[email protected]