@oimlsmart/platform-server 0.2.8 → 0.2.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oimlsmart/platform-server",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "The OIML SMART platform server kernel: the store seam (ServerStore + the D1 and SQLite implementations), the canonical D1 migration set both deployments apply, the instance profile, the mailer, the RBAC map, the OIDC/OAuth client cones, and the shared role/permission vocabulary. Consumed by the smart monorepo (browser/) and the identity service.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -428,3 +428,87 @@ export const CREATION_PERMISSIONS: Record<string, readonly ActionPermission[]> =
428
428
  export const FIELD_GUARD_PERMISSIONS: Record<string, Record<string, readonly ActionPermission[]>> = {
429
429
  testReports: { signature_acknowledgment: ['tr.sign'] },
430
430
  }
431
+
432
+ // ── The store-wide write gate (the 2026-09-07 security cone audit's
433
+ // F2) ────────────────────────────────────────────────────────────
434
+ // ORG_FIELDS (store.ts) cones the org-fielded workflow stores and
435
+ // STORE_MACHINES + CREATION/FIELD_GUARD gate the machinated ones — but
436
+ // both leave holes the audit named: a store with NO org fields and NO
437
+ // machine answered a generic PUT/DELETE from ANY authenticated role
438
+ // (viewer included), and a machinated store gated only its status moves
439
+ // — a field update without a status change, or a creation the CREATION
440
+ // map does not name, computed NO requirement at all. The worst
441
+ // amplification: organizations carries the submission_public_keys the
442
+ // intake's signature check trusts.
443
+ //
444
+ // THIS map is the write side's store-class declaration for the stores
445
+ // the org cone cannot carry: EVERY generic write to a listed store
446
+ // (create, in-place update, delete — status change or not) requires the
447
+ // actor to hold ANY of the named permissions, on top of every other
448
+ // gate that fires (the machine's transitions, the creation acts, the
449
+ // field guards). The consumer's entities router composes the classes:
450
+ // org-fielded → the org cone; catalog → the catalog write gate;
451
+ // machinated → the machine's edges; listed here → this gate; NONE of
452
+ // those → the generic write refuses outright (deny-by-default). The
453
+ // gate is uniform over roles: the platform roles pass because their map
454
+ // grants the permission, never because the gate looks away.
455
+
456
+ /** The store-wide write requirements (store → any-of permission set).
457
+ * The assignments follow the app's actual write callers, audited
458
+ * 2026-09-07:
459
+ *
460
+ * - the participants register (PD-03/PD-04/PD-08/PD-09): the Executive
461
+ * Secretary administers (participants.manage), the RC assesses
462
+ * (participants.review), the MC votes (participants.decide);
463
+ * - the scheme-operations records (B 18 §7 — appeals, complaints,
464
+ * misuse, deregistrations) are the operations console's;
465
+ * - the §15.8 registered copies record at the registration act (the
466
+ * IA's local register-with-BIML fallback holds certificate.register)
467
+ * and at the operations console's corrections;
468
+ * - the ANR validation letters record at issuance (the issuing
469
+ * officer's certificate.issue) and at the operations console;
470
+ * - the ANR declarations: the Utilizer/Associate staffer declares
471
+ * (anr.declare), the registry moderates (anr.review) — the DRAFT's
472
+ * in-place edits ride the declarer's permission;
473
+ * - the instrument register's parties (organizations, manufacturers)
474
+ * are instance-settings/registry records — organizations in
475
+ * particular carries submission_public_keys, the intake signature
476
+ * trust root, so its writes are the instance's own administration;
477
+ * the manufacturer org rows are created at application intake (the
478
+ * wizard's quick-create, the IA desk's white-gloves entry);
479
+ * - the per-model determination records are the evaluation desk's
480
+ * (er.review / the TR review that stamps them);
481
+ * - the lab's work records (form instances, verification records, the
482
+ * module-B markings/sealings/calibration records) ride their work
483
+ * permissions; the IA's review desks write form instances on the
484
+ * review/reopen legs;
485
+ * - the certificate's document lists and annexes are the issuers'. */
486
+ export const STORE_WRITE_PERMISSIONS: Record<string, readonly ActionPermission[]> = {
487
+ organizations: ['instance.settings'],
488
+ manufacturers: ['application.submit', 'application.review', 'instance.settings'],
489
+ experts: ['participants.manage'],
490
+ utilizers: ['participants.manage'],
491
+ associates: ['participants.manage'],
492
+ categorySchemes: ['participants.manage'],
493
+ approvalVotes: ['participants.decide'],
494
+ competenceEvidence: ['participants.review', 'participants.manage'],
495
+ participantApplications: ['participants.review', 'participants.manage'],
496
+ participantDeclarations: ['participants.manage'],
497
+ operatedSchemes: ['instance.settings'],
498
+ certificateDocumentLists: ['certificate.issue'],
499
+ certificateAnnexes: ['certificate.issue', 'certificate.manage'],
500
+ registeredCopies: ['certificate.register', 'operations.manage'],
501
+ validationLetters: ['certificate.issue', 'operations.manage'],
502
+ deregistrations: ['operations.manage'],
503
+ appeals: ['operations.manage'],
504
+ complaints: ['operations.manage'],
505
+ misuseCases: ['operations.manage'],
506
+ anrDeclarations: ['anr.declare', 'anr.review'],
507
+ testReportDeterminations: ['tr.review', 'er.review'],
508
+ formInstances: ['run.perform', 'tr.review', 'er.review'],
509
+ verificationRecords: ['verification.perform'],
510
+ certificateRegistrations: ['certificate.register'],
511
+ markings: ['markings.manage'],
512
+ sealings: ['markings.manage'],
513
+ calibrationRecords: ['markings.manage'],
514
+ }