* feat(cli): add durable Hub login Keep organization-scoped human credentials separate from daemon relationship authority. Connect now exchanges explicit or stored CLI authority for a one-time enrollment token, while logout removes human access without implicitly disconnecting automation. * fix(cli): require TLS for remote Hub credentials Durable Hub credentials are bearer secrets, so remote origins must not receive them over cleartext HTTP. Keep literal loopback HTTP available for local Hub development. * fix(cli): make Hub destinations explicit Resolve optional Hub origins through one shared precedence policy so active logins remain the default context and credentials stay origin-bound. Report the selected destination before human-facing work, keep structured output auditable, and preserve login authority until requested daemon disconnection succeeds.
19 lines
589 B
TypeScript
19 lines
589 B
TypeScript
import { strict as assert } from "node:assert";
|
|
import { describe, it } from "vitest";
|
|
import { normalizeHubOrigin } from "./origin.js";
|
|
|
|
describe("Hub origin", () => {
|
|
it.each(["http://localhost:3000", "http://127.0.0.1:3000", "http://[::1]:3000"])(
|
|
"allows loopback HTTP for local development: %s",
|
|
(origin) => {
|
|
assert.equal(normalizeHubOrigin(origin), origin);
|
|
},
|
|
);
|
|
|
|
it("rejects cleartext credential transport to a remote Hub", () => {
|
|
assert.throws(() => normalizeHubOrigin("http://hub.example.com"), {
|
|
code: "HUB_INVALID_ORIGIN",
|
|
});
|
|
});
|
|
});
|