@aooth/arbac-moost 0.1.66 → 0.1.67

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.
@@ -1,4 +1,4 @@
1
- import { r as AoothArbacClaims, t as ArbacUserProvider } from "../user.provider-B1f6ZI45.mjs";
1
+ import { r as AoothArbacClaims, t as ArbacUserProvider } from "../user.provider-DDwcuUsU.mjs";
2
2
  import { TAtscriptAnnotatedType, TAtscriptTypeObject, TMetadataMap, TValidatorOptions, Validator } from "@atscript/typescript/utils";
3
3
  import { AoothUserCredentials } from "@aooth/user/atscript-db/model.as";
4
4
  //#region src/atscript/auto-provider.d.ts
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ArbacDbScope, c as enforceControlsPolicy, d as NavRelationKey, f as NavTarget, i as conjoinArbacDbScopes, l as extractUsedControlValues, m as ProjectionOf, n as ArbacUserProviderToken, o as AsArbacDbController, p as OwnFieldKey, r as AoothArbacClaims, s as applyAllowedFieldsAndSet, t as ArbacUserProvider, u as ControlsOf } from "./user.provider-B1f6ZI45.mjs";
1
+ import { a as ArbacDbScope, c as enforceControlsPolicy, d as NavRelationKey, f as NavTarget, i as conjoinArbacDbScopes, l as extractUsedControlValues, m as ProjectionOf, n as ArbacUserProviderToken, o as AsArbacDbController, p as OwnFieldKey, r as AoothArbacClaims, s as applyAllowedFieldsAndSet, t as ArbacUserProvider, u as ControlsOf } from "./user.provider-DDwcuUsU.mjs";
2
2
  import { Arbac, Arbac as Arbac$1, TArbacCompiledRule, TArbacEvalResult, TArbacRole, TArbacRoleForResource, TArbacRule, arbacPatternToRegex } from "@aooth/arbac-core";
3
3
  import { TAuthGuardDef } from "@moostjs/event-http";
4
4
  import { EventContext } from "@wooksjs/event-core";
@@ -129,11 +129,8 @@ declare class AsArbacDbReadableController<T extends TAtscriptAnnotatedType = TAt
129
129
  */
130
130
  protected applyMetaOverlay(meta: TMetaResponse): Promise<TMetaResponse>;
131
131
  /**
132
- * Scope-aware field-existence check — same contract as
133
- * {@link AsArbacDbController.hasField} (BUG-3): a field outside the
134
- * read-scope projection union answers `false`, so `validateInsights` rejects
135
- * `$select` / filter / sort references to it with the identical
136
- * `Unknown field "x"` 400 a nonexistent field gets.
132
+ * Scope-aware field visibility — same contract as
133
+ * {@link AsArbacDbController.hasField}.
137
134
  */
138
135
  protected hasField(path: string): boolean;
139
136
  }
