The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(skills): prompt on scan-blocked pasted-URL installs (#7082)
oxoxDev18d97afd8bc8
diff --git a/app/src/components/skills/InstallSkillDialog.tsx b/app/src/components/skills/InstallSkillDialog.tsxindex c167b131e7..aa8f4e2b95 100644--- a/app/src/components/skills/InstallSkillDialog.tsx+++ b/app/src/components/skills/InstallSkillDialog.tsx@@ -38,8 +38,10 @@ import {skillsApi,type WorkflowSummary,} from '../../services/api/skillsApi';+import type { ScanBlocked } from '../../services/api/skillRegistryApi';import { ModalShell, Spinner, TextField } from '../ui';import Button from '../ui/Button';+import ScanBlockedDialog from './ScanBlockedDialog';const log = debug('skills:install-dialog');@@ -155,6 +157,9 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {const [submitting, setSubmitting] = useState(false);const [error, setError] = useState<string | null>(null);const [result, setResult] = useState<InstallWorkflowFromUrlResult | null>(null);+ const [scanBlocked, setScanBlocked] = useState<ScanBlocked | null>(null);+ const [scanOverrideError, setScanOverrideError] = useState<string | null>(null);+ const [scanDeclined, setScanDeclined] = useState(false);const firstFieldRef = useRef<HTMLInputElement | null>(null);@@ -177,20 +182,31 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {};}, []);- const handleSubmit = useCallback(- async (e: React.FormEvent) => {- e.preventDefault();- if (!formValid) return;-+ const submitInstall = useCallback(+ async (acknowledgeScanFindings: boolean) => {const payload = {url: url.trim(),...(timeoutSecs.trim() ? { timeoutSecs: Number(timeoutSecs) } : {}),+ ...(acknowledgeScanFindings ? { acknowledgeScanFindings: true } : {}),};- log('submit url=%s timeout=%s', payload.url, payload.timeoutSecs ?? 'default');+ log(+ 'submit url=%s timeout=%s acknowledge=%s',+ payload.url,+ payload.timeoutSecs ?? 'default',+ acknowledgeScanFindings+ );setSubmitting(true);setError(null);+ setScanOverrideError(null);+ setScanDeclined(false);try {- const installed = await skillsApi.installWorkflowFromUrl(payload);+ const outcome = await skillsApi.installWorkflowFromUrl(payload);+ if (outcome.status === 'scan_blocked') {+ log('submit-scan-blocked findings=%d', outcome.scan.findings.length);+ setScanBlocked(outcome.scan);+ return;+ }+ const { status: _status, ...installed } = outcome;log('submit-ok new=%d stdout=%d stderr=%d',installed.newWorkflows.length,@@ -200,17 +216,28 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {for (const skillId of installed.newWorkflows) {trackEvent('skill_install', { skill_id: skillId });}+ setScanBlocked(null);setResult(installed);onInstalled(installed);} catch (err) {const message = err instanceof Error ? err.message : String(err);log('submit-err %s', message);- setError(message);+ if (acknowledgeScanFindings) setScanOverrideError(message);+ else setError(message);} finally {setSubmitting(false);}},- [formValid, onInstalled, timeoutSecs, url]+ [onInstalled, timeoutSecs, url]+ );++ const handleSubmit = useCallback(+ async (e: React.FormEvent) => {+ e.preventDefault();+ if (!formValid) return;+ await submitInstall(false);+ },+ [formValid, submitInstall]);return (@@ -379,6 +406,16 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {</div>) : null}+ {scanDeclined && !result ? (+ <div+ role="status"+ data-testid="install-scan-declined"+ className="rounded-xl border border-coral-200 bg-coral-50 p-3 text-xs text-coral-900">+ <p className="font-semibold">{t('skills.scan.declinedTitle')}</p>+ <p className="mt-1">{t('skills.scan.declinedHint')}</p>+ </div>+ ) : null}+{/* Error panel */}{error ? (<div@@ -404,6 +441,21 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {</div>) : null}</form>+ {scanBlocked ? (+ <ScanBlockedDialog+ skillName={scanBlocked.slug || url.trim()}+ scan={scanBlocked}+ installing={submitting}+ error={scanOverrideError}+ onBlock={() => {+ log('scan-blocked: user kept it uninstalled');+ setScanBlocked(null);+ setScanOverrideError(null);+ setScanDeclined(true);+ }}+ onInstallAnyway={() => void submitInstall(true)}+ />+ ) : null}</ModalShell>);}diff --git a/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx b/app/src/components/skills/__tests__/InstallSkillDialog.test.tsxindex 12debe3299..29eed19064 100644--- a/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx+++ b/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx@@ -20,6 +20,9 @@ vi.mock('../../../services/api/skillsApi', () => ({skillsApi: { installWorkflowFromUrl: vi.fn() },}));+const submitButton = () =>+ document.querySelector<HTMLButtonElement>('button[type="submit"]') as HTMLButtonElement;+describe('InstallSkillDialog', () => {beforeEach(async () => {const { skillsApi } = await import('../../../services/api/skillsApi');@@ -73,6 +76,7 @@ describe('InstallSkillDialog', () => {it('forwards timeoutSecs to skillsApi and fires onInstalled on success', async () => {const { skillsApi } = await import('../../../services/api/skillsApi');vi.mocked(skillsApi.installWorkflowFromUrl).mockResolvedValueOnce({+ status: 'installed',url: 'https://raw.githubusercontent.com/owner/repo/main/SKILL.md',stdout: 'added my-skill',stderr: '',@@ -107,6 +111,7 @@ describe('InstallSkillDialog', () => {it('omits timeoutSecs when field is blank', async () => {const { skillsApi } = await import('../../../services/api/skillsApi');vi.mocked(skillsApi.installWorkflowFromUrl).mockResolvedValueOnce({+ status: 'installed',url: 'https://raw.githubusercontent.com/owner/repo/main/SKILL.md',stdout: '',stderr: '',@@ -192,4 +197,79 @@ describe('InstallSkillDialog', () => {});expect(screen.getByRole('alert')).toHaveTextContent(/direct `?\.md`? links/i);});++ it('prompts when the scan blocks a pasted URL and installs only on Install anyway', async () => {+ const { skillsApi } = await import('../../../services/api/skillsApi');+ const onInstalled = vi.fn();+ vi.mocked(skillsApi.installWorkflowFromUrl).mockResolvedValueOnce({+ status: 'scan_blocked',+ scan: {+ target: 'https://example.com/SKILL.md',+ fetchedFrom: 'https://example.com/SKILL.md',+ slug: 'pasted',+ findings: [+ {+ check: 'hardcoded_credential',+ verdict: 'block',+ field: 'the document body',+ message: 'a hard-coded credential in the document body',+ },+ ],+ message: 'blocked',+ },+ });+ render(<InstallSkillDialog onClose={vi.fn()} onInstalled={onInstalled} />);+ fireEvent.change(screen.getByLabelText(/Skill URL/), {+ target: { value: 'https://example.com/SKILL.md' },+ });+ await act(async () => {+ fireEvent.click(submitButton());+ });++ expect(await screen.findByTestId('scan-blocked-dialog')).toBeInTheDocument();+ await act(async () => {+ fireEvent.click(screen.getByTestId('scan-blocked-block'));+ });+ expect(screen.queryByTestId('scan-blocked-dialog')).not.toBeInTheDocument();+ expect(screen.getByTestId('install-scan-declined')).toBeInTheDocument();+ expect(onInstalled).not.toHaveBeenCalled();++ vi.mocked(skillsApi.installWorkflowFromUrl).mockResolvedValueOnce({+ status: 'scan_blocked',+ scan: {+ target: 'https://example.com/SKILL.md',+ fetchedFrom: 'https://example.com/SKILL.md',+ slug: 'pasted',+ findings: [],+ message: 'blocked',+ },+ });+ await act(async () => {+ fireEvent.click(submitButton());+ });+ await screen.findByTestId('scan-blocked-dialog');+ vi.mocked(skillsApi.installWorkflowFromUrl).mockResolvedValueOnce({+ status: 'installed',+ url: 'https://example.com/SKILL.md',+ stdout: 'Installed to /x',+ stderr: '',+ newWorkflows: ['pasted'],+ });+ await act(async () => {+ fireEvent.click(screen.getByTestId('scan-blocked-install-anyway'));+ });++ await waitFor(() => expect(onInstalled).toHaveBeenCalledTimes(1));+ expect(vi.mocked(skillsApi.installWorkflowFromUrl).mock.calls.at(-1)?.[0]).toEqual({+ url: 'https://example.com/SKILL.md',+ acknowledgeScanFindings: true,+ });+ expect(onInstalled.mock.calls[0][0]).toEqual({+ url: 'https://example.com/SKILL.md',+ stdout: 'Installed to /x',+ stderr: '',+ newWorkflows: ['pasted'],+ });+ expect(screen.queryByTestId('scan-blocked-dialog')).not.toBeInTheDocument();+ });});