Versions 39 to 318
new file, 106 lines
1+// abso login --web: a staging website session handed to a browser as a one-use link, with no secret printed.
2+
9+
15+
16+test("the credential goes only to the staging website beside the folder's staging server (Security condition 6)", () => {
24+ assert.throws(() => siteFor("https://api.abso.dev", "http://localhost:8871", "pat"), /for staging/);
27+ assert.throws(() => siteFor(STAGING, "http://localhost:8871", "box"), /isn't taken with a box's sign-in/);
31+ for (const elsewhere of ["https://anywhere.example", SITE, "https://localhost:8871", "not a url"])
34+
37+ const fetcher = (async (url: string) => (sent.push(url), Response.json({}))) as unknown as typeof fetch;
47+ await assert.rejects(webLogin({ ...asked, credential, fetcher }), /Nothing was sent/, JSON.stringify(asked));
51+ await webLogin({ server: STAGING, site: undefined, kind: "pat", credential: () => PAT, fetcher }).catch(() => {});
54+
55+test("the credential goes in Authorization only, and the answer is the one link and who it signs in as", async () => {
58+ seen.push({ url, authorization: new Headers(init.headers).get("authorization"), body: init.body ?? null });
68+ assert.deepEqual(seen, [{ url: `${SITE}/login/handoff`, authorization: `Bearer ${BOX}`, body: null }]);
77+
78+test("a refusal says why without the credential; an answer that isn't the site's own link is refused", async () => {
80+ Response.json({ error: `that key was refused: ${BOX}` }, { status: 401 })) as unknown as typeof fetch;
86+ const off = (async () => Response.json({ error: "not found" }, { status: 404 })) as unknown as typeof fetch;
96+
- MCP
- compare on this site's /mcp
- CLI
- abso diff 39 318 client/test/web-session.test.ts --json
- JSON
- /christopher/abso-core/compare/39..318?file=client%2Ftest%2Fweb-session.test.ts&format=json