package/dist/index.mjs CHANGED
@@ -717,9 +717,9 @@ let AsArbacDbController = class AsArbacDbController extends AsDbController {
717
717
  * controls of a request. Runs after the base validator (which checks the
718
718
  * controls DTO shape) and BEFORE the query/aggregation pipeline executes.
719
719
  *
720
- * `transformFilter` runs first on every read endpoint and caches the
721
- * evaluated scopes via `arbac.setScopes(...)`, so we read those scopes
722
- * directly here without re-evaluating ARBAC.
720
+ * Reads the scopes the route-level authorize interceptor cached via
721
+ * `arbac.setScopes(...)` — validation runs before `transformFilter`, so
722
+ * this hook never re-evaluates ARBAC.
723
723
  *
724
724
  * On a violation we throw `HttpError(403)`. moost-db's `query` / `pages` /
725
725
  * `getOne` handlers do NOT wrap `validateParsed` in try/catch, so the
@@ -736,18 +736,12 @@ let AsArbacDbController = class AsArbacDbController extends AsDbController {
736
736
  return applyArbacMetaOverlay(meta, metaAlwaysVisibleFields(this, this.readable));
737
737
  }
738
738
  /**
739
- * Field-existence check, scope-aware (BUG-3 twin of the `/meta` pruning
740
- * above): a field outside the read-scope projection union must be
741
- * indistinguishable from a field that does not exist. The base controller's
742
- * ONLY call site is `validateInsights`, which turns a `false` here into the
743
- * same `Unknown field "x"` HTTP 400 a truly nonexistent field gets — so
744
- * `$select`, filter, and sort references to a hidden field cannot be used
745
- * as an existence/value oracle. Identifier fields stay visible (reads
746
- * always return them — see {@link MetaVisibility.alwaysVisible}), and paths
747
- * under a `with`-granted relation pass through to the sub-scope's own
748
- * enforcement. Scopes were cached by the route-level authorize interceptor
749
- * before validation runs (`useArbac` setScopes), so the union reflects the
750
- * exact action being executed.
739
+ * Scope-aware field visibility (BUG-3 twin of the `/meta` pruning above): a
740
+ * field outside the read-scope projection union answers `false`, which
741
+ * moost-db's visibility hook turns into the same `Unknown field "x"` 400 a
742
+ * nonexistent field gets at every gated query position — see the docs'
743
+ * "Column-scope security floor". Identifiers stay visible; paths under a
744
+ * `with`-granted relation pass through to the sub-scope's own enforcement.
751
745
  */
752
746
  hasField(path) {
753
747
  return super.hasField(path) && isScopedFieldVisible(readCachedScopes(), path, metaAlwaysVisibleFields(this, this.readable));
@@ -932,11 +926,8 @@ let AsArbacDbReadableController = class AsArbacDbReadableController extends AsDb
932
926
  return applyArbacMetaOverlay(meta, metaAlwaysVisibleFields(this, this.readable));
933
927
  }
934
928
  /**
935
- * Scope-aware field-existence check — same contract as
936
- * {@link AsArbacDbController.hasField} (BUG-3): a field outside the
937
- * read-scope projection union answers `false`, so `validateInsights` rejects
938
- * `$select` / filter / sort references to it with the identical
939
- * `Unknown field "x"` 400 a nonexistent field gets.
929
+ * Scope-aware field visibility — same contract as
930
+ * {@link AsArbacDbController.hasField}.
940
931
  */
941
932
  hasField(path) {
942
933
  return super.hasField(path) && isScopedFieldVisible(readCachedScopes(), path, metaAlwaysVisibleFields(this, this.readable));
@@ -152,9 +152,9 @@ declare class AsArbacDbController<T extends TAtscriptAnnotatedType = TAtscriptAn
152
152
  * controls of a request. Runs after the base validator (which checks the
153
153
  * controls DTO shape) and BEFORE the query/aggregation pipeline executes.
154
154
  *
155
- * `transformFilter` runs first on every read endpoint and caches the
156
- * evaluated scopes via `arbac.setScopes(...)`, so we read those scopes
157
- * directly here without re-evaluating ARBAC.
155
+ * Reads the scopes the route-level authorize interceptor cached via
156
+ * `arbac.setScopes(...)` — validation runs before `transformFilter`, so
157
+ * this hook never re-evaluates ARBAC.
158
158
  *
159
159
  * On a violation we throw `HttpError(403)`. moost-db's `query` / `pages` /
160
160
  * `getOne` handlers do NOT wrap `validateParsed` in try/catch, so the
@@ -163,18 +163,12 @@ declare class AsArbacDbController<T extends TAtscriptAnnotatedType = TAtscriptAn
163
163
  protected validateControls(controls: Record<string, unknown>, type: "query" | "pages" | "getOne"): string | undefined;
164
164
  protected applyMetaOverlay(meta: TMetaResponse): Promise<TMetaResponse>;
165
165
  /**
166
- * Field-existence check, scope-aware (BUG-3 twin of the `/meta` pruning
167
- * above): a field outside the read-scope projection union must be
168
- * indistinguishable from a field that does not exist. The base controller's
169
- * ONLY call site is `validateInsights`, which turns a `false` here into the
170
- * same `Unknown field "x"` HTTP 400 a truly nonexistent field gets — so
171
- * `$select`, filter, and sort references to a hidden field cannot be used
172
- * as an existence/value oracle. Identifier fields stay visible (reads
173
- * always return them — see {@link MetaVisibility.alwaysVisible}), and paths
174
- * under a `with`-granted relation pass through to the sub-scope's own
175
- * enforcement. Scopes were cached by the route-level authorize interceptor
176
- * before validation runs (`useArbac` setScopes), so the union reflects the
177
- * exact action being executed.
166
+ * Scope-aware field visibility (BUG-3 twin of the `/meta` pruning above): a
167
+ * field outside the read-scope projection union answers `false`, which
168
+ * moost-db's visibility hook turns into the same `Unknown field "x"` 400 a
169
+ * nonexistent field gets at every gated query position — see the docs'
170
+ * "Column-scope security floor". Identifiers stay visible; paths under a
171
+ * `with`-granted relation pass through to the sub-scope's own enforcement.
178
172
  */
179
173
  protected hasField(path: string): boolean;
180
174
  protected onWrite(action: "insert" | "insertMany" | "replace" | "replaceMany" | "update" | "updateMany", data: unknown): Promise<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/arbac-moost",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "description": "Moost RBAC integration for aoothjs (migrated from @moostjs/arbac)",
5
5
  "keywords": [
6
6
  "abac",
@@ -60,17 +60,17 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
- "@uniqu/core": "^0.1.9",
64
- "@aooth/arbac": "0.1.66",
65
- "@aooth/user": "0.1.66",
66
- "@aooth/arbac-core": "0.1.66"
63
+ "@uniqu/core": "^0.1.10",
64
+ "@aooth/arbac": "0.1.67",
65
+ "@aooth/user": "0.1.67",
66
+ "@aooth/arbac-core": "0.1.67"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@atscript/core": "^0.1.93",
70
- "@atscript/db": "^0.1.132",
71
- "@atscript/db-sql-tools": "^0.1.132",
72
- "@atscript/db-sqlite": "^0.1.132",
73
- "@atscript/moost-db": "^0.1.132",
70
+ "@atscript/db": "^0.1.133",
71
+ "@atscript/db-sql-tools": "^0.1.133",
72
+ "@atscript/db-sqlite": "^0.1.133",
73
+ "@atscript/moost-db": "^0.1.133",
74
74
  "@atscript/typescript": "^0.1.93",
75
75
  "@moostjs/event-http": "^0.6.37",
76
76
  "@types/better-sqlite3": "^7.6.13",
@@ -78,8 +78,8 @@
78
78
  "unplugin-atscript": "^0.1.93"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atscript/db": "^0.1.132",
82
- "@atscript/moost-db": "^0.1.132",
81
+ "@atscript/db": "^0.1.133",
82
+ "@atscript/moost-db": "^0.1.133",
83
83
  "@atscript/typescript": "^0.1.93",
84
84
  "@moostjs/event-http": "^0.6.37",
85
85
  "@wooksjs/event-core": "^0.7.23",