- MCP
- show on this site's /mcp
- CLI
- abso show 302 --json
- JSON
- /christopher/abso-core/versions/302?format=json
abso login --web: a staging website session in an agent's own browser with no secret in its hands. It sends this box's sign-in (or, with --pat-file, a test account's PAT read from that file) to the staging website's /login/handoff and prints only the one-use link it answers, which signs whichever browser opens it in as that person, within a minute. Prod has no website for it: agents never sign in there. Tests: client/test/web-session.test.ts.
of shared·box-grants··Not checked
Version 301 · Files at version 302
3 files, 203 lines added, 2 removed.
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -79,6 +79,7 @@
8283
@@ -212,13 +213,25 @@
217− "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]",
221+ "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>] | abso login --web [--pat-file <file>] [--site <url>]",
219− "Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only.",
223+ "Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only. --web, on staging only, signs a browser in to the website instead: it prints a link that works once, within a minute, and signs whichever browser opens it in as the person who approved this box (or, with --pat-file, the test account whose PAT that file holds). The box's sign-in, the PAT and the session never appear; agents never sign in to the website on prod.",
231+ throw new UsageError(`this box isn't signed in to ${server}: abso login first, or --pat-file <file>`);
232+ const handoff = await webHandoff(site, patFile === undefined ? record!.credential : patFromFile(patFile));
--- /dev/null
+++ b/client/src/web-session.ts
@@ -0,0 +1,117 @@
1+// abso login --web: a staging website session for the person a box is signed in as, opened in an agent's own browser, with
2+// no secret in the agent's hands. The website's /login/handoff takes this box's sign-in (or a test account's PAT, from a file)
3+// and answers a one-use link that works for a minute; opening it signs that browser in. Only the link is printed: never the
5+
8+
9+/** The website beside each staging server. Prod has none here: agents never sign in to the website on prod. */
11+ "https://abso-staging.chrisazy.workers.dev": "https://abso-website-staging.chrisazy.workers.dev",
12+ "https://avcs-staging.chrisazy.workers.dev": "https://abso-website-staging.chrisazy.workers.dev",
14+
15+/** What the website answers: the link, when it stops working, and who and until when it signs in. */
23+
24+/** The website a server's handoff goes to: --site as given (https only), else the staging site beside it. */
43+ `abso login --web is for staging: ${origin} has no staging website beside it that abso knows, and agents never sign in to the website on prod. --site names one.`,
47+
60+
65+
66+/** Asks the website for a handoff link with `credential` (a box sign-in or a PAT) in Authorization. */
67+export async function webHandoff(site: string, credential: string, fetcher: typeof fetch = fetch): Promise<Handoff> {
77+ throw new UsageError(`couldn't reach ${site}: ${scrubbed((err as Error).message, credential)}`);
109+
114+ `Open this link in your browser within ${seconds} seconds. It signs that browser in to ${site} as ${h.name}, until ${h.sessionEnds}, and works once:`,
--- /dev/null
+++ b/client/test/web-session.test.ts
@@ -0,0 +1,71 @@
1+// abso login --web: a staging website session handed to a browser as a one-use link, with no secret printed.
2+
9+
13+
14+test("the website is the staging one beside the server, or --site; prod has none, since agents never sign in there", () => {
17+ assert.throws(() => siteFor("https://api.abso.dev"), /for staging.*never sign in to the website on prod/);
18+ assert.equal(siteFor("https://api.abso.dev", "http://localhost:8871/x"), "http://localhost:8871");
21+
22+test("the credential goes in Authorization only, and the answer is the one link and who it signs in as", async () => {
25+ seen.push({ url, authorization: new Headers(init.headers).get("authorization"), body: init.body ?? null });
35+ assert.deepEqual(seen, [{ url: `${SITE}/login/handoff`, authorization: `Bearer ${BOX}`, body: null }]);
42+
43+test("a refusal says why without the credential; an answer that isn't the site's own link is refused", async () => {
45+ Response.json({ error: `that key was refused: ${BOX}` }, { status: 401 })) as unknown as typeof fetch;
51+ const off = (async () => Response.json({ error: "not found" }, { status: 404 })) as unknown as typeof fetch;
61+