Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
plugins: open only the install-source repository link and render only host-served plugin images (#36270)
Neilf879c8d6f93d
diff --git a/src/renderer/src/components/plugins/PluginContributionIcon.tsx b/src/renderer/src/components/plugins/PluginContributionIcon.tsxindex 4c21c83f12e..0dd9f584733 100644--- a/src/renderer/src/components/plugins/PluginContributionIcon.tsx+++ b/src/renderer/src/components/plugins/PluginContributionIcon.tsx@@ -1,6 +1,7 @@import { createElement, useState } from 'react'import type { LucideIcon } from 'lucide-react'import { cn } from '@/lib/utils'+import { parsePluginImageUrl } from '../../../../shared/plugins/images/plugin-image-url'/** A plugin contribution's image icon (an orca-plugin-image URL main verified), or `fallback`* when it has none or the image fails to load. */@@ -14,7 +15,7 @@ export function PluginContributionIcon({className: string}): React.JSX.Element {const [failedUrl, setFailedUrl] = useState<string | null>(null)- if (!url || failedUrl === url) {+ if (!url || failedUrl === url || !parsePluginImageUrl(url)) {return createElement(fallback, { className, 'aria-hidden': true })}// Why alt="": the tab or menu item names what this is; the icon is decoration.diff --git a/src/renderer/src/components/plugins/list/PluginCard.tsx b/src/renderer/src/components/plugins/list/PluginCard.tsxindex 4a030057303..2bb9c14740b 100644--- a/src/renderer/src/components/plugins/list/PluginCard.tsx+++ b/src/renderer/src/components/plugins/list/PluginCard.tsx@@ -4,6 +4,7 @@ import { Badge } from '../../ui/badge'import { PluginCardArt, type PluginArtPalette } from './PluginCardArt'import type { PluginListEntry } from './plugin-list-entries'import { pluginArtShortcut, pluginArtTypes } from './PluginRowArt'+import { servedPluginHostImages } from '../../../../../shared/plugins/images/plugin-image-url'type PluginCardProps = {entry: PluginListEntry@@ -34,7 +35,9 @@ export function PluginCard({onIntent,onIntentEnd}: PluginCardProps): React.JSX.Element {- const cover = entry.installed?.images?.cover ?? entry.listing?.images?.cover+ const cover =+ servedPluginHostImages(entry.installed?.images)?.cover ??+ servedPluginHostImages(entry.listing?.images)?.coverreturn (<lidata-plugin-key={entry.pluginKey}diff --git a/src/renderer/src/components/plugins/page/PluginDetailInfo.tsx b/src/renderer/src/components/plugins/page/PluginDetailInfo.tsxindex 8000c4dca66..2f957806316 100644--- a/src/renderer/src/components/plugins/page/PluginDetailInfo.tsx+++ b/src/renderer/src/components/plugins/page/PluginDetailInfo.tsx@@ -8,6 +8,7 @@ import { DetailSection } from './PluginDetailSections'import { formatPluginReleaseDate } from '../presentation/plugin-release-date'import { usePluginRollbackVersion } from '../state/use-plugin-rollback-version'import { openAppHttpLink } from '@/lib/app-http-link-open'+import { pluginRepositoryPageUrl } from '../../../../../shared/plugins/catalog/plugin-repository-link'function InfoRow({label,@@ -32,9 +33,8 @@ function InfoRow({)}-function LinkButton({ url, label }: { url: string | null; label: string }) {- // Why: catalog and manifest links are untrusted; only open web links.- if (!url?.startsWith('https://')) {+function RepositoryLink({ url }: { url: string | null }) {+ if (!url) {return null}return (@@ -44,7 +44,7 @@ function LinkButton({ url, label }: { url: string | null; label: string }) {className="-ml-2"onClick={(event) => openAppHttpLink(url, { event })}>- {label}+ {translate('auto.components.settings.PluginDetailPage.repository', 'Repository')}<ArrowUpRight /></Button>)@@ -65,12 +65,10 @@ export function PluginDetailInfo({)const updated = formatPluginReleaseDate(listing?.updatedAt)const license = plugin?.license ?? listing?.license- const repository =- plugin?.repository ??- listing?.repository ??- listing?.source.url ??- (plugin?.source?.kind === 'git' ? plugin.source.reference : null)- const homepage = plugin?.homepage ?? listing?.homepage ?? null+ // Why only the install source: manifest and catalog `repository`/`homepage` are author text.+ const sourceUrl =+ listing?.source.url ?? (plugin?.source?.kind === 'git' ? plugin.source.reference : null)+ const repository = sourceUrl ? pluginRepositoryPageUrl(sourceUrl) : nullreturn (<aside className="mt-6">@@ -131,14 +129,7 @@ export function PluginDetailInfo({/></dl><div className="mt-2 flex flex-col items-start">- <LinkButton- url={repository}- label={translate('auto.components.settings.PluginDetailPage.repository', 'Repository')}- />- <LinkButton- url={homepage}- label={translate('auto.components.settings.PluginDetailInfo.homepage', 'Homepage')}- />+ <RepositoryLink url={repository} /></div></aside>)diff --git a/src/renderer/src/components/plugins/page/PluginDetailPage.test.tsx b/src/renderer/src/components/plugins/page/PluginDetailPage.test.tsxindex c33626014c1..d0d4ef0cc33 100644--- a/src/renderer/src/components/plugins/page/PluginDetailPage.test.tsx+++ b/src/renderer/src/components/plugins/page/PluginDetailPage.test.tsx@@ -173,6 +173,29 @@ describe('PluginDetailPage', () => {expect(install.install).toHaveBeenCalledWith(listing, { preview })})+ it('shows author links and hotlinked images as nothing, and links only the install source', async () => {+ const container = await render(+ pluginListEntryFromListing({+ ...listing,+ source: { kind: 'git', url: 'https://github.com/Acme/icons.git', ref: 'main' },+ description: 'Docs at https://evil.example and [click](javascript:alert(1))',+ homepage: 'https://evil.example/home',+ repository: 'https://evil.example/repo',+ changelog: 'See <a href="https://evil.example">notes</a>',+ images: { cover: { url: 'https://tracker.example/pixel.png', alt: 'Cover' } }+ }),+ () => Promise.resolve({ ok: true, preview })+ )+ expect(container.querySelectorAll('a, img')).toHaveLength(0)+ expect(container.textContent).toContain('See <a href="https://evil.example">notes</a>')+ expect(container.textContent).not.toContain('Homepage')+ const repository = Array.from(container.querySelectorAll('button')).find(+ (button) => button.textContent === 'Repository'+ )+ await act(async () => repository?.click())+ expect(window.api.shell.openUrl).toHaveBeenCalledWith('https://github.com/acme/icons')+ })+it('never claims no access when the plugin could not be read, and retries', async () => {const fetchPreview = vi.fn<(target: PluginMarketplaceHostListing) => Promise<PluginPagePreview>>()diff --git a/src/renderer/src/components/plugins/state/use-plugin-page-model.ts b/src/renderer/src/components/plugins/state/use-plugin-page-model.tsindex 91e89bc92cd..029bcef76ac 100644--- a/src/renderer/src/components/plugins/state/use-plugin-page-model.ts+++ b/src/renderer/src/components/plugins/state/use-plugin-page-model.ts@@ -5,7 +5,10 @@ import type {} from '../../../../../preload/api-types'import { pluginExecutionProfile } from '../../../../../shared/plugins/contributions/plugin-execution-profile'import { PLUGIN_CONTRIBUTION_SUMMARY_LIMIT } from '../../../../../shared/plugins/contributions/plugin-contribution-summary'-import type { PluginHostImages } from '../../../../../shared/plugins/images/plugin-image-url'+import {+ servedPluginHostImages,+ type PluginHostImages+} from '../../../../../shared/plugins/images/plugin-image-url'import type { PluginListEntry } from '../list/plugin-list-entries'import {installedPluginTrust,@@ -167,8 +170,9 @@ export function usePluginPageModel({?.filter((item) => item.kind === 'customEditors').flatMap((item) => (item.detail ? item.detail.split(', ') : [])) ?? null)- const images: PluginHostImages | undefined =+ const images: PluginHostImages | undefined = servedPluginHostImages(plugin?.images ?? listing?.images ?? shownPreview?.images+ )return {plugin,listing,diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.jsonindex 31ae812273b..50ba5144614 100644--- a/src/renderer/src/i18n/locales/de.json+++ b/src/renderer/src/i18n/locales/de.json@@ -13016,7 +13016,6 @@"previous": "Vorherige","updated": "Aktualisiert","license": "Lizenz",- "homepage": "Website","whatsNew": "Neuigkeiten"},"PluginDetailPage": {diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.jsonindex 380b8f83318..a4601906140 100644--- a/src/renderer/src/i18n/locales/en.json+++ b/src/renderer/src/i18n/locales/en.json@@ -13226,7 +13226,6 @@"previous": "Previous","updated": "Updated","license": "License",- "homepage": "Homepage","whatsNew": "What’s new","hashCopied": "Content hash copied","hashCopyFailed": "Couldn't copy the hash."diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.jsonindex 5ec0c4d6f24..8971d0562b5 100644--- a/src/renderer/src/i18n/locales/es.json+++ b/src/renderer/src/i18n/locales/es.json@@ -12831,7 +12831,6 @@"previous": "Anterior","updated": "Actualizado","license": "Licencia",- "homepage": "Página web","whatsNew": "Novedades","hashCopied": "Hash de contenido copiado","hashCopyFailed": "No se pudo copiar el hash."diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.jsonindex b47502e61eb..ec0cee6146a 100644--- a/src/renderer/src/i18n/locales/fr.json+++ b/src/renderer/src/i18n/locales/fr.json@@ -13055,7 +13055,6 @@"previous": "Précédente","updated": "Mis à jour","license": "Licence",- "homepage": "Page d’accueil","whatsNew": "Nouveautés","hashCopied": "Empreinte du contenu copiée","hashCopyFailed": "Impossible de copier l’empreinte."diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.jsonindex 3bc4958d1d2..dccc4ed7028 100644--- a/src/renderer/src/i18n/locales/ja.json+++ b/src/renderer/src/i18n/locales/ja.json@@ -12545,7 +12545,6 @@"previous": "以前のバージョン","updated": "更新日","license": "ライセンス",- "homepage": "ホームページ","whatsNew": "新機能","hashCopied": "コンテンツハッシュをコピーしました","hashCopyFailed": "ハッシュをコピーできませんでした。"diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.jsonindex 0025fa48bc5..ba1805447d9 100644--- a/src/renderer/src/i18n/locales/ko.json+++ b/src/renderer/src/i18n/locales/ko.json@@ -12545,7 +12545,6 @@"previous": "이전 버전","updated": "업데이트","license": "라이선스",- "homepage": "홈페이지","whatsNew": "새로운 기능","hashCopied": "콘텐츠 해시를 복사했습니다","hashCopyFailed": "해시를 복사할 수 없습니다."diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.jsonindex 83ed503edf9..f5ea8c07a0b 100644--- a/src/renderer/src/i18n/locales/pt.json+++ b/src/renderer/src/i18n/locales/pt.json@@ -9395,7 +9395,6 @@"previous": "Anterior","updated": "Atualizado","license": "Licença",- "homepage": "Site","whatsNew": "Novidades"},"PluginFilterPopover": {diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.jsonindex 0cc114c95a1..d610fd55d9d 100644--- a/src/renderer/src/i18n/locales/ru.json+++ b/src/renderer/src/i18n/locales/ru.json@@ -13378,7 +13378,6 @@"previous": "Предыдущая","updated": "Обновлено","license": "Лицензия",- "homepage": "Сайт","whatsNew": "Что нового"},"PluginDetailPage": {diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.jsonindex aa6d85497e6..2da292700b5 100644--- a/src/renderer/src/i18n/locales/tr.json+++ b/src/renderer/src/i18n/locales/tr.json@@ -13002,7 +13002,6 @@"previous": "Önceki","updated": "Güncellendi","license": "Lisans",- "homepage": "Web sitesi","whatsNew": "Yenilikler"},"PluginDetailPage": {diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.jsonindex 32bb85f82b6..71e6a1ec66f 100644--- a/src/renderer/src/i18n/locales/zh-Hant.json+++ b/src/renderer/src/i18n/locales/zh-Hant.json@@ -12839,7 +12839,6 @@"previous": "上一版","updated": "更新時間","license": "授權",- "homepage": "首頁","whatsNew": "新功能"},"PluginDetailPage": {diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.jsonindex 146c7dec7cc..31be9741eb4 100644--- a/src/renderer/src/i18n/locales/zh.json+++ b/src/renderer/src/i18n/locales/zh.json@@ -12578,7 +12578,6 @@"previous": "上一版本","updated": "更新于","license": "许可证",- "homepage": "主页","whatsNew": "新功能","hashCopied": "已复制内容哈希","hashCopyFailed": "无法复制哈希。"diff --git a/src/shared/plugins/catalog/plugin-repository-link.test.ts b/src/shared/plugins/catalog/plugin-repository-link.test.tsnew file mode 100644index 00000000000..247b6e54769--- /dev/null+++ b/src/shared/plugins/catalog/plugin-repository-link.test.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from 'vitest'+import { pluginRepositoryPageUrl } from './plugin-repository-link'++describe('pluginRepositoryPageUrl', () => {+ it('builds the repository page from the https or ssh install URL', () => {+ expect(pluginRepositoryPageUrl('https://github.com/Acme/Gleam.git')).toBe(+ 'https://github.com/acme/gleam'+ )+ expect(pluginRepositoryPageUrl('[email protected]:acme/tools/notes.git')).toBe(+ 'https://gitlab.com/acme/tools/notes'+ )+ })++ it('drops credentials, ports, queries and fragments from the URL it was given', () => {+ expect(pluginRepositoryPageUrl('https://user:[email protected]:443/acme/gleam?x=1#y')).toBe(+ 'https://github.com/acme/gleam'+ )+ })++ it('refuses other hosts, schemes and odd path segments', () => {+ for (const url of [+ 'https://evil.example/acme/gleam',+ 'https://github.com.evil.example/acme/gleam',+ 'javascript:alert(1)//github.com/acme/gleam',+ 'data:text/html,<a>',+ 'http://github.com/acme/gleam',+ 'https://github.com/acme/%2e%2e',+ 'https://github.com/acme'+ ]) {+ expect(pluginRepositoryPageUrl(url)).toBeNull()+ }+ })+})diff --git a/src/shared/plugins/catalog/plugin-repository-link.ts b/src/shared/plugins/catalog/plugin-repository-link.tsnew file mode 100644index 00000000000..a349a0ac8fa--- /dev/null+++ b/src/shared/plugins/catalog/plugin-repository-link.ts@@ -0,0 +1,19 @@+import { parseGitRepositoryIdentity } from './plugin-marketplace'++const LINKABLE_GIT_HOSTS = new Set(['github.com', 'gitlab.com'])+const PATH_SEGMENT_RE = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/++/** The web page of the git repository Orca installs a plugin from, built by Orca itself; null+ * unless it is on github.com or gitlab.com. Why: plugin- and catalog-supplied URLs are never+ * opened, so a listing cannot turn its page into a link to anywhere. */+export function pluginRepositoryPageUrl(gitUrl: string): string | null {+ const identity = parseGitRepositoryIdentity(gitUrl)+ if (!identity || !LINKABLE_GIT_HOSTS.has(identity.host)) {+ return null+ }+ const segments = identity.path.split('/')+ if (!segments.every((segment) => PATH_SEGMENT_RE.test(segment))) {+ return null+ }+ return `https://${identity.host}/${segments.join('/')}`+}diff --git a/src/shared/plugins/images/plugin-image-url.test.ts b/src/shared/plugins/images/plugin-image-url.test.tsnew file mode 100644index 00000000000..9e01006c61e--- /dev/null+++ b/src/shared/plugins/images/plugin-image-url.test.ts@@ -0,0 +1,21 @@+import { describe, expect, it } from 'vitest'+import { pluginShaImageUrl, servedPluginHostImages } from './plugin-image-url'++const served = { url: pluginShaImageUrl('a'.repeat(64)), alt: 'Cover' }++describe('servedPluginHostImages', () => {+ it('keeps only images main serves over the plugin image scheme', () => {+ const hotlinked = (url: string) => ({ url, alt: 'x' })+ expect(+ servedPluginHostImages({+ icon: hotlinked('https://tracker.example/pixel.png'),+ cover: served,+ screenshots: [hotlinked('data:image/svg+xml,<svg/>'), served, hotlinked('file:///etc/x')]+ })+ ).toEqual({ cover: served, screenshots: [served] })+ })++ it('drops everything when no image is served', () => {+ expect(servedPluginHostImages({ cover: { url: 'http://x/y.png', alt: 'x' } })).toEqual({})+ })+})diff --git a/src/shared/plugins/images/plugin-image-url.ts b/src/shared/plugins/images/plugin-image-url.tsindex b57e456bc2f..0cdc23a1989 100644--- a/src/shared/plugins/images/plugin-image-url.ts+++ b/src/shared/plugins/images/plugin-image-url.ts@@ -58,3 +58,23 @@ export function parsePluginImageUrl(url: string): PluginImageReference | null {}return null}++/** Only the images main serves over the plugin image scheme. Why: entries can come from a paired+ * remote host, and the renderer's CSP allows web images, so any other URL could hotlink. */+export function servedPluginHostImages(+ images: PluginHostImages | undefined+): PluginHostImages | undefined {+ if (!images) {+ return undefined+ }+ const served = <T extends PluginHostImage>(image: T | undefined): T | undefined =>+ image && parsePluginImageUrl(image.url) ? image : undefined+ const icon = served(images.icon)+ const cover = served(images.cover)+ const screenshots = images.screenshots?.filter((shot) => served(shot))+ return {+ ...(icon ? { icon } : {}),+ ...(cover ? { cover } : {}),+ ...(screenshots?.length ? { screenshots } : {})+ }+}