@c9up/transit 0.1.2 → 0.1.4

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.
Files changed (47) hide show
  1. package/dist/TransitProvider.d.ts +2 -0
  2. package/dist/TransitProvider.d.ts.map +1 -1
  3. package/dist/TransitProvider.js +16 -2
  4. package/dist/TransitProvider.js.map +1 -1
  5. package/dist/ber.d.ts +9 -0
  6. package/dist/ber.d.ts.map +1 -1
  7. package/dist/ber.js +16 -1
  8. package/dist/ber.js.map +1 -1
  9. package/dist/drivers/SamlDriver.d.ts.map +1 -1
  10. package/dist/drivers/SamlDriver.js +6 -1
  11. package/dist/drivers/SamlDriver.js.map +1 -1
  12. package/dist/ldap.d.ts.map +1 -1
  13. package/dist/ldap.js +13 -1
  14. package/dist/ldap.js.map +1 -1
  15. package/dist/quasar.d.ts +7 -8
  16. package/dist/quasar.d.ts.map +1 -1
  17. package/dist/quasar.js +15 -35
  18. package/dist/quasar.js.map +1 -1
  19. package/dist/services/main.d.ts +10 -1
  20. package/dist/services/main.d.ts.map +1 -1
  21. package/dist/services/main.js +12 -1
  22. package/dist/services/main.js.map +1 -1
  23. package/dist/vendor/nodeEnv.d.ts +5 -0
  24. package/dist/vendor/nodeEnv.d.ts.map +1 -0
  25. package/dist/{nodeEnv.js → vendor/nodeEnv.js} +13 -8
  26. package/dist/vendor/nodeEnv.js.map +1 -0
  27. package/dist/vendor/quasarConnection.d.ts +35 -0
  28. package/dist/vendor/quasarConnection.d.ts.map +1 -0
  29. package/dist/vendor/quasarConnection.js +62 -0
  30. package/dist/vendor/quasarConnection.js.map +1 -0
  31. package/dist/xml.d.ts +20 -1
  32. package/dist/xml.d.ts.map +1 -1
  33. package/dist/xml.js +43 -5
  34. package/dist/xml.js.map +1 -1
  35. package/package.json +9 -9
  36. package/src/TransitProvider.ts +19 -4
  37. package/src/ber.ts +19 -1
  38. package/src/drivers/SamlDriver.ts +6 -1
  39. package/src/ldap.ts +17 -0
  40. package/src/quasar.ts +15 -52
  41. package/src/services/main.ts +13 -1
  42. package/src/{nodeEnv.ts → vendor/nodeEnv.ts} +14 -8
  43. package/src/vendor/quasarConnection.ts +129 -0
  44. package/src/xml.ts +74 -5
  45. package/dist/nodeEnv.d.ts +0 -17
  46. package/dist/nodeEnv.d.ts.map +0 -1
  47. package/dist/nodeEnv.js.map +0 -1
@@ -0,0 +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,MAAM,SAAS,GAAG,4BAA4B,CAAC;IAC/C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACJ,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,KAAK,CACV,gBAAgB,EAChB,IAAI,GAAG,KAAK,IAAI,oCAAoC,IAAI,IAAI,SAAS,yCAAyC;YAC7G,0BAA0B,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAClE,KAAK,CACL,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC;QACzC,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAI,CAAC,kBAAkB,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,QAAQ,CAAC,MAAM,CAC9B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,UAAU,CAClE,CAAC;IACF,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,yEAAyE;IACzE,2EAA2E;IAC3E,gDAAgD;IAChD,OAAO,UAAe,CAAC;AACxB,CAAC"}
package/dist/xml.d.ts CHANGED
@@ -57,8 +57,27 @@ export interface XmlInstruction {
57
57
  data: string;
58
58
  }
59
59
  export type XmlNode = XmlElement | XmlText | XmlComment | XmlInstruction;
