@c9up/transit 0.1.6 → 0.1.7

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.
package/dist/saml.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"saml.js","sourceRoot":"","sources":["../src/saml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAmB,MAAM,UAAU,CAAC;AAExE,MAAM,CAAC,MAAM,gBAAgB,GAAG,sCAAsC,CAAC;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AACzE,MAAM,cAAc,GAAG,4CAA4C,CAAC;AACpE,MAAM,MAAM,GAAG,uCAAuC,CAAC;AAEvD,MAAM,OAAO,SAAU,SAAQ,KAAK;IACnC,YAAY,OAAe;QAC1B,KAAK,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IACzB,CAAC;CACD;AAoCD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAoB;IAC3D,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,MAAM;QAClB,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;IACb,MAAM,KAAK,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,KAAK,CAAC;IACvE,IAAI,KAAK,KAAK,cAAc;QAAE,OAAO;IAErC,MAAM,OAAO,GAAG,MAAM;QACrB,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE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,CAAC;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AACrE,CAAC"}
@@ -1,4 +1,19 @@
1
- export interface QuasarConnectionRequest {
1
+ /**
2
+ * The commands among `commands` that `value` does not carry as functions.
3
+ *
4
+ * Reads go through the same catch as above, so a command whose read throws
5
+ * counts as missing.
6
+ */
7
+ export declare function missingCommands(value: unknown, commands: readonly string[]): string[];
8
+ /**
9
+ * Whether `value` carries every one of `commands` as a function.
10
+ *
11
+ * The building block of the guard a caller passes as `isConnection`, over the
12
+ * same list it passes as `required` — which is what names the gap when the
13
+ * guard says no.
14
+ */
15
+ export declare function hasCommands(value: unknown, commands: readonly string[]): value is object;
16
+ export interface QuasarConnectionRequest<T> {
2
17
  /** The package asking. It prefixes every message this can raise. */
3
18
  pkg: string;
4
19
  /**
@@ -12,8 +27,16 @@ export interface QuasarConnectionRequest {
12
27
  raise: (reason: "quasar-missing" | "incomplete-connection", message: string, cause?: unknown) => Error;
13
28
  /** Connection name, or `undefined` for quasar's default. */
14
29
  name?: string;
15
- /** The commands the caller will actually issue. */
30
+ /** The commands the caller will actually issue, named in the message. */
16
31
  required: readonly string[];
32
+ /**
33
+ * The caller's check that the connection is the client it needs.
34
+ *
35
+ * Written by the caller over the commands it issues (`hasCommands` with
36
+ * `required` does it), because only the caller knows its client type. The
37
+ * connection is handed over only once this has said yes.
38
+ */
39
+ isConnection: (value: unknown) => value is T;
17
40
  /** What the caller does with them, for the message that names a gap. */
18
41
  what: string;
19
42
  /**
@@ -31,5 +54,5 @@ export interface QuasarConnectionRequest {
31
54
  * handed over — a connection missing one would otherwise fail on the first
32
55
  * command, far from the line that asked for it.
33
56
  */
34
- export declare function quasarConnection<T>(request: QuasarConnectionRequest): Promise<T>;
57
+ export declare function quasarConnection<T>(request: QuasarConnectionRequest<T>): Promise<T>;
35
58
  //# sourceMappingURL=quasarConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quasarConnection.d.ts","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AAiDA,MAAM,WAAW,uBAAuB;IACvC,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,CACN,MAAM,EAAE,gBAAgB,GAAG,uBAAuB,EAClD,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,KACX,KAAK,CAAC;IACX,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACvC,OAAO,EAAE,uBAAuB,GAC9B,OAAO,CAAC,CAAC,CAAC,CAuCZ"}
1
+ {"version":3,"file":"quasarConnection.d.ts","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AA0DA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,EAAE,CAIV;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,KAAK,IAAI,MAAM,CAGjB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACzC,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,CACN,MAAM,EAAE,gBAAgB,GAAG,uBAAuB,EAClD,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,KACX,KAAK,CAAC;IACX,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;IAC7C,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACvC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAsDZ"}
@@ -3,29 +3,42 @@
3
3
  // This package is published and built from its own repository, so the file
4
4
  // has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
5
5
  // and `pnpm vendor:check` fails if this copy has drifted from the original.
6
- /**
7
- * Read a member without assuming how the object answers.
8
- *
9
- * Two shapes have to work, and they disagree about `in`. Quasar's accessor is
10
- * a Proxy over an empty null-prototype object with only a `get` trap, so
11
- * `"connection" in manager` is FALSE while reading it returns the function —
12
- * gating on `in` rejected the real manager. And a module namespace under a
13
- * test double RAISES for an export it does not have, rather than answering
14
- * undefined, so a bare read fails on the mock. Reading through a catch is what
15
- * satisfies both.
16
- */
17
6
  function readMember(value, name) {
18
7
  if (typeof value !== "object" || value === null)
19
- return undefined;
8
+ return { value: undefined };
20
9
  try {
21
- return Reflect.get(value, name);
10
+ return { value: Reflect.get(value, name) };
22
11
  }
23
- catch {
24
- return undefined;
12
+ catch (threw) {
13
+ return { threw };
25
14
  }
26
15
  }
16
+ function memberValue(read) {
17
+ return "value" in read ? read.value : undefined;
18
+ }
27
19
  function isConnectionSource(value) {
28
- return typeof readMember(value, "connection") === "function";
20
+ return typeof memberValue(readMember(value, "connection")) === "function";
21
+ }
22
+ /**
23
+ * The commands among `commands` that `value` does not carry as functions.
24
+ *
25
+ * Reads go through the same catch as above, so a command whose read throws
26
+ * counts as missing.
27
+ */
28
+ export function missingCommands(value, commands) {
29
+ return commands.filter((command) => typeof memberValue(readMember(value, command)) !== "function");
30
+ }
31
+ /**
32
+ * Whether `value` carries every one of `commands` as a function.
33
+ *
34
+ * The building block of the guard a caller passes as `isConnection`, over the
35
+ * same list it passes as `required` — which is what names the gap when the
36
+ * guard says no.
37
+ */
38
+ export function hasCommands(value, commands) {
39
+ if (typeof value !== "object" || value === null)
40
+ return false;
41
+ return missingCommands(value, commands).length === 0;
29
42
  }
30
43
  /**
31
44
  * The named connection, checked for the commands the caller needs BEFORE it is
@@ -33,7 +46,7 @@ function isConnectionSource(value) {
33
46
  * command, far from the line that asked for it.
34
47
  */
35
48
  export async function quasarConnection(request) {
36
- const { pkg, name, required, what, raise, alternative } = request;
49
+ const { pkg, name, required, what, raise, alternative, isConnection } = request;
37
50
  const specifier = "@c9up/quasar/services/main";
38
51
  let loaded;
39
52
  try {
@@ -43,20 +56,28 @@ export async function quasarConnection(request) {
43
56
  throw raise("quasar-missing", `[${pkg}] ${what} asks for the quasar connection "${name ?? "default"}", but @c9up/quasar is not installed.\n` +
44
57
  ` pnpm add @c9up/quasar${alternative ? `, ${alternative}` : ""}`, cause);
45
58
  }
46
- const manager = isConnectionSource(loaded)
59
+ // The namespace itself may be the manager (a test double); a throw there is
60
+ // the mock refusing an export it lacks, not an answer.
61
+ const direct = memberValue(readMember(loaded, "connection"));
62
+ const manager = typeof direct === "function"
47
63
  ? loaded
48
- : Reflect.get(Object(loaded), "default");
64
+ : memberValue(readMember(Object(loaded), "default"));
65
+ const read = readMember(manager, "connection");
66
+ if ("threw" in read) {
67
+ throw raise("quasar-missing", `[${pkg}] ${what} asks for the quasar connection "${name ?? "default"}", but @c9up/quasar's manager is not available yet: ` +
68
+ "its provider has not booted, or is not registered in this application's providers.", read.threw);
69
+ }
49
70
  if (!isConnectionSource(manager)) {
50
71
  throw raise("quasar-missing", `[${pkg}] @c9up/quasar/services/main did not expose a connection() manager`);
51
72
  }
52
73
  const connection = manager.connection(name);
53
- const missing = required.filter((command) => typeof readMember(connection, command) !== "function");
74
+ const missing = missingCommands(connection, required);
54
75
  if (missing.length > 0) {
55
76
  throw raise("incomplete-connection", `[${pkg}] the quasar connection${name ? ` '${name}'` : ""} is missing ${missing.join(", ")}, which ${what} issues`);
56
77
  }
57
- // Load-bearing: every member of `required` has just been checked to be a
58
- // function on this object. The caller names the type it needs because only
59
- // the caller knows which commands it asked for.
78
+ if (!isConnection(connection)) {
79
+ throw raise("incomplete-connection", `[${pkg}] the quasar connection${name ? ` '${name}'` : ""} is not the client ${what} needs`);
80
+ }
60
81
  return connection;
61
82
  }
62
83
  //# sourceMappingURL=quasarConnection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quasarConnection.js","sourceRoot":"","sources":["../../src/vendor/quasarConnection.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAqB5E;;;;;;;;;;GAUG;AACH,SAAS,UAAU,CAAC,KAAc,EAAE,IAAY;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,IAAI,CAAC;QACJ,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACzC,OAAO,OAAO,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,UAAU,CAAC;AAC9D,CAAC;AAmCD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,OAAgC;IAEhC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAClE,M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,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,KAAK,CACV,gBAAgB,EAChB,IAAI,GAAG,oEAAoE,CAC3E,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACtD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,KAAK,CACV,uBAAuB,EACvB,IAAI,GAAG,0BAA0B,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,eAAe,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,SAAS,CAClH,CAAC;IACH,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,CACV,uBAAuB,EACvB,IAAI,GAAG,0BAA0B,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,sBAAsB,IAAI,QAAQ,CAC3F,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/transit",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Transit — federated sign-in for the Ream framework: SAML 2.0, LDAP, OpenID Connect, OAuth1, OAuth2",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -165,7 +165,9 @@ export class LdapDirectory implements DirectoryDriver {
165
165
  name: name ?? nickName ?? entry.dn,
166
166
  nickName,
167
167
  // A directory that holds an address has vouched for it: that is what
168
- // a directory is.
168
+ // a directory is. Unlike a SAML provider, the directory is the one
169
+ // the operator configured and runs — if it is a customer's, its
170
+ // addresses are that customer's say-so (see the README).
169
171
  emailVerificationState: email === undefined ? "unsupported" : "verified",
170
172
  raw: { dn: entry.dn, attributes: entry.attributes },
171
173
  };
@@ -26,6 +26,7 @@ import {
26
26
  validateAssertion,
27
27
  } from "../saml.js";
28
28
  import type {
29
+ EmailVerificationState,
29
30
  OAuthToken,
30
31
  RedirectRequest,
31
32
  TransitDriver,
@@ -92,6 +93,23 @@ export interface SamlConfig {
92
93
  replayStore?: AssertionReplayStore | (() => AssertionReplayStore);
93
94
  /** The attribute names this provider uses, when they are not the usual ones. */
94
95
  claims?: { email?: string; name?: string; nickName?: string };
96
+ /**
97
+ * Mark every address this provider asserts as `"verified"`.
98
+ *
99
+ * Only for a provider that is authoritative for ALL the addresses it can
100
+ * assert — your own organisation's. Whoever administers the provider can
101
+ * assert any address, so with a customer's provider this hands them every
102
+ * account an application links by email. Default false: an asserted
103
+ * address is `"unsupported"`.
104
+ */
105
+ trustEmail?: boolean;
106
+ /**
107
+ * The domains this provider is authoritative for. An asserted address in
108
+ * one of them is `"verified"`, any other is `"unverified"`. Compared without
109
+ * case on what follows the address's last `@`, exactly — a subdomain is
110
+ * listed on its own.
111
+ */
112
+ trustedEmailDomains?: string[];
95
113
  }
96
114
 
97
115
  /**
@@ -116,6 +134,7 @@ function refuseImplicitMemoryReplayStoreInProduction(): void {
116
134
 
117
135
  export class SamlDriver implements TransitDriver {
118
136
  readonly #config: SamlConfig;
137
+ readonly #trustedDomains: ReadonlySet<string> | undefined;
119
138
  #replay: AssertionReplayStore | undefined;
120
139
 
121
140
  constructor(config: SamlConfig) {
@@ -133,6 +152,7 @@ export class SamlDriver implements TransitDriver {
133
152
  // healthy, and reported it to whoever happened to sign in first.
134
153
  refuseImplicitMemoryReplayStoreInProduction();
135
154
  }
155
+ this.#trustedDomains = trustedDomains(config);
136
156
  this.#config = config;
137
157
  }
138
158
 
@@ -223,9 +243,12 @@ export class SamlDriver implements TransitDriver {
223
243
  clockSkewSeconds: this.#config.clockSkewSeconds,
224
244
  });
225
245
 
246
+ // Remembered for as long as the validation above would still accept the
247
+ // assertion — its later expiry plus the clock skew — not merely until
248
+ // the expiry it states.
226
249
  const fresh = await this.#replayStore().remember(
227
250
  identity.assertionId,
228
- identity.notOnOrAfter,
251
+ identity.rememberUntil,
229
252
  );
230
253
  if (!fresh) {
231
254
  // Everything above passes on a captured response posted a second
@@ -271,6 +294,20 @@ export class SamlDriver implements TransitDriver {
271
294
  );
272
295
  }
273
296
 
297
+ /**
298
+ * Whoever administers a SAML provider can assert any address, so one is
299
+ * verified only when the config says this provider is authoritative for it.
300
+ */
301
+ #emailVerificationState(email: string | undefined): EmailVerificationState {
302
+ if (email === undefined) return "unsupported";
303
+ if (this.#config.trustEmail === true) return "verified";
304
+ const domains = this.#trustedDomains;
305
+ if (domains === undefined) return "unsupported";
306
+ const at = email.lastIndexOf("@");
307
+ const domain = at === -1 ? "" : email.slice(at + 1).toLowerCase();
308
+ return domains.has(domain) ? "verified" : "unverified";
309
+ }
310
+
274
311
  #mapUser(identity: SamlIdentity): TransitUser {
275
312
  const claims = this.#config.claims ?? {};
276
313
  const email =
@@ -285,9 +322,7 @@ export class SamlDriver implements TransitDriver {
285
322
  email: email ?? "",
286
323
  name: name ?? identity.nameId,
287
324
  nickName: pick(identity, claims.nickName, NICK_CLAIMS),
288
- // A provider that asserts an address has vouched for it: that is what
289
- // its directory is.
290
- emailVerificationState: email === undefined ? "unsupported" : "verified",
325
+ emailVerificationState: this.#emailVerificationState(email),
291
326
  raw: {
292
327
  nameId: identity.nameId,
293
328
  nameIdFormat: identity.nameIdFormat,
@@ -298,6 +333,32 @@ export class SamlDriver implements TransitDriver {
298
333
  }
299
334
  }
300
335
 
336
+ /**
337
+ * The trusted domains, lower-cased, or undefined when none were configured.
338
+ * A malformed list fails at construction rather than marking nothing, or the
339
+ * wrong addresses, verified.
340
+ */
341
+ function trustedDomains(config: SamlConfig): ReadonlySet<string> | undefined {
342
+ const domains = config.trustedEmailDomains;
343
+ if (domains === undefined) return undefined;
344
+ if (config.trustEmail === true) {
345
+ throw new SamlError(
346
+ `'${config.issuer}' sets both trustEmail and trustedEmailDomains — trustEmail already trusts every domain, so say which one is meant`,
347
+ );
348
+ }
349
+ const normalized = new Set<string>();
350
+ for (const domain of domains) {
351
+ const value = domain.trim().toLowerCase();
352
+ if (value === "" || value.includes("@")) {
353
+ throw new SamlError(
354
+ `trustedEmailDomains of '${config.issuer}' lists '${domain}', which is not a domain — write 'acme.com', not an address`,
355
+ );
356
+ }
357
+ normalized.add(value);
358
+ }
359
+ return normalized;
360
+ }
361
+
301
362
  /** The first value among the configured name, then the usual ones. */
302
363
  function pick(
303
364
  identity: SamlIdentity,
package/src/ldap.ts CHANGED
@@ -44,6 +44,7 @@ const UNBIND_REQUEST = applicationPrimitive(2);
44
44
  const SEARCH_REQUEST = application(3);
45
45
  const SEARCH_ENTRY = application(4);
46
46
  const SEARCH_DONE = application(5);
47
+ const SEARCH_REFERENCE = application(19);
47
48
 
48
49
  export class LdapError extends Error {
49
50
  readonly code: number | undefined;
@@ -290,12 +291,40 @@ export class LdapConnection {
290
291
  if (!waiting || !expected) return;
291
292
 
292
293
  if (expected.until === undefined) {
293
- // A single-reply operation: this is the answer.
294
- this.#finish(id, [op.value]);
294
+ // A single-reply operation: the answer is the one tag it expects, and
295
+ // any other reply under its id is the server saying something this
296
+ // operation cannot read as a result.
297
+ if (expected.collect.includes(op.tag)) {
298
+ this.#finish(id, [op.value]);
299
+ } else {
300
+ this.#fail(id, unexpectedReply(op.tag));
301
+ }
295
302
  return;
296
303
  }
297
- waiting.parts.push(op.value);
298
- if (op.tag === expected.until) this.#finish(id, waiting.parts);
304
+ if (op.tag === expected.until) {
305
+ waiting.parts.push(op.value);
306
+ this.#finish(id, waiting.parts);
307
+ return;
308
+ }
309
+ if (expected.collect.includes(op.tag)) {
310
+ waiting.parts.push(op.value);
311
+ return;
312
+ }
313
+ if (op.tag === SEARCH_REFERENCE) {
314
+ // A continuation reference names another server that may hold more
315
+ // of the subtree (RFC 4511 §4.5.3). It is not an entry, and chasing
316
+ // it would send the next bind to wherever the reply pointed. Active
317
+ // Directory answers several for any search from a domain root.
318
+ return;
319
+ }
320
+ this.#fail(id, unexpectedReply(op.tag));
321
+ }
322
+
323
+ #fail(id: number, error: Error): void {
324
+ const waiting = this.#pending.get(id);
325
+ this.#pending.delete(id);
326
+ this.#expect.delete(id);
327
+ waiting?.reject(error);
299
328
  }
300
329
 
301
330
  #finish(id: number, parts: Buffer[]): void {
@@ -353,6 +382,12 @@ function readEntry(value: Buffer): LdapEntry {
353
382
  };
354
383
  }
355
384
 
385
+ function unexpectedReply(tag: number): LdapError {
386
+ return new LdapError(
387
+ `the directory answered with an unexpected reply (tag 0x${tag.toString(16)})`,
388
+ );
389
+ }
390
+
356
391
  /** LDAP answers a code; anything but zero is a refusal worth reporting. */
357
392
  function assertSuccess(response: Buffer, what: string): void {
358
393
  const [codeElement, , messageElement] = decodeSequence(response);
package/src/oidc.ts CHANGED
@@ -51,9 +51,10 @@ export class OidcDiscovery {
51
51
  #inFlight: Promise<OidcMetadata> | undefined;
52
52
 
53
53
  constructor(issuer: string, options: RemoteOptions = {}) {
54
- // A trailing slash changes the well-known URL and, on some providers,
55
- // the issuer claim it must be compared against.
56
- this.#issuer = issuer.replace(/\/+$/, "");
54
+ // Kept byte for byte: the discovery document's `issuer` and every
55
+ // id_token's `iss` must be IDENTICAL to it (OpenID Connect Discovery
56
+ // §4.3), and some providers' issuers end with a slash (Auth0's do).
57
+ this.#issuer = issuer;
57
58
  this.#ttlMs = options.ttlMs ?? DEFAULT_TTL_MS;
58
59
  this.#now = options.now ?? Date.now;
59
60
  }
@@ -63,7 +64,9 @@ export class OidcDiscovery {
63
64
  }
64
65
 
65
66
  get url(): string {
66
- return `${this.#issuer}/.well-known/openid-configuration`;
67
+ // Only the well-known URL drops the trailing slash, so it is joined
68
+ // without a double one.
69
+ return `${this.#issuer.replace(/\/+$/, "")}/.well-known/openid-configuration`;
67
70
  }
68
71
 
69
72
  async metadata(): Promise<OidcMetadata> {
package/src/quasar.ts CHANGED
@@ -11,17 +11,24 @@
11
11
 
12
12
  import { quasarConnection as loadQuasarConnection } from "./vendor/quasarConnection.js";
13
13
 
14
- /** The named connection, checked for the commands the caller will issue. */
14
+ /**
15
+ * The named connection, checked for the commands the caller will issue.
16
+ *
17
+ * `isConnection` is the caller's check over those same commands: only the
18
+ * caller knows which client type it needs, so only it can vouch for it.
19
+ */
15
20
  export async function quasarConnection<T>(
16
21
  name: string | undefined,
17
22
  required: readonly string[],
18
23
  what: string,
24
+ isConnection: (value: unknown) => value is T,
19
25
  ): Promise<T> {
20
- return loadQuasarConnection<T>({
26
+ return loadQuasarConnection({
21
27
  pkg: "transit",
22
28
  name,
23
29
  required,
24
30
  what,
31
+ isConnection,
25
32
  raise: (_reason, message, cause) => new Error(message, { cause }),
26
33
  });
27
34
  }
package/src/replay.ts CHANGED
@@ -12,10 +12,13 @@
12
12
  */
13
13
 
14
14
  import { quasarConnection } from "./quasar.js";
15
+ import { hasCommands } from "./vendor/quasarConnection.js";
15
16
 
16
17
  export interface AssertionReplayStore {
17
18
  /**
18
- * Remember `assertionId` until `expiresAt` (epoch seconds).
19
+ * Remember `assertionId` until `expiresAt` (epoch seconds) — the
20
+ * `rememberUntil` of a validated assertion, which already counts the clock
21
+ * skew it was accepted with.
19
22
  *
20
23
  * Answers `true` when this is the first time, `false` when the assertion
21
24
  * has already been used. Implementations must decide that atomically:
@@ -54,6 +57,10 @@ export interface ReplayRedisClient {
54
57
  set(key: string, value: string, ...args: unknown[]): Promise<unknown>;
55
58
  }
56
59
 
60
+ function isReplayRedisClient(value: unknown): value is ReplayRedisClient {
61
+ return hasCommands(value, ["set"]);
62
+ }
63
+
57
64
  export type ReplayRedisResolver =
58
65
  | ReplayRedisClient
59
66
  | (() => ReplayRedisClient | Promise<ReplayRedisClient>);
@@ -82,8 +89,9 @@ export class RedisAssertionReplayStore implements AssertionReplayStore {
82
89
 
83
90
  async remember(assertionId: string, expiresAt: number): Promise<boolean> {
84
91
  const client = await this.#client();
85
- // The key outlives the assertion by a minute, so an assertion accepted
86
- // at the edge of its window cannot be replayed just after it.
92
+ // `expiresAt` already covers the clock skew the validation allowed. The
93
+ // extra minute absorbs clock differences between the replica that
94
+ // stores the key and the one a replay lands on.
87
95
  const ttl = Math.max(
88
96
  1,
89
97
  Math.ceil(expiresAt - Math.floor(Date.now() / 1000)) + 60,
@@ -121,15 +129,17 @@ export const replayStores = {
121
129
  connection: ReplayRedisResolver | string;
122
130
  prefix?: string;
123
131
  }): () => AssertionReplayStore {
132
+ const { connection } = options;
124
133
  const client: ReplayRedisResolver =
125
- typeof options.connection === "string"
134
+ typeof connection === "string"
126
135
  ? () =>
127
- quasarConnection<ReplayRedisClient>(
128
- options.connection as string,
136
+ quasarConnection(
137
+ connection,
129
138
  ["set"],
130
139
  "the assertion replay store",
140
+ isReplayRedisClient,
131
141
  )
132
- : options.connection;
142
+ : connection;
133
143
  return () =>
134
144
  new RedisAssertionReplayStore(client, { prefix: options.prefix });
135
145
  },
package/src/saml.ts CHANGED
@@ -35,8 +35,16 @@ export interface SamlIdentity {
35
35
  attributes: Record<string, string[]>;
36
36
  /** The assertion's own id, for the replay check. */
37
37
  assertionId: string;
38
- /** When the assertion stops being usable, epoch seconds. */
38
+ /** The `NotOnOrAfter` of the assertion's conditions, epoch seconds. */
39
39
  notOnOrAfter: number;
40
+ /**
41
+ * Until when a replay record has to last, epoch seconds: the later of the
42
+ * two expiries the assertion carries (its conditions and its bearer
43
+ * confirmation) plus the clock skew this validation allowed. Before that
44
+ * instant the same assertion can still pass `validateAssertion`, so a
45
+ * record forgotten earlier lets a captured response sign in again.
46
+ */
47
+ rememberUntil: number;
40
48
  /** The provider's session, when it named one. */
41
49
  sessionIndex: string | undefined;
42
50
  }
@@ -232,6 +240,7 @@ export function validateAssertion(
232
240
  attributes: readAttributes(assertion),
233
241
  assertionId,
234
242
  notOnOrAfter,
243
+ rememberUntil: Math.max(notOnOrAfter, confirmationExpiry) + skew,
235
244
  sessionIndex: authn?.attributes.find((a) => a.local === "SessionIndex")
236
245
  ?.value,
237
246
  };