@starci/eslint-canon-be 3.8.14 → 3.8.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.8.15 - 2026-10-30
4
+
5
+ - Changed: R260 `jwt-alg-pinned` (`BE_JWT_ALG_PINNED`) admits a non-Supabase OIDC verifier such as the Keycloak client of full: every `jose` `jwtVerify` still pins a non-empty literal subset of ES256, RS256 and EdDSA and derives its issuer from typed configuration, and the principal is now bound either by an `audience` that derives from typed configuration (traced like the issuer: a `*Options`/`*Config`/`*Env` parameter or property, a configuration file, a local variable or a string transformation of one) or, where the audience is the issuer-wide literal (Supabase-style `authenticated`), by rejecting every role other than authenticated before the principal is returned, as before. A verifier with neither is refused naming both. The lite Passport verifier (own ES256 tokens, configured audience) passes on its audience. Shared in `runtime/scripts/hfs/architecture/jwt-ast.mjs` (`fromConfig`, formerly `issuerFromConfig`); the bundled `rules.yaml` states the law. Specs: `src/jwt-alg.spec.ts` (role-free OIDC verifiers with a configured client id, audience list, aliased or namespace `jwtVerify` admitted; a literal, `authenticated`, missing or untyped audience, a literal issuer and insecure algorithms refused; the Passport-shaped verifier with a configured audience admitted; every Supabase-style guard case unchanged).
6
+ - Proven: R25 (`dead-exports`) counts a unit service spec and a logic client spec that import a public injection token through a `@modules` alias (`KEYCLOAK` of `integrations/keycloak`, `HTTP_CLIENT` of `platform/http`) as consumers of that entry. Spec: `src/hfs-unused-export.spec.ts`. No rule changed.
7
+ - Changed: the bundled canon pins name hfs 4.11.16, eslint-canon-be 3.8.15, eslint-canon-fe 9.5.17, the Grammar family 0.15.28 and test-world 1.3.2.
8
+
3
9
  ## 3.8.14 - 2026-10-29
4
10
 
5
11
  - Changed: `inbox-dedupe-required` (R80) and `webhook-inbox-key` (R263) accept `claimRow(source, eventId, tx, receipt)` on the `EntityInbox` port of `platform/inbox` (and `claim` on an `EntityInbox`-typed receiver) as a delivery method's first await, with the same guarantees as `claim`: the real port by its owner (a lookalike is refused), the first await (R263: the first statement, keyed by the delivery id, with the transaction callback's own manager), and the return on a repeat, which for `claimRow` is the receipt id answering `undefined` (`!receiptId` or `receiptId === undefined`, inline or stored and tested straight after). A stored answer is compared by binding in either operand. The R263 receipt-port check also admits an `EntityInbox` constructor parameter. Shared in `lib/ports.ts` (`isInboxPortType`, `inboxClaimOf`, `refusesRepeat`); the typed fixture's inbox port declares `EntityInbox`. Specs: `r80-inbox-dedupe-required.spec.ts` and `webhook-handoff-inbox.spec.ts` (valid claimRow intakes; claimRow not first, on a lookalike, keyed by a constant, with another manager, with too few arguments, without the return, or returning on `false`, refused). The bundled `rules.yaml` states both laws with `claimRow`.
package/dist/jwt-alg.js CHANGED
@@ -1,4 +1,4 @@
1
- /** R260 BE_JWT_ALG_PINNED: remote JWT verification pins algorithms, configuration and principal role. */
1
+ /** R260 BE_JWT_ALG_PINNED: JWT verification pins algorithms and a configured issuer, and binds the principal by a configured audience or the authenticated role. */
2
2
  import ts from "typescript";
3
3
  import { typed } from "./lib/types.js";
4
4
  import { isDeclarationFile } from "./lib/path.js";
