Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

1.1 KB
Raw Blame
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.

import { describe, expect, it } from "vitest";
import { opensOutside } from "../src/external-url";

describe("what the app opens outside itself", () => {
  it("opens web pages and the diagnostic report's email to Cua support", () => {
    for (const url of [
      "https://cua.ai/pricing",
      "http://localhost:8080/x",
      "mailto:[email protected]",
      "mailto:[email protected]?subject=Spaces%3A%20create%20failed&body=a%0D%0Ab",
    ]) {
      expect(opensOutside(url), url).toBe(true);
    }
  });

  it("keeps everything else closed, including mail to anyone else", () => {
    for (const url of [
      "",
      "file:///etc/passwd",
      "javascript:alert(1)",
      "mailto:[email protected]?subject=x",
      "mailto:[email protected],[email protected]",
      "mailto:[email protected]",
      "mailto:[email protected][email protected]",
      "mailto:[email protected]?subject=x&[email protected]",
      "mailto:[email protected]?subject=a b",
    ]) {
      expect(opensOutside(url), url).toBe(false);
    }
  });
});