A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.

9 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-browser.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-browser.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-browser.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 toolbar: Back and Forward are greyed out when there's nowhere to go cc08c7a 1 week, 2 days ago History
urls.test.ts · 916 bytes · 19 lines
1import { describe, expect, it } from "vitest";
2import { safeExternalUrl } from "../src/urls.js";
3
4describe("safeExternalUrl", () => {
5 it("allows http(s) and normalizes", () => {
6 expect(safeExternalUrl("https://www.ebay.com/itm/1?x=2")).toBe("https://www.ebay.com/itm/1?x=2");
7 expect(safeExternalUrl("http://127.0.0.1:8899")).toBe("http://127.0.0.1:8899/");
8 });
9 it("refuses everything that could launch something else", () => {
10 for (const bad of ["file:///etc/passwd", "javascript:alert(1)", "data:text/html,x", "vscode://open", "ssh://host", "about:blank", "", "not a url"]) {
11 expect(safeExternalUrl(bad)).toBeNull();
12 }
13 });
14 it("refuses embedded credentials and non-strings", () => {
15 expect(safeExternalUrl("https://user:pw@example.com/")).toBeNull();
16 expect(safeExternalUrl(undefined)).toBeNull();
17 expect(safeExternalUrl({ href: "https://a.test" })).toBeNull();
18 });
19});