@@ -25,7 +25,7 @@ const joseVerifier = (checker, expression, seen = new Set()) => {
25
25
  export const jwtAlgPinned = {
26
26
  meta: {
27
27
  type: "problem",
28
- docs: { description: "R260 BE_JWT_ALG_PINNED: literal secure algorithms, config issuer and authenticated principal role." },
28
+ docs: { description: "R260 BE_JWT_ALG_PINNED: literal secure algorithms, config issuer, and a config audience or the authenticated principal role." },
29
29
  schema: [],
30
30
  messages: { pinned: "{{detail}}" },
31
31
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-be",
3
- "version": "3.8.14",
3
+ "version": "3.8.15",
4
4
  "description": "The StarCi back-end lint canon: every rule its laws publish, gathered as one flat-config plugin.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,35 +31,35 @@ pins:
31
31
  source: packages/event-stream/package.json
32
32
  why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
33
33
  '@starci/grammar':
34
- version: 0.15.27
34
+ version: 0.15.28
35
35
  group: starci
36
36
  install: registry
37
37
  side: fe
38
38
  source: packages/grammar/package.json
39
39
  why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
40
40
  '@starci/eslint-canon-be':
41
- version: 3.8.14
41
+ version: 3.8.15
42
42
  group: starci
43
43
  install: registry
44
44
  side: be
45
45
  source: packages/eslint-canon-be/package.json
46
46
  why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
47
47
  '@starci/eslint-canon-fe':
48
- version: 9.5.16
48
+ version: 9.5.17
49
49
  group: starci
50
50
  install: registry
51
51
  side: fe
52
52
  source: packages/eslint-canon-fe/package.json
53
53
  why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
54
54
  '@starci/eslint-grammar-core':
55
- version: 0.15.27
55
+ version: 0.15.28
56
56
  group: starci
57
57
  install: registry
58
58
  side: fe
59
59
  source: packages/eslint-grammar-core/package.json
60
60
  why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
61
61
  '@starci/eslint-grammar-offset-pop':
62
- version: 0.15.27
62
+ version: 0.15.28
63
63
  group: starci
64
64
  install: registry
65
65
  side: fe
@@ -92,7 +92,7 @@ pins:
92
92
  source: packages/jest-preset/package.json
93
93
  why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeQueryBuilder, queueQueryBuilders, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
94
94
  '@starci/test-world':
95
- version: 1.3.1
95
+ version: 1.3.2
96
96
  group: starci
97
97
  install: registry
98
98
  side: be
@@ -106,7 +106,7 @@ pins:
106
106
  source: packages/ai-router/package.json
107
107
  why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
108
108
  '@starci/hfs':
109
- version: 4.11.15
109
+ version: 4.11.16
110
110
  group: starci
111
111
  install: registry
112
112
  side: both
@@ -4346,7 +4346,7 @@ rules:
4346
4346
  - {path: packages/hfs/src/hfs-database-config.spec.mjs, editions: [lite], codes: [DB_EXTENSION_ALLOWED, DB_MIGRATION_DESTRUCTIVE, HFS_SEED_PII, DB_VAULT_WRITE]}
4347
4347
  - id: R260
4348
4348
  code: "BE_JWT_ALG_PINNED"
4349
- law: "A back-end JWT verifier pins a nonempty literal subset of ES256, RS256 and EdDSA and obtains its issuer from configuration. A principal is built only after verification and rejection of every role other than authenticated, in lite and full."
4349
+ law: "Every back-end JWT verifier pins a nonempty literal subset of ES256, RS256 and EdDSA and obtains its issuer from typed configuration. A principal is built only after verification and is bound either by an audience read from typed configuration (an OIDC verifier such as the Keycloak of full, or the app's own Passport access tokens of lite) or, where every token of the issuer shares one audience (Supabase-style), by rejecting every role other than authenticated first, in lite and full."
4350
4350
  kinds: [check, lint]
4351
4351
  gates: ["pre-commit","settle","land","ci"]
4352
4352
  failureCodes: ["BE_JWT_ALG_PINNED"]
@@ -140,7 +140,7 @@ function checkOwnJwks(input) {
140
140
  return { violations, coverage: { status: 'checked', integrationFiles: integrations.length, verifyCalls: counters.verifyCalls, verifiedCalls: counters.verifiedCalls } };
141
141
  }
142
142
 
143
- /** R260 BE_JWT_ALG_PINNED: every jose jwtVerify call pins a literal secure algorithm list, a configured issuer and the authenticated role. */
143
+ /** R260 BE_JWT_ALG_PINNED: every jose jwtVerify call pins a literal secure algorithm list and a configured issuer, and binds the principal by a configured audience or the authenticated role. */
144
144
  export function checkJwtPolicy(input) {
145
145
  const kit = machineKit(input);
146
146
  const violations = [];
@@ -61,28 +61,28 @@ const configType = (checker, node) => {
61
61
  || /(?:Config|Options|Env)$/u.test(symbol.name)));
62
62
  };
63
63
 
64
- /** Trace issuer construction through configuration values and local URL/string transformations. */
65
- const issuerFromConfig = (ts, checker, expression, seen = new Set()) => {
64
+ /** Trace an issuer or audience to typed configuration values through local URL/string transformations. */
65
+ const fromConfig = (ts, checker, expression, seen = new Set()) => {
66
66
  const node = unwrap(ts, expression);
67
67
  if (!node || seen.has(node)) return false;
68
68
  const next = new Set(seen).add(node);
69
69
  if (ts.isIdentifier(node)) {
70
70
  return declarationsOf(ts, checker, node).some(declaration => {
71
- if (ts.isVariableDeclaration(declaration) && declaration.initializer) return issuerFromConfig(ts, checker, declaration.initializer, next);
71
+ if (ts.isVariableDeclaration(declaration) && declaration.initializer) return fromConfig(ts, checker, declaration.initializer, next);
72
72
  if (ts.isParameter(declaration) || ts.isPropertyDeclaration(declaration)) return configType(checker, node);
73
73
  return /(?:\.config|\.env)\.ts$|\/modules\/config\//u.test(String(declaration.getSourceFile().fileName).replaceAll('\\', '/'));
74
74
  });
75
75
  }
76
76
  if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
77
- return issuerFromConfig(ts, checker, node.expression, next) || declarationsOf(ts, checker, node).some(declaration =>
77
+ return fromConfig(ts, checker, node.expression, next) || declarationsOf(ts, checker, node).some(declaration =>
78
78
  (ts.isParameter(declaration) || ts.isPropertyDeclaration(declaration)) && !declaration.initializer && configType(checker, node));
79
79
  }
80
- if (ts.isTemplateExpression(node)) return node.templateSpans.some(span => issuerFromConfig(ts, checker, span.expression, next));
80
+ if (ts.isTemplateExpression(node)) return node.templateSpans.some(span => fromConfig(ts, checker, span.expression, next));
81
81
  if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.PlusToken) {
82
- return issuerFromConfig(ts, checker, node.left, next) || issuerFromConfig(ts, checker, node.right, next);
82
+ return fromConfig(ts, checker, node.left, next) || fromConfig(ts, checker, node.right, next);
83
83
  }
84
84
  if (ts.isCallExpression(node) || ts.isNewExpression(node)) {
85
- return issuerFromConfig(ts, checker, node.expression, next) || node.arguments?.some(argument => issuerFromConfig(ts, checker, argument, next));
85
+ return fromConfig(ts, checker, node.expression, next) || node.arguments?.some(argument => fromConfig(ts, checker, argument, next));
86
86
  }
87
87
  return false;
88
88
  };
@@ -201,7 +201,12 @@ export const jwtPolicyProblems = (ts, checker, call) => {
201
201
  || options?.properties.some(entry => ts.isSpreadAssignment(entry))) {
202
202
  problems.push('BE_JWT_ALG_PINNED: algorithms must be a non-empty literal subset of ES256, RS256 and EdDSA.');
203
203
  }
204
- if (!issuerFromConfig(ts, checker, value('issuer'))) problems.push('BE_JWT_ALG_PINNED: issuer must derive from typed configuration.');
205
- if (!rejectsOtherRoles(ts, checker, call)) problems.push('BE_JWT_ALG_PINNED: the verified principal must reject every role other than authenticated before returning it.');
204
+ if (!fromConfig(ts, checker, value('issuer'))) problems.push('BE_JWT_ALG_PINNED: issuer must derive from typed configuration.');
205
+ // The principal is bound either by an audience of typed configuration (an OIDC client such as Keycloak, the app's own
206
+ // Passport tokens) or, where the audience is shared by every token of the issuer (Supabase's literal 'authenticated'),
207
+ // by rejecting every role other than authenticated before the principal is returned.
208
+ if (!fromConfig(ts, checker, value('audience')) && !rejectsOtherRoles(ts, checker, call)) {
209
+ problems.push('BE_JWT_ALG_PINNED: an OIDC verifier audience must derive from typed configuration, or the verified principal must reject every role other than authenticated before returning it.');
210
+ }
206
211
  return problems;
207
212
  };