Skip to content

Studio: open http(s): source links without slashes as web links; flag Windows theme downloads - #13195

Merged
danielhanchen merged 1 commit into
mainfrom
sec/s130-frontend-links
Oct 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
sec/s130-frontend-links

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Two frontend fixes from the latest security scan. Ordinary links, citations and downloads behave the same.

  1. Source chips with an http(s):host URL no longer replace Studio's page (lib/open-link.ts, features/chat/utils/document-citation-source.ts).

    • The bug: web-search and document-citation source chips render their stored URL as the link. parseSourcesFromResult reads the URL: lines of a search result, which a search snippet can inject. Its validator accepted https:evil.example and https: + tab + //evil.example because the URL parser reads both as absolute, but it returned the raw string. openLink treats any href without a literal :// as app-relative and lets the browser navigate natively. So clicking such a chip replaced Studio's page:
      • with the outside site, when the scheme differs from Studio's own (https: on a local http:// Studio, or any scheme in the Desktop main window, which has no navigation allowlist);
      • otherwise with a broken in-app route, which drops the conversation from view.
    • The fix: openLink strips tabs and newlines the way the URL parser does. An http(s): link without slashes is turned into its parsed form and opened like any other web link, in the browser panel or externally. The validator now returns the parsed URL, so new chips store https://....
    • Unchanged: markdown links in replies were never affected, because the renderer already normalises them. Relative links, anchors and normal https:// links behave as before.

    Before and after, Studio web UI, clicking a source chip whose URL is http:127.0.0.1:<port>/landing. Before, the page is replaced (Page not found, conversation gone). After, Studio stays on the chat and the landing page opens as a web link.

    source chip before and after

  2. Windows theme and search-connector files count as dangerous downloads (features/browser/dangerous-file-types.json, shared with the Tauri download check). The list already covered library-ms, search-ms, scf, url and lnk. theme, themepack, deskthemepack and searchconnector-ms were missing. Opening a crafted one makes Windows connect to an attacker's SMB share and leak the user's NTLM hash. They now get the existing dangerous-download treatment.

Tests:

  • New tests/open-link-scheme-without-slashes.test.ts checks:
    • https:host, tab-split and upper-case forms open as web links;
    • relative and normal links are unchanged;
    • citation sources come back in their parsed form.
  • New tests/download-safety-windows-shell-types.test.ts.
  • Both new tests fail on main (3 of 4 cases).
  • Related frontend tests (links, citations, downloads, markdown, sources, browser): 806 of 806. tsc --noEmit is clean.

…ation URLs; treat Windows theme and search-connector files as dangerous
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T01:16:12.053454Z a0e37d9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 10, 2026
@danielhanchen danielhanchen changed the title Studio: open https: links without slashes as web links; flag Windows theme downloads Studio: open http(s): source links without slashes as web links; flag Windows theme downloads Oct 10, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 10, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: a0e37d97f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 3b1d13d into main Oct 10, 2026
@danielhanchen
danielhanchen deleted the sec/s130-frontend-links branch October 10, 2026 03:13
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 19, 2026
… ignore the dev Studio home (unslothai#14190)

Three small hardenings from a re-check of the security scan backlog.
Each was approved in an earlier triage round and had not landed. No
visible change for normal use.

1. **`//host` links open as web links**
(`studio/frontend/src/lib/open-link.ts`). `openLink` treated a
protocol-relative href (`//evil.example/x`, or the backslash forms
browsers read the same way) as a path inside Studio and let native
navigation run, which replaced Studio's page, and in Desktop the main
window, with another site. unslothai#13195 covered `https:host` without slashes;
this covers `//host`. It is rewritten to `https://host/...` and opened
like any other web link (browser panel or a new tab). Relative paths,
anchors and ordinary links are unchanged.
2. **The Desktop elevated Linux install runs `/usr/bin/apt-get` by
absolute path** (`studio/src-tauri/src/install.rs`). The code already
checks that `/usr/bin/apt-get` exists, then ran `apt-get update` and
`apt-get install` by bare name under elevation. Both now use the checked
path, as `debian_update.rs` already does.
3. **`/.studio/` is ignored by git** (`.gitignore`). The README's dev
install keeps the Studio home in the checkout
(`UNSLOTH_STUDIO_HOME="$PWD/.studio"`). Only `auth.db` was ignored, so
`git add .` would stage `studio.db` (chats, saved connections), `auth/`,
`accounts/`, the venv and caches.

Tests:
- `studio/frontend/tests/open-link-scheme-without-slashes.test.ts`:
`//host` and the backslash forms open as `https://host/...` (fails on
main); the existing cases still pass. Related link tests pass (32),
`tsc` and `eslint` clean.
- `tests/test_installer_elevation_report.py`: no bare `apt-get` command
in `install.rs`, and the README's dev Studio home is ignored. `cargo
check --locked` for Desktop passes on Linux.

### Before / after

A web-search source chip whose stored URL is `//host/landing` (a local
landing page), clicked in a chat. Markdown links are already normalised
by the renderer, so a source chip is where a `//host` href reaches
`openLink`. Before: Studio's page is replaced by the landing page.
After: Studio stays on the chat and the link opens as a web link in a
new tab.

![Clicking a //host source chip, before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14190/pr14190_pair_01-fdd9a76ca85d.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant