@onesub/server 0.23.3 → 0.25.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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Holds every `log.*` call site in the package to the field vocabulary declared in
3
+ * `log-format.ts`.
4
+ *
5
+ * Why a source-scanning test rather than more per-call-site assertions. The value of
6
+ * moving data out of the message is that an operator can filter on `productId` — and
7
+ * that value is destroyed by one file calling it `product`, silently, on a path no
8
+ * test happens to exercise. That is not hypothetical: while building
9
+ * `provider-log-fields.test.ts` a mutation renaming `productId` to `product` at the
10
+ * "No orderId in product purchase" site **passed all 13 of its tests**, because that
11
+ * site is not one of the ones asserted. Covering ~100 sites individually to close
12
+ * that gap is not maintainable; checking the vocabulary once, over all of them, is.
13
+ *
14
+ * The vocabulary lives in `log-format.ts`'s module doc and is parsed out of it here,
15
+ * so there is exactly one list. A doc comment is an odd place for an enforced
16
+ * contract, but the alternative — an exported `const` array — would ship a
17
+ * test-only value in the bundle that `npm run size` gates.
18
+ *
19
+ * What this test cannot do: it does not know whether a field is *correctly named*
20
+ * for its value, only that the name is one of the sanctioned ones. `bundleId:
21
+ * tx.productId` passes here. Per-site assertions in `provider-log-fields.test.ts`
22
+ * cover that for the paths that matter.
23
+ */
24
+ export {};
25
+ //# sourceMappingURL=field-vocabulary.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-vocabulary.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/field-vocabulary.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * formatLogArgs — the security properties of log rendering.
3
+ *
4
+ * These live here rather than in `logger.test.ts` because they are properties of a
5
+ * pure function from arguments to a string. `logger.ts` holds process-global state
6
+ * and needs `setLogger` juggling; nothing that carries a security claim should
7
+ * depend on that.
8
+ *
9
+ * The central claim is one property, asserted over a hostile matrix rather than
10
+ * case by case: **no byte supplied by a caller can begin a line.** Everything else
11
+ * here is either a corollary or a guard against the formatter throwing on input it
12
+ * will genuinely receive.
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=log-format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-format.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/log-format.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
@@ -1,11 +1,18 @@
1
1
  /**
2
- * The process-wide logger, and specifically that a caller cannot forge log lines.
2
+ * The process-wide logger: routing, and the shape of what reaches the sink.
3
3
  *
4
- * Much of what this server logs is attacker-influenced `userId` arrives in the
5
- * request body, and bundle ids, package names and receipt previews come out of
6
- * submitted receipts. A newline in any of those would let a caller end the current
7
- * line and write an entry of their own, and these logs are what support and fraud
8
- * decisions get read from.
4
+ * The escaping and rendering details moved to `log-format.test.ts`, which tests them
5
+ * as properties of a pure function over a hostile matrix rather than one case at a
6
+ * time. What is left here is what only this module can answer: that each level goes
7
+ * where it should, and that a sink receives **exactly one string argument**.
8
+ *
9
+ * That last one is the load-bearing assertion. It is the contract every documented
10
+ * sink depends on — `pino` treats a second argument as a printf interpolation
11
+ * parameter, not as structured fields, so anything "helpfully" passing fields
12
+ * alongside the message would silently degrade for the sink this package recommends
13
+ * for production. There is also then no shape for a JSON serialiser to drop: an
14
+ * `Error` passed as an object would serialise to `{}`, because its own properties
15
+ * are non-enumerable.
9
16
  */
10
17
  export {};
11
18
  //# sourceMappingURL=logger.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/logger.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
1
+ {"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/logger.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What the Apple and Google providers actually put on a log line.
3
+ *
4
+ * These paths had **no log assertions at all** before this file, which is worth
5
+ * stating plainly: the 49 call sites in `providers/apple.ts` and
6
+ * `providers/google.ts` could have been migrated to `(message, fields)` — or
7
+ * broken — and the whole suite would have stayed green either way. So this file
8
+ * is not belt-and-braces on top of `log-format.test.ts`; it is the only thing
9
+ * that holds the providers to the contract.
10
+ *
11
+ * It tests through the real provider functions rather than through
12
+ * `formatLogArgs`, because the two failure modes that matter are call-site
13
+ * failures a pure formatter test cannot see:
14
+ *
15
+ * 1. **A value left in the message.** `formatLogArgs` escapes whatever it is
16
+ * given; it cannot know that `bundleId` should have been a field. Only an
17
+ * assertion on the rendered line catches an interpolated value.
18
+ * 2. **A field named differently in two places.** The point of moving values
19
+ * out of the message is that an operator can filter on `productId`. That is
20
+ * lost the moment one file calls it `product` — and nothing but an exact
21
+ * assertion notices.
22
+ *
23
+ * Hence exact-line assertions, not `toContain`. A substring match would pass on
24
+ * `productId=x` *and* on a message that happened to mention it.
25
+ */
26
+ export {};
27
+ //# sourceMappingURL=provider-log-fields.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-log-fields.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/provider-log-fields.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}