Skip to content

[Security] Keep web app launchers on http(s) - #8496

Merged
ryanrhughes merged 2 commits into
omacom:quattrofrom
chessing234:security/webapp-http-only
Aug 29, 2026
Merged

ryanrhughes merged 2 commits into
omacom:quattrofrom
chessing234:security/webapp-http-only

Conversation

@chessing234

@chessing234 chessing234 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8495.

omarchy-webapp-install prefixes a schemeless URL with https://. It now validates the normalized URL before any fetch or icon write:

  • only http:// and https:// schemes are accepted;
  • scheme comparison is case-insensitive;
  • raw whitespace is rejected and must be percent-encoded.

The whitespace rule closes the reported Chromium flag injection:

omarchy-webapp-install InjectTest 'https://example.com/ --user-agent=INJECTION_PROOF_MARKER_12345' chromium

Before the layered fix, the Desktop Entry parser split the value and omarchy-launch-webapp forwarded the extra flag to Chromium. #8473 also serializes every default URL as one correctly quoted Desktop Entry argument, while #7984 keeps app names out of the launcher directory structure.

Verification

test/shell.d/webapp-install-test.sh proves that:

  • ordinary HTTPS and schemeless URLs install;
  • uppercase HTTP(S) schemes remain accepted;
  • the Sunshine custom command remains unchanged;
  • javascript:, file:, data:, FTP, and extension schemes are refused;
  • leading whitespace, an additional URL, and the exact reported --user-agent payload are refused;
  • rejected interactive URLs are stopped before curl runs or an icon/launcher is written.

The combined #7984 + #8473 + #8496 regression suites pass.

Chromium --app= will run javascript:, file:, and data: URLs. Prefix
schemeless input with https as before, then refuse anything else.
Copilot AI balanced review requested due to automatic review settings August 27, 2026 01:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restricts installed web-app URLs to HTTP(S) schemes and adds regression tests.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Centralizes URL normalization and scheme validation.
  • Tests valid, schemeless, custom-command, and prohibited URLs.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
bin/omarchy-webapp-install Adds HTTP(S)-only URL validation.
test/shell.d/webapp-install-test.sh Adds installer URL tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The scheme check ran after the interactive branch, which had already handed the URL to curl: a refused `file://` or `ftp://` URL was dereferenced first, the whole string went out to Google's favicon endpoint in a `domain=` query, and a fetch that happened to succeed left an orphan icon and a rebuilt icon cache behind. Validating immediately after normalization puts the refusal ahead of every dereference in both branches.

A leading space also kept the URL out of the scheme test entirely. `normalize_webapp_url` saw no scheme, prefixed it, and ` file:///etc/passwd` became `https:// file:///etc/passwd`, which passes `^https?://`. The desktop `Exec` field is unquoted, so it splits back into two arguments, and `omarchy-launch-webapp` forwards everything after the first to the browser, where a bare argument is another URL to open. Refusing whitespace closes that without touching desktop-entry escaping.

Scheme comparison is case-insensitive because schemes are: `HTTPS://example.com` installed before this check existed and has no reason to stop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Codex XHigh <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this on a worktree at 877f1e96 against quattro, with an independent second opinion from Codex at xhigh reasoning. Three things needed fixing; I've pushed them to this branch as one commit rather than leave the work with you.

The scheme check ran too late. It sat after the argument/interactive split, so the interactive path had already dereferenced the URL by the time it fired. Entering file:///etc/hostname at the gum prompt produced three curl calls before the refusal: curl -fsSL --max-time 5 file:///etc/hostname, a fallback to $origin/apple-touch-icon.png, and then https://www.google.com/s2/favicons?domain=file:///etc/hostname&sz=256 — so a URL the script is about to reject gets sent to a third party first. A fetch that succeeded would also leave an orphan icon and a rebuilt icon cache behind for a launcher that was never written. Codex found this independently and rated it the merge blocker; I'd verified the same three calls by stubbing curl. Validation now runs immediately after normalization in both branches.

A single leading space walked past the check. file:///etc/passwd has no scheme as far as normalize_webapp_url is concerned, so it gets prefixed to https:// file:///etc/passwd, which matches ^https?:// and installs. The desktop Exec field is unquoted, so it splits back into two arguments, and omarchy-launch-webapp line 13 forwards everything after the first straight to the browser — --app=https:// plus a bare file:///etc/passwd, which the browser opens as its own URL. I confirmed the resulting argv with stubbed setsid/uwsm-app rather than launching a browser. This is the payload class the PR exists to block, reached without any of the desktop-entry escaping that's scoped out to #8473, so I've refused whitespace in the URL outright. Worth saying plainly: Codex looked at this one and called it pre-existing Exec-splitting behaviour that the PR doesn't worsen. It's right that it predates the change — but the check advertises completeness, and closing #8495 with a one-space bypass still in it seemed worse than the three lines it takes to fix.

HTTPS://example.com stopped installing. ^https?:// is case-sensitive while the scheme detection in normalize_webapp_url uses [a-zA-Z], so an uppercase scheme is recognised as a scheme and then rejected as not-http. I ran the pre-PR script to confirm it wrote the launcher before. Schemes are case-insensitive; the comparison now lowercases.

Codex also noted the if ok; then return 0; fi shape in require_http_url reads against the base AGENTS.md preference for a full conditional over an early return that makes the following lines reachable only by fallthrough. The rewrite is two guard clauses, so that resolves itself.

On what I checked: ./test/all is green at 207 test files with these changes. Your four cases still pass unchanged, and I added three more — the whitespace smuggling, the uppercase scheme, and an interactive case that stubs gum and curl and asserts curl was never invoked. I broke each fix on purpose and watched the matching test fail, so none of them pass vacuously. The graphical acceptance suite was not run.

One thing left for you: the ## Verification section in the body. House style is no Testing section — CI reports it and a written copy goes stale, which it now has, since it lists four assertions and the file has seven. I didn't want to rewrite your prose, so it's yours to drop.

The rest holds up. CUSTOM_EXEC, MIME_TYPES and ICON_REF all came up clean: the only custom-exec caller in the tree is the fixed Sunshine localhost command, and an attacker who controls argv already has better options than this script.

🤖 Generated by Opus 5 in Claude Code.

@ryanrhughes ryanrhughes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed individually and in the combined #7984 + #8473 + #8496 tree. Validation runs before side effects and rejects the exact reported Chromium flag payload. The merge result updates assertions and comments for #8473's quoted Exec serialization.

@ryanrhughes
ryanrhughes merged commit 0b3f1b7 into omacom:quattro Aug 29, 2026
ryanrhughes added a commit that referenced this pull request Aug 29, 2026
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

[Security] omarchy-webapp-install writes javascript:/file: URLs into Chromium --app=

6 participants