60
+ /**
61
+ * What a document is allowed to cost.
62
+ *
63
+ * A SAML response is parsed BEFORE its signature is checked — it has to be,
64
+ * since the signature is inside it — so every one of these bounds applies to
65
+ * bytes an unauthenticated caller chose. Without them a single POST could
66
+ * exhaust the heap, or nest deeply enough to overflow the stack in `#element`,
67
+ * which recurses once per level.
68
+ */
69
+ export interface XmlLimits {
70
+ /** Characters in the document. Default 1 MiB — a large SAML response is tens of KiB. */
71
+ maxLength?: number;
72
+ /** Nesting levels. Default 100; the recursion is one frame per level. */
73
+ maxDepth?: number;
74
+ /** Elements, text runs, comments and instructions, together. Default 50 000. */
75
+ maxNodes?: number;
76
+ /** Attributes on one element. Default 256. */
77
+ maxAttributes?: number;
78
+ }
60
79
  /** Parse a document and return its root element. */
61
- export declare function parseXml(source: string): XmlElement;
80
+ export declare function parseXml(source: string, limits?: XmlLimits): XmlElement;
62
81
  /** The URI a prefix resolves to at this element, or `undefined`. */
63
82
  export declare function resolvePrefix(element: XmlElement, prefix: string): string | undefined;
64
83
  /** Every element under `element`, including it, in document order. */
package/dist/xml.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,eAAO,MAAM,MAAM,yCAAyC,CAAC;AAG7D,MAAM,WAAW,YAAY;IAC5B,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,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AyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AASD,oDAAoD;AACpD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,CAevE;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAWpB;AAED,sEAAsE;AACtE,wBAAiB,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAKhE;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAC9B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACX,UAAU,GAAG,SAAS,CASxB;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAC5B,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,GACX,UAAU,EAAE,CAOd;AAED,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAOlD"}
package/dist/xml.js CHANGED
@@ -25,13 +25,25 @@ class XmlError extends Error {
25
25
  this.name = "XmlError";
26
26
  }
27
27
  }
28
+ const DEFAULT_LIMITS = {
29
+ maxLength: 1024 * 1024,
30
+ maxDepth: 100,
31
+ maxNodes: 50_000,
32
+ maxAttributes: 256,
33
+ };
28
34
  /** Parse a document and return its root element. */
