@knpkv/jcf-web 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,219 +1,27 @@
1
- /**
2
- * Who may talk to this server.
3
- *
4
- * **Mental model**
5
- *
6
- * - **One process, one operator.** The server binds a loopback address and mints a session token for
7
- * itself at startup. There is no user table and no login: the person who can read the terminal is
8
- * the person who gets in, which is exactly the authority a tool that writes to their own timesheet
9
- * should have.
10
- * - **The URL is the handshake.** The bootstrap code is printed once, in a fragment the browser
11
- * never sends upstream, and is spent the first time it is exchanged for the session cookie.
12
- * - **A read needs the cookie and must not be a browser cross-origin request; a write also needs the
13
- * expected origin and CSRF header.** Another page in the same browser can make the browser send a
14
- * cookie, but Fetch Metadata keeps that page from starting agent-backed reads without an Origin.
15
- *
16
- * The rules are those of `@knpkv/codecommit-web`'s owner session, over the same
17
- * `@knpkv/browser-pairing` credential primitives. They are re-stated here rather than imported
18
- * because that module is private to that application; the shared home for them is a later job than
19
- * this one, and duplicating the *policy* while sharing the *primitives* is the smaller of the two
20
- * mistakes available.
21
- *
22
- * @module
23
- */
24
- import { credentialValuesEqual, decideOneTimeCredential, expiresAt, issueCsrfToken, issuePairingCode, issueSessionToken, serializeCredentialCookie } from "@knpkv/browser-pairing";
25
- import { Clock, Context, Effect, Layer, Redacted, Ref, Schema } from "effect";
26
- import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
1
+ import * as OwnerSession from "@knpkv/browser-pairing/owner-session";
2
+ import { Effect, Layer, Redacted } from "effect";
27
3
  import { ForbiddenApiError, OwnerSessionAuth, UnauthorizedApiError } from "./Api.js";