29
- export function parseXml(source) {
35
+ export function parseXml(source, limits) {
36
+ const resolved = { ...DEFAULT_LIMITS, ...limits };
37
+ // Checked before the copy below, not after: normalising duplicates the whole
38
+ // string, so a 300 MB body cost 600 MB before anything looked at its size.
39
+ if (source.length > resolved.maxLength) {
40
+ throw new XmlError(`the document is ${source.length} characters, over the ${resolved.maxLength} allowed`);
41
+ }
30
42
  // Line endings are normalised before parsing, as the canonicalization
31
43
  // specification requires — otherwise the same document signed on one
32
44
  // platform digests differently on another.
33
45
  const input = source.replace(/\r\n?/g, "\n");
34
- const parser = new Parser(input);
46
+ const parser = new Parser(input, resolved);
35
47
  return parser.document();
36
48
  }
37
49
  /** The URI a prefix resolves to at this element, or `undefined`. */
@@ -81,9 +93,20 @@ export function textOf(element) {
81
93
  }
82
94
  class Parser {
83
95
  source;
96
+ limits;
84
97
  #at = 0;
85
- constructor(source) {
98
+ /** Nodes built so far, across the whole document. */
99
+ #nodes = 0;
100
+ constructor(source, limits) {
86
101
  this.source = source;
102
+ this.limits = limits;
103
+ }
104
+ /** Count one node, and refuse a document that keeps producing them. */
105
+ #node() {
106
+ this.#nodes += 1;
107
+ if (this.#nodes > this.limits.maxNodes) {
108
+ throw new XmlError(`the document has more than ${this.limits.maxNodes} nodes`);
109
+ }
87
110
  }
88
111
  document() {
89
112
  let root;
@@ -115,7 +138,15 @@ class Parser {
115
138
  throw new XmlError("the document has no element");
116
139
  return root;
117
140
  }
118
- #element(parent) {
141
+ #element(parent, depth = 0) {
142
+ // Checked on the way IN: `#element` recurses once per level, so a
143
+ // document nested deeply enough overflowed the stack before any of this
144
+ // ran — and the stack it overflows is the one holding the signature check
145
+ // that has not happened yet.
146
+ if (depth > this.limits.maxDepth) {
147
+ throw new XmlError(`the document nests deeper than ${this.limits.maxDepth}`);
148
+ }
149
+ this.#node();
119
150
  this.#expect("<");
120
151
  const qname = this.#name();
121
152
  const element = {
@@ -141,6 +172,9 @@ class Parser {
141
172
  this.#expect("=");
142
173
  this.#skipSpace();
143
174
  raw.push({ qname: name, value: this.#attributeValue() });
175
+ if (raw.length > this.limits.maxAttributes) {
176
+ throw new XmlError(`element <${qname}> carries more than ${this.limits.maxAttributes} attributes`);
177
+ }
144
178
  }
145
179
  for (const { qname: name, value } of raw) {
146
180
  if (name === "xmlns") {
@@ -212,6 +246,7 @@ class Parser {
212
246
  const end = this.source.indexOf("-->", this.#at);
213
247
  if (end === -1)
214
248
  throw new XmlError("a comment is never closed");
249
+ this.#node();
215
250
  element.children.push({
216
251
  type: "comment",
217
252
  value: this.source.slice(this.#at + 4, end),
@@ -223,6 +258,7 @@ class Parser {
223
258
  const end = this.source.indexOf("]]>", this.#at);
224
259
  if (end === -1)
225
260
  throw new XmlError("a CDATA section is never closed");
261
+ this.#node();
226
262
  element.children.push({
227
263
  type: "text",
228
264
  value: this.source.slice(this.#at + 9, end),
@@ -239,6 +275,7 @@ class Parser {
239
275
  throw new XmlError("a processing instruction is never closed");
240
276
  const body = this.source.slice(this.#at + 2, end);
241
277
  const space = body.search(/\s/);
278
+ this.#node();
242
279
  element.children.push({
243
280
  type: "instruction",
244
281
  target: space === -1 ? body : body.slice(0, space),
@@ -248,11 +285,12 @@ class Parser {
248
285
  continue;
249
286
  }
250
287
  if (this.#peek("<")) {
251
- element.children.push(this.#element(element));
288
+ element.children.push(this.#element(element, depth + 1));
252
289
  continue;
253
290
  }
254
291
  const next = this.source.indexOf("<", this.#at);
255
292
  const end = next === -1 ? this.source.length : next;
293
+ this.#node();
256
294
  element.children.push({
257
295
  type: "text",
258
296
  value: resolveEntities(this.source.slice(this.#at, end)),
package/dist/xml.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xml.js","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,MAAM,CAAC,MAAM,MAAM,GAAG,sCAAsC,CAAC;AAC7D,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAgDjD,MAAM,QAAS,SAAQ,KAAK;IAC3B,YAAY,OAAe;QAC1B,KAAK,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACxB,CAAC;CACD;AAED,oDAAoD;AACpD,MAAM,UAAU,QAAQ,CAAC,MAAc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YACZ,KAAK,MAAM;gBACV,OAAO,GAAG,CAAC;YACZ;gBACC,MAAM;QACR,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC,mBAAmB,KAAK,GAAG,CAAC,CAAC;IACjD,CAAC,CACD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/transit",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",
@@ -33,15 +33,15 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
- "@biomejs/biome": "^2.4.10",
37
- "@types/node": "^22.19.15",
38
- "@vitest/coverage-v8": "^4.1.5",
39
- "typescript": "^6.0.2",
40
- "vitest": "^4.1.2",
41
- "@c9up/ream": "^0.2.0"
36
+ "@biomejs/biome": "^2.5.12",
37
+ "@c9up/ream": "^0.2.0",
38
+ "@types/node": "^22.20.1",
39
+ "@vitest/coverage-v8": "4.1.11",
40
+ "typescript": "^6.0.3",
41
+ "vitest": "4.1.11"
42
42
  },
43
43
  "peerDependencies": {
44
- "@c9up/quasar": "^0.1.0",
44
+ "@c9up/quasar": "^0.1.0 || ^0.2.0",
45
45
  "@c9up/ream": "^0.2.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
@@ -71,7 +71,7 @@
71
71
  "scripts": {
72
72
  "build": "tsc -p tsconfig.build.json",
73
73
  "test": "vitest run",
74
- "lint": "biome check src/",
74
+ "lint": "biome check src/ tests/",
75
75
  "test:coverage": "vitest run --coverage",
76
76
  "typecheck": "tsc --noEmit"
77
77
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  import "./augmentations.js";
10
10
  import type { TransitConfig } from "./config.js";
11
- import { setTransit } from "./services/main.js";
11
+ import { clearTransit, getTransit, setTransit } from "./services/main.js";
12
12
  import { TransitManager } from "./TransitManager.js";
13
13
 
14
14
  interface TransitContainer {
@@ -26,6 +26,9 @@ export interface TransitAppContext {
26
26
  }
27
27
 
28
28
  export default class TransitProvider {
29
+ /** The manager this provider seated, so shutdown only clears its own. */
30
+ #manager: TransitManager | undefined;
31
+
29
32
  constructor(protected app: TransitAppContext) {}
30
33
 
31
34
  register(): void {
@@ -45,8 +48,20 @@ export default class TransitProvider {
45
48
  }
46
49
 
47
50
  async boot(): Promise<void> {
48
- setTransit(
49
- await this.app.container.resolve<TransitManager>(TransitManager),
50
- );
51
+ const manager =
52
+ await this.app.container.resolve<TransitManager>(TransitManager);
53
+ this.#manager = manager;
54
+ setTransit(manager);
55
+ }
56
+
57
+ async shutdown(): Promise<void> {
58
+ // Release the module-level singleton, while it is still ours. A stopped
59
+ // application left a dead TransitManager reachable through
60
+ // `services/main` — and this one holds the SSO providers, so a stale one
61
+ // answers sign-ins for an application that no longer exists.
62
+ if (this.#manager !== undefined && getTransit() === this.#manager) {
63
+ clearTransit();
64
+ }
65
+ this.#manager = undefined;
51
66
  }
52
67
  }
package/src/ber.ts CHANGED
@@ -116,6 +116,16 @@ export function decodeString(value: Buffer): string {
116
116
  return value.toString("utf8");
117
117
  }
118
118
 
119
+ /**
120
+ * The largest message this will agree to assemble.
121
+ *
122
+ * A four-byte length header can declare 4 GiB, and the declaration arrives
123
+ * before any of the bytes do — so a five-byte reply could make the client sit
124
+ * on a growing buffer until the process died. A directory response is
125
+ * kilobytes; 8 MiB is generous for a paged search and still bounded.
126
+ */
127
+ export const MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
128
+
119
129
  /**
120
130
  * How many bytes a whole message occupies, or `undefined` while it is still
121
131
  * arriving. LDAP runs over a stream, so a read can stop anywhere.
@@ -133,7 +143,15 @@ export function messageLength(buffer: Buffer): number | undefined {
133
143
  for (let i = 0; i < count; i += 1) {
134
144
  length = length * 256 + (buffer[2 + i] as number);
135
145
  }
136
- return 2 + count + length;
146
+ const total = 2 + count + length;
147
+ // Refused on the DECLARATION, not once the bytes have arrived: the point is
148
+ // never to buffer them.
149
+ if (total > MAX_MESSAGE_BYTES) {
150
+ throw new BerError(
151
+ `a message declares ${total} bytes, over the ${MAX_MESSAGE_BYTES} allowed`,
152
+ );
153
+ }
154
+ return total;
137
155
  }
138
156
 
139
157
  function encodeLength(length: number): Buffer {
@@ -14,7 +14,6 @@
14
14
  import { randomUUID } from "node:crypto";
15
15
  import { deflateRawSync } from "node:zlib";
16
16
  import { verifyXmlSignature } from "../dsig.js";
17
- import { inProduction } from "../nodeEnv.js";
18
17
  import {
19
18
  type AssertionReplayStore,
20
19
  MemoryAssertionReplayStore,
@@ -33,6 +32,7 @@ import type {
33
32
  TransitUser,
34
33
  } from "../types.js";
35
34
  import { assertOAuthState } from "../types.js";
35
+ import { inProduction } from "../vendor/nodeEnv.js";
36
36
  import { parseXml } from "../xml.js";
37
37
 
38
38
  const PROTOCOL_NS = "urn:oasis:names:tc:SAML:2.0:protocol";
@@ -188,6 +188,11 @@ export class SamlDriver implements TransitDriver {
188
188
  );
189
189
  }
190
190
 
191
+ // Parsed before anything is verified, because the signature is INSIDE the
192
+ // document — so these are bytes an unauthenticated caller chose, and the
193
+ // parser's limits (length, depth, node and attribute counts) are what
194
+ // stands between a POST and the heap or the stack. The defaults are sized
195
+ // for SAML: a large response is tens of kilobytes.
191
196
  const document = parseXml(decode(code));
192
197
  if (
193
198
  document.namespaceUri !== PROTOCOL_NS ||
package/src/ldap.ts CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  encodeInteger,
34
34
  encodeSequence,
35
35
  encodeString,
36
+ MAX_MESSAGE_BYTES,
36
37
  messageLength,
37
38
  OCTET_STRING,
38
39
  } from "./ber.js";
@@ -255,6 +256,22 @@ export class LdapConnection {
255
256
 
256
257
  #receive(chunk: Buffer): void {
257
258
  this.#buffer = Buffer.concat([this.#buffer, chunk]);
259
+ // A stream that never completes a message must not grow the buffer
260
+ // forever. `messageLength` refuses an oversized DECLARATION, but a peer
261
+ // can also just keep sending bytes that never form one — the length
262
+ // header itself is only read once two bytes are in hand.
263
+ if (this.#buffer.length > MAX_MESSAGE_BYTES) {
264
+ this.#buffer = Buffer.alloc(0);
265
+ // The socket goes too: a peer that behaves this way is not one to keep
266
+ // reading from, and closing it is what stops the flood.
267
+ this.#socket?.destroy();
268
+ this.#failAll(
269
+ new LdapError(
270
+ `the directory sent more than ${MAX_MESSAGE_BYTES} bytes without completing a message`,
271
+ ),
272
+ );
273
+ return;
274
+ }
258
275
  for (;;) {
259
276
  const length = messageLength(this.#buffer);
260
277
  if (length === undefined || this.#buffer.length < length) return;
package/src/quasar.ts CHANGED
@@ -1,64 +1,27 @@
1
1
  /**
2
2
  * Resolving a Redis connection by name, from `@c9up/quasar`.
3
3
  *
4
- * Transit does not depend on quasar: it is an optional peer, and this module
5
- * never imports it statically — the specifier is built at runtime so the
6
- * TypeScript build stays free of it too.
4
+ * The loading, the shape check and the messages are the same in every package
5
+ * that offers a Redis-backed option, so they are vendored rather than written
6
+ * again: `src/vendor/quasarConnection.ts`, generated from one source. What is
7
+ * specific stays at the call site — transit has several stores, each issuing
8
+ * its own commands, so unlike its siblings it passes them per call rather than
9
+ * fixing one list here.
7
10
  */
8
11
 
9
- interface ConnectionSource {
10
- connection(name?: string): unknown;
11
- }
12
-
13
- function isConnectionSource(value: unknown): value is ConnectionSource {
14
- return (
15
- typeof value === "object" &&
16
- value !== null &&
17
- typeof Reflect.get(value, "connection") === "function"
18
- );
19
- }
12
+ import { quasarConnection as loadQuasarConnection } from "./vendor/quasarConnection.js";
20
13
 
21
- /**
22
- * The named connection, checked for the commands the caller needs before it is
23
- * handed over — a connection missing one would fail on the first sign-in, far
24
- * from the cause.
25
- */
14
+ /** The named connection, checked for the commands the caller will issue. */
26
15
  export async function quasarConnection<T>(
27
16
  name: string | undefined,
28
17
  required: readonly string[],
29
18
  what: string,
30
19
  ): Promise<T> {
31
- const specifier = "@c9up/quasar/services/main";
32
- let loaded: unknown;
33
- try {
34
- loaded = await import(/* @vite-ignore */ specifier);
35
- } catch (cause) {
36
- throw new Error(
37
- `[transit] naming a Redis connection needs @c9up/quasar, which is not installed.\n pnpm add @c9up/quasar`,
38
- { cause },
39
- );
40
- }
41
-
42
- const manager = isConnectionSource(loaded)
43
- ? loaded
44
- : Reflect.get(Object(loaded), "default");
45
- if (!isConnectionSource(manager)) {
46
- throw new Error(
47
- "[transit] @c9up/quasar/services/main did not expose a connection() manager",
48
- );
49
- }
50
-
51
- const connection = manager.connection(name);
52
- const missing = required.filter(
53
- (command) =>
54
- typeof connection !== "object" ||
55
- connection === null ||
56
- typeof Reflect.get(connection, command) !== "function",
57
- );
58
- if (missing.length > 0) {
59
- throw new Error(
60
- `[transit] the quasar connection${name ? ` '${name}'` : ""} is missing ${missing.join(", ")}, which ${what} issues`,
61
- );
62
- }
63
- return connection as T;
20
+ return loadQuasarConnection<T>({
21
+ pkg: "transit",
22
+ name,
23
+ required,
24
+ what,
25
+ raise: (_reason, message, cause) => new Error(message, { cause }),
26
+ });
64
27
  }
@@ -15,7 +15,19 @@ export function setTransit(manager: TransitManager): void {
15
15
  instance = manager;
16
16
  }
17
17
 
18
- /** @internal Test helper — forget the manager between cases. */
18
+ /** @internal Read the seated manager, if there is one. */
19
+ export function getTransit(): TransitManager | undefined {
20
+ return instance;
21
+ }
22
+
23
+ /**
24
+ * @internal Forget the manager — called by the provider on shutdown, and by
25
+ * tests between cases.
26
+ *
27
+ * The caller checks ownership first (`getTransit() === mine`): two applications
28
+ * share this module in one process, and the one shutting down must not clear a
29
+ * manager the other has since seated.
30
+ */
19
31
  export function clearTransit(): void {
20
32
  instance = undefined;
21
33
  }
@@ -1,14 +1,20 @@
1
+ // Generated from scripts/vendor/nodeEnv.ts — do not edit.
2
+ //
3
+ // This package is published and built from its own repository, so the file
4
+ // has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
5
+ // and `pnpm vendor:check` fails if this copy has drifted from the original.
6
+
1
7
  /**
2
- * Reading `NODE_ENV`, with the aliases people actually set.
8
+ * `NODE_ENV`, read the way every runtime actually spells it.
3
9
  *
4
- * `NODE_ENV=prod` is ordinary in a Dockerfile or a platform dashboard. Read
5
- * verbatim it answers "not production" — and here that means the in-process
6
- * SAML replay store is accepted on a production deployment, where it bounds
7
- * replay within one replica and not beyond it.
10
+ * `NODE_ENV=prod` is ordinary in a Dockerfile or a platform dashboard, and a
11
+ * bare `=== "production"` answers "not production" for it. What that costs
12
+ * differs per package, so the consequence is stated where the decision is
13
+ * taken, not here.
8
14
  *
9
- * Duplicated rather than imported: transit depends on no other package in this
10
- * workspace, and a security decision that only holds when an optional peer is
11
- * installed is not a decision.
15
+ * The tables mirror the framework's (`@c9up/ream`, src/env/nodeEnv.ts), which
16
+ * is the origin rather than a peer: it formats to different rules and exposes
17
+ * `currentNodeEnv()` instead of `inProduction()`.
12
18
  */
13
19
 
14
20
  const DEV_ENVS = ["dev", "develop", "development"];
@@ -0,0 +1,129 @@
1
+ // Generated from scripts/vendor/quasarConnection.ts — do not edit.
2
+ //
3
+ // This package is published and built from its own repository, so the file
4
+ // has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
5
+ // and `pnpm vendor:check` fails if this copy has drifted from the original.
6
+
7
+ /**
8
+ * Resolving a Redis connection by name, from `@c9up/quasar`.
9
+ *
10
+ * No package here depends on quasar: it is an optional peer, and this module
11
+ * never imports it statically — the specifier is built at runtime so the
12
+ * TypeScript build stays free of it too. A host that never names a connection
13
+ * neither installs it nor pays for it.
14
+ *
15
+ * What varies between callers is passed in rather than copied: which commands
16
+ * they will issue, and what they are doing with them. Both end up in the
17
+ * message, because "the connection is missing lpop" is only useful next to
18
+ * "which the queue's atomic pop issues".
19
+ */
20
+
21
+ /** The slice of quasar's manager this needs: a connection, by name. */
22
+ interface ConnectionSource {
23
+ connection(name?: string): unknown;
24
+ }
25
+
26
+ /**
27
+ * Read a member without assuming how the object answers.
28
+ *
29
+ * Two shapes have to work, and they disagree about `in`. Quasar's accessor is
30
+ * a Proxy over an empty null-prototype object with only a `get` trap, so
31
+ * `"connection" in manager` is FALSE while reading it returns the function —
32
+ * gating on `in` rejected the real manager. And a module namespace under a
33
+ * test double RAISES for an export it does not have, rather than answering
34
+ * undefined, so a bare read fails on the mock. Reading through a catch is what
35
+ * satisfies both.
36
+ */
37
+ function readMember(value: unknown, name: string): unknown {
38
+ if (typeof value !== "object" || value === null) return undefined;
39
+ try {
40
+ return Reflect.get(value, name);
41
+ } catch {
42
+ return undefined;
43
+ }
44
+ }
45
+
46
+ function isConnectionSource(value: unknown): value is ConnectionSource {
47
+ return typeof readMember(value, "connection") === "function";
48
+ }
49
+
50
+ export interface QuasarConnectionRequest {
51
+ /** The package asking. It prefixes every message this can raise. */
52
+ pkg: string;
53
+ /**
54
+ * How this package builds an error.
55
+ *
56
+ * Not optional, and not `new Error` by default: a package with its own
57
+ * error type carries codes (`E_<PKG>_<REASON>`) that a caller catches on,
58
+ * and a shared helper throwing a bare Error would silently drop them. The
59
+ * two reasons are distinguished so the codes can be too.
60
+ */
61
+ raise: (
62
+ reason: "quasar-missing" | "incomplete-connection",
63
+ message: string,
64
+ cause?: unknown,
65
+ ) => Error;
66
+ /** Connection name, or `undefined` for quasar's default. */
67
+ name?: string;
68
+ /** The commands the caller will actually issue. */
69
+ required: readonly string[];
70
+ /** What the caller does with them, for the message that names a gap. */
71
+ what: string;
72
+ /**
73
+ * A second way out, when this package has one.
74
+ *
75
+ * Several of them accept a client object directly, so "pass a client
76
+ * instead of a connection name" is actionable — and it was in each
77
+ * package's own message before this was shared. Dropping it to unify the
78
+ * wording would have made the error strictly less useful.
79
+ */
80
+ alternative?: string;
81
+ }
82
+
83
+ /**
84
+ * The named connection, checked for the commands the caller needs BEFORE it is
85
+ * handed over — a connection missing one would otherwise fail on the first
86
+ * command, far from the line that asked for it.
87
+ */
88
+ export async function quasarConnection<T>(
89
+ request: QuasarConnectionRequest,
90
+ ): Promise<T> {
91
+ const { pkg, name, required, what, raise, alternative } = request;
92
+ const specifier = "@c9up/quasar/services/main";
93
+ let loaded: unknown;
94
+ try {
95
+ loaded = await import(/* @vite-ignore */ specifier);
96
+ } catch (cause) {
97
+ throw raise(
98
+ "quasar-missing",
99
+ `[${pkg}] ${what} asks for the quasar connection "${name ?? "default"}", but @c9up/quasar is not installed.\n` +
100
+ ` pnpm add @c9up/quasar${alternative ? `, ${alternative}` : ""}`,
101
+ cause,
102
+ );
103
+ }
104
+
105
+ const manager = isConnectionSource(loaded)
106
+ ? loaded
107
+ : Reflect.get(Object(loaded), "default");
108
+ if (!isConnectionSource(manager)) {
109
+ throw raise(
110
+ "quasar-missing",
111
+ `[${pkg}] @c9up/quasar/services/main did not expose a connection() manager`,
112
+ );
113
+ }
114
+
115
+ const connection = manager.connection(name);
116
+ const missing = required.filter(
117
+ (command) => typeof readMember(connection, command) !== "function",
118
+ );
119
+ if (missing.length > 0) {
120
+ throw raise(
121
+ "incomplete-connection",
122
+ `[${pkg}] the quasar connection${name ? ` '${name}'` : ""} is missing ${missing.join(", ")}, which ${what} issues`,
123
+ );
124
+ }
125
+ // Load-bearing: every member of `required` has just been checked to be a
126
+ // function on this object. The caller names the type it needs because only
127
+ // the caller knows which commands it asked for.
128
+ return connection as T;
129
+ }