28
- /** How long the printed bootstrap URL stays usable. Long enough to click, short enough to forget. */
29
- const BOOTSTRAP_LIFETIME_MILLIS = 60_000;
30
- /**
31
- * Failed bootstrap exchanges before the exchange closes for the life of the process.
32
- *
33
- * The code is high-entropy, so this is not what makes guessing hard — it is what stops a process
34
- * that is being guessed at from staying open all afternoon.
35
- */
36
- const MAX_BOOTSTRAP_FAILURES = 5;
37
- /** Methods that only read. They need the session, but no origin and no CSRF token. */
38
- const safeMethods = new Set(["GET", "HEAD", "OPTIONS"]);
39
- /**
40
- * The one origin other than the bound server that may hold a session: the Vite dev server, which
41
- * proxies both the API and the bootstrap exchange, so the browser stays on a single origin.
42
- */
43
- const devPublicOrigin = "http://localhost:5173";
44
- export class OwnerSessionSecrets extends Context.Service()("@knpkv/jcf-web/OwnerSessionSecrets") {
45
- }
46
- export class UnsafeServerOriginError extends Schema.TaggedError()("UnsafeServerOriginError", { message: Schema.String, origin: Schema.String }) {
47
- }
48
- export const isLoopbackHostname = (hostname) => hostname === "127.0.0.1" || hostname === "localhost" || hostname === "::1" || hostname === "[::1]";
49
- export const ownerSessionOrigin = (hostname, port) => `http://${hostname === "::1" ? "[::1]" : hostname}:${port}`;
50
- export const requireLoopbackOrigin = Effect.fn("OwnerSession.requireLoopbackOrigin")(function* (origin) {
51
- const url = yield* Effect.try({
52
- catch: () => new UnsafeServerOriginError({ message: "jcf-web needs a valid HTTP origin", origin }),
53
- try: () => new URL(origin)
4
+ /** Build the session for a server bound at `authorityOrigin`, advertised at `configuredPublicOrigin`. */
5
+ export const makeOwnerSession = Effect.fn("JcfWeb.makeOwnerSession")(function* (authorityOrigin, configuredPublicOrigin) {
6
+ return yield* OwnerSession.make({
7
+ authorityOrigin,
8
+ browserOrigin: yield* OwnerSession.resolvePublicOrigin(configuredPublicOrigin, authorityOrigin),
9
+ cookieName: "jcf_owner",
10
+ freshUrlHint: "restart jcf-web for a fresh URL",
11
+ product: "jcf-web",
12
+ writes: "csrf"
54
13
  });
55
- if (url.protocol !== "http:" || !isLoopbackHostname(url.hostname) || url.search !== "" || url.hash !== "") {
56
- return yield* new UnsafeServerOriginError({
57
- message: "jcf-web may only be reached over HTTP on a loopback host",
58
- origin
59
- });
60
- }
61
- return url.origin;
62
- });
63
- /** The advertised origin: the bound server, or the dev server that proxies to it. */
64
- export const resolvePublicOrigin = Effect.fn("OwnerSession.resolvePublicOrigin")(function* (configuredOrigin, authorityOrigin) {
65
- const authority = yield* requireLoopbackOrigin(authorityOrigin);
66
- if (configuredOrigin === undefined)
67
- return authority;
68
- const configured = yield* requireLoopbackOrigin(configuredOrigin);
69
- if (configured !== authority && configured !== devPublicOrigin) {
70
- return yield* new UnsafeServerOriginError({
71
- message: "jcf-web's public origin must be the bound server or its dev proxy",
72
- origin: configuredOrigin
73
- });
74
- }
75
- return configured;
76
- });
77
- export const makeOwnerSessionSecrets = Effect.fn("OwnerSession.makeSecrets")(function* (authorityOrigin, configuredPublicOrigin) {
78
- const validated = yield* requireLoopbackOrigin(authorityOrigin);
79
- const browserOrigin = yield* resolvePublicOrigin(configuredPublicOrigin, validated);
80
- const [ownerToken, csrfToken, bootstrapToken] = yield* Effect.all([
81
- issueSessionToken(),
82
- issueCsrfToken(),
83
- issuePairingCode()
84
- ]);
85
- return OwnerSessionSecrets.of({
86
- authorityOrigin: validated,
87
- bootstrapAttemptState: yield* Ref.make({ failedAttempts: 0, inFlight: 0 }),
88
- bootstrapAvailable: yield* Ref.make(true),
89
- bootstrapExpiresAtMillis: yield* Ref.make(undefined),
90
- bootstrapToken,
91
- browserOrigin,
92
- csrfToken,
93
- ownerToken
94
- });
95
- });
96
- /** Start the bootstrap clock. Called once the server is actually listening, never before. */
97
- export const activateOwnerSessionBootstrap = Effect.fn("OwnerSession.activateBootstrap")(function* (secrets) {
98
- const now = yield* Clock.currentTimeMillis;
99
- yield* Ref.set(secrets.bootstrapExpiresAtMillis, yield* expiresAt(now, BOOTSTRAP_LIFETIME_MILLIS));
100
- });
101
- /**
102
- * The URL to open. The code rides in the fragment, which browsers do not send to servers and
103
- * proxies do not log, and the page strips it from the address bar once it has been spent.
104
- */
105
- export const ownerSessionUrl = (publicOrigin, secrets) => `${publicOrigin.replace(/\/+$/u, "")}/#bootstrap_token=${encodeURIComponent(Redacted.value(secrets.bootstrapToken))}`;
106
- export const ownerSessionCookie = (secrets) => serializeCredentialCookie(secrets.ownerToken, {
107
- httpOnly: true,
108
- name: "jcf_owner",
109
- path: "/api",
110
- sameSite: "strict",
111
- secure: false
112
- });
113
- const fetchSites = new Set(["cross-site", "none", "same-origin", "same-site"]);
114
- export const authorizeOwnerRequest = Effect.fn("OwnerSession.authorizeRequest")(function* (request, secrets) {
115
- if (credentialValuesEqual(request.credential, Redacted.value(secrets.ownerToken)) !== true) {
116
- return yield* new UnauthorizedApiError({ message: "Missing or invalid owner session" });
117
- }
118
- const sameOrigin = request.origin !== undefined && request.origin === secrets.browserOrigin;
119
- if (request.origin !== undefined && !sameOrigin) {
120
- return yield* new ForbiddenApiError({ message: "Request origin does not match this jcf-web server" });
121
- }
122
- if (request.fetchSite !== undefined && !fetchSites.has(request.fetchSite)) {
123
- return yield* new ForbiddenApiError({ message: "Request carries invalid browser site metadata" });
124
- }
125
- if (request.fetchSite === "cross-site" ||
126
- (!sameOrigin && (request.fetchSite === "same-site" || request.fetchSite === "none"))) {
127
- return yield* new ForbiddenApiError({ message: "Browser request is not from this jcf-web page" });
128
- }
129
- // An explicit client such as curl carries neither Origin nor Fetch Metadata and remains allowed:
130
- // it still has to present the process-scoped session cookie. Browser-marked cross-origin reads
131
- // are rejected before their handler can start provider or agent work.
132
- if (safeMethods.has(request.method.toUpperCase()))
133
- return;
134
- if (!sameOrigin) {
135
- return yield* new ForbiddenApiError({ message: "Mutation origin does not match this jcf-web server" });
136
- }
137
- const csrfMatches = request.csrfToken !== undefined &&
138
- credentialValuesEqual(request.csrfToken, Redacted.value(secrets.csrfToken)) === true;
139
- if (!csrfMatches)
140
- return yield* new ForbiddenApiError({ message: "Missing or invalid CSRF token" });
141
- });
142
- const bearerToken = (authorization) => authorization !== undefined && authorization.startsWith("Bearer ")
143
- ? authorization.slice("Bearer ".length)
144
- : undefined;
145
- export const authorizeBootstrapRequest = Effect.fn("OwnerSession.authorizeBootstrap")(function* (request, secrets) {
146
- if (request.origin !== secrets.browserOrigin) {
147
- return yield* new ForbiddenApiError({ message: "Bootstrap origin does not match this jcf-web server" });
148
- }
149
- const supplied = bearerToken(request.authorization);
150
- // Counted before the code is even compared, so a burst of parallel guesses cannot all pass the
151
- // check together and then be counted afterwards.
152
- const admit = Ref.modify(secrets.bootstrapAttemptState, (state) => {
153
- if (state.failedAttempts + state.inFlight >= MAX_BOOTSTRAP_FAILURES)
154
- return ["unavailable", state];
155
- const matches = supplied !== undefined &&
156
- credentialValuesEqual(supplied, Redacted.value(secrets.bootstrapToken)) === true;
157
- if (!matches) {
158
- return ["invalid", {
159
- failedAttempts: Math.min(MAX_BOOTSTRAP_FAILURES, state.failedAttempts + 1),
160
- inFlight: state.inFlight
161
- }];
162
- }
163
- return ["accepted", { ...state, inFlight: state.inFlight + 1 }];
164
- }).pipe(Effect.flatMap((admission) => admission === "unavailable"
165
- ? Effect.fail(new UnauthorizedApiError({ message: "Bootstrap is closed for this process" }))
166
- : admission === "invalid"
167
- ? Effect.fail(new UnauthorizedApiError({ message: "Missing or invalid bootstrap token" }))
168
- : Effect.void));
169
- return yield* Effect.acquireUseRelease(admit, () => Effect.gen(function* () {
170
- const expiry = yield* Ref.get(secrets.bootstrapExpiresAtMillis);
171
- if (expiry === undefined)
172
- return yield* new UnauthorizedApiError({ message: "Bootstrap is not active yet" });
173
- const now = yield* Clock.currentTimeMillis;
174
- const decision = yield* Ref.modify(secrets.bootstrapAvailable, (available) => {
175
- const next = decideOneTimeCredential({ consumedAt: available ? null : 0, expiresAt: expiry, revokedAt: null }, now);
176
- return [next, next === "accepted" ? false : available];
177
- });
178
- if (decision === "accepted")
179
- return;
180
- const message = decision === "expired"
181
- ? "Bootstrap token has expired — restart jcf-web for a fresh URL"
182
- : decision === "consumed"
183
- ? "Bootstrap token has already been used"
184
- : "Bootstrap token state is invalid";
185
- return yield* new UnauthorizedApiError({ message });
186
- }), () => Ref.update(secrets.bootstrapAttemptState, (state) => ({ ...state, inFlight: Math.max(0, state.inFlight - 1) })));
187
14
  });
188
15
  export const ownerSessionAuthLayer = Layer.effect(OwnerSessionAuth, Effect.gen(function* () {
189
- const secrets = yield* OwnerSessionSecrets;
16
+ const session = yield* OwnerSession.OwnerSession;
190
17
  return OwnerSessionAuth.of({
191
- ownerCookie: Effect.fn("OwnerSession.ownerCookie")(function* (httpEffect, { credential }) {
192
- const request = yield* HttpServerRequest.HttpServerRequest;
193
- yield* authorizeOwnerRequest({
194
- credential: Redacted.value(credential),
195
- csrfToken: request.headers["x-csrf-token"],
196
- fetchSite: request.headers["sec-fetch-site"],
197
- method: request.method,
198
- origin: request.headers.origin
199
- }, secrets);
18
+ ownerCookie: Effect.fn("JcfWeb.ownerCookie")(function* (httpEffect, { credential }) {
19
+ yield* session.authorizeHttp(Redacted.value(credential)).pipe(Effect.catchTags({
20
+ OwnerSessionForbiddenError: ({ message }) => Effect.fail(new ForbiddenApiError({ message })),
21
+ OwnerSessionUnauthorizedError: ({ message }) => Effect.fail(new UnauthorizedApiError({ message }))
22
+ }));
200
23
  return yield* httpEffect;
201
24
  })
202
25
  });
203
26
  }));
204
- /** The one route outside the authenticated API: spending the printed code for a session. */
205
- export const OwnerSessionBootstrapRouter = HttpRouter.use((router) => router.add("POST", "/auth/bootstrap", Effect.gen(function* () {
206
- const secrets = yield* OwnerSessionSecrets;
207
- const request = yield* HttpServerRequest.HttpServerRequest;
208
- const result = yield* Effect.result(authorizeBootstrapRequest({ authorization: request.headers.authorization, origin: request.headers.origin }, secrets));
209
- if (result._tag === "Failure") {
210
- return HttpServerResponse.text(result.failure.message, {
211
- status: result.failure._tag === "UnauthorizedApiError" ? 401 : 403
212
- });
213
- }
214
- return yield* HttpServerResponse.json({ csrfToken: Redacted.value(secrets.csrfToken) }, {
215
- headers: { "cache-control": "no-store", "set-cookie": ownerSessionCookie(secrets) },
216
- status: 200
217
- });
218
- })));
219
27
  //# sourceMappingURL=OwnerSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwnerSession.js","sourceRoot":"","sources":["../../src/server/Owner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E,MAAM,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,EAAC,UAAU,EAAE,EAAE,UAAU,EAAE;YAC/E,KAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAC3D,MAAM,CAAC,SAAS,CAAC;gBACf,0BAA0B,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC5F,6BAA6B,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;aACnG,CAAC,CACH,CAAA;YACD,OAAO,KAAK,CAAC,CAAC,UAAU,CAAA;QAC1B,CAAC,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA"}
@@ -1,10 +1,11 @@
1
+ import * as OwnerSession from "@knpkv/browser-pairing/owner-session";
1
2
  import { Config, Deferred, Layer, Schema } from "effect";
2
- import { type OwnerSessionSecretsContract } from "./OwnerSession.js";
3
3
  export interface JcfWebServerOptions {
4
4
  readonly hostname?: string;
5
5
  readonly port: number;
6
- readonly ready?: Deferred.Deferred<void>;
7
- readonly security: OwnerSessionSecretsContract;
6
+ /** Completed with the bootstrap URL once the server is listening. */
7
+ readonly ready?: Deferred.Deferred<string>;
8
+ readonly security: OwnerSession.OwnerSessionService;
8
9
  }
9
10
  export declare const makeServer: (options: JcfWebServerOptions) => Layer.Layer<never, import("@knpkv/browser-pairing").BrowserPairingError | Config.ConfigError | Schema.SchemaError | import("effect/http/HttpServerError").ServeError, never>;
10
11
  /** The port to bind. Deliberately not 3000: the CodeCommit web app already lives there. */
@@ -13,15 +13,16 @@
13
13
  * @module
14
14
  */
15
15
  import { NodeHttpServer, NodeServices } from "@effect/platform-node";
16
+ import * as OwnerSession from "@knpkv/browser-pairing/owner-session";
16
17
  import { Layers } from "@knpkv/jira-clockify";
17
18
  import { Config, Deferred, Effect, Layer, Schema } from "effect";
18
19
  import { Etag, HttpPlatform, HttpRouter } from "effect/http";
19
20
  import { createServer } from "node:http";
20
21
  import { application } from "./HttpApplication.js";
21
- import { activateOwnerSessionBootstrap, OwnerSessionSecrets } from "./OwnerSession.js";
22
22
  const HttpPlatformLive = HttpPlatform.layer.pipe(Layer.provide(NodeServices.layer));
23
- const LoopbackHostname = Schema.Literals(["127.0.0.1", "localhost", "::1"]);
24
- export const makeServer = (options) => Layer.unwrap(Schema.decodeUnknownEffect(LoopbackHostname)(options.hostname ?? "127.0.0.1").pipe(Effect.map((hostname) => HttpRouter.serve(application.pipe(Layer.provide(Layers.HeadlessLayer))).pipe(Layer.provide(NodeHttpServer.layerServer(createServer, { host: hostname, port: options.port })), Layer.provide(Etag.layer), Layer.provide(HttpPlatformLive), Layer.provide(NodeServices.layer), Layer.provide(Layer.succeed(OwnerSessionSecrets, options.security)), Layer.tap(() => activateOwnerSessionBootstrap(options.security).pipe(Effect.andThen(options.ready === undefined ? Effect.void : Deferred.succeed(options.ready, undefined))))))));
23
+ export const makeServer = (options) => Layer.unwrap(Schema.decodeUnknownEffect(OwnerSession.LoopbackHostname)(options.hostname ?? "127.0.0.1").pipe(Effect.map((hostname) => HttpRouter.serve(application.pipe(Layer.provide(Layers.HeadlessLayer))).pipe(Layer.provide(NodeHttpServer.layerServer(createServer, { host: hostname, port: options.port })), Layer.provide(Etag.layer), Layer.provide(HttpPlatformLive), Layer.provide(NodeServices.layer), Layer.provide(Layer.succeed(OwnerSession.OwnerSession, options.security)), Layer.tap(() =>
24
+ // The startup link: minted only once the server is listening, handed to whoever prints it.
25
+ options.security.mintBootstrapCode.pipe(Effect.map((code) => OwnerSession.bootstrapUrl(options.security.browserOrigin, code)), Effect.flatMap((url) => options.ready === undefined ? Effect.void : Deferred.succeed(options.ready, url))))))));
25
26
  /** The port to bind. Deliberately not 3000: the CodeCommit web app already lives there. */
26
27
  export const Port = Config.Int("PORT").pipe(Config.withDefault(3111));
27
28
  /** Set by `pnpm dev` so the printed URL points at the Vite dev server that proxies here. */
@@ -1 +1 @@
1
- {"version":3,"file":"Server.js","sourceRoot":"","sources":["../../src/server/Server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAoC,MAAM,mBAAmB,CAAA;AAExH,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AACnF,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAA;AAS3E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAA4B,EAAE,EAAE,CACzD,KAAK,CAAC,MAAM,CACV,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC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