@cerebruminc/yates 3.5.1 → 3.5.2-beta.dangerous.3edd915
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 +8 -0
- package/README.md +18 -20
- package/dist/index.d.ts +3 -2
- package/dist/index.js +221 -196
- package/dist/index.js.map +1 -1
- package/package.json +49 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.5.2](https://github.com/cerebruminc/yates/compare/v3.5.1...v3.5.2) (2024-04-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* avoid race condition when creating policies ([4d77dfb](https://github.com/cerebruminc/yates/commit/4d77dfb7c750943277b581976bf66887d1f4521f))
|
|
9
|
+
* update to prisma v5.11.0 ([4aa0a92](https://github.com/cerebruminc/yates/commit/4aa0a921a5df69d62e8d3e941e828b4933e7750a))
|
|
10
|
+
|
|
3
11
|
## [3.5.1](https://github.com/cerebruminc/yates/compare/v3.5.0...v3.5.1) (2024-03-29)
|
|
4
12
|
|
|
5
13
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<h1>Yates = Prisma + RLS</h1>
|
|
7
7
|
|
|
8
8
|
<p>
|
|
9
|
-
A module for implementing role
|
|
9
|
+
A module for implementing role-based access control with Prisma when using Postgres
|
|
10
10
|
</p>
|
|
11
11
|
<br>
|
|
12
12
|
</div>
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
|
|
16
16
|
<br>
|
|
17
17
|
|
|
18
|
-
Yates is a module for implementing role
|
|
19
|
-
It uses the [Row Level Security](https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html) feature of PostgreSQL to provide a simple and secure way to implement role based access control that allows you to define complex access control rules and have them apply to all of your Prisma queries automatically.
|
|
18
|
+
Yates is a module for implementing role-based access control with Prisma. It is designed to be used with the [Prisma Client](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client) and [PostgreSQL](https://www.postgresql.org/). It uses PostgreSQL's [Row Level Security](https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html) feature to provide a simple and secure way to implement role-based access control. This feature allows you to define complex access control rules and have them apply to all of your Prisma queries automatically.
|
|
20
19
|
|
|
21
20
|
## Prerequisites
|
|
22
21
|
|
|
23
|
-
Yates requires the `prisma` package
|
|
22
|
+
Yates requires the `prisma` package at version 4.9.0 or greater and the `@prisma/client` package at version 4.0.0 or greater. Additionally, it uses [Prisma Client extensions](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions) to generate rules and add RLS checking (which require a preview feature flag until Prisma 4.16.0, so you might need to enable this feature in your Prisma schema):
|
|
24
23
|
|
|
25
24
|
```prisma
|
|
26
25
|
generator client {
|
|
27
26
|
provider = "prisma-client-js"
|
|
28
|
-
previewFeatures = ["clientExtensions"]
|
|
27
|
+
// previewFeatures = ["clientExtensions"] // uncomment when using Prisma before 4.16.0
|
|
29
28
|
}
|
|
30
29
|
```
|
|
31
30
|
|
|
@@ -37,20 +36,24 @@ npm i @cerebruminc/yates
|
|
|
37
36
|
|
|
38
37
|
## Usage
|
|
39
38
|
|
|
40
|
-
Once you've installed Yates, you can use it in your Prisma project by importing it and calling the `setup` function. This function takes a Prisma Client instance and a configuration object as arguments and returns a client that can intercept all queries and apply the appropriate row
|
|
41
|
-
|
|
42
|
-
Client extensions
|
|
43
|
-
|
|
39
|
+
Once you've installed Yates, you can use it in your Prisma project by importing it and calling the `setup` function. This function takes a Prisma Client instance and a configuration object as arguments and returns a client that can intercept all queries and apply the appropriate row-level security policies to them.
|
|
40
|
+
|
|
41
|
+
Yates uses [Prisma Client Extensions](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions) to generate the RLS rules and add the RLS checking to the Prisma Client queries. This means that you can use the Prisma Client as you normally would, and Yates will automatically apply the appropriate RLS policies to each query. It also means that you will need to apply your [Prisma Client middleware](https://www.prisma.io/docs/orm/prisma-client/client-extensions/middleware) _before_ creating the Yates client, as middleware cannot be applied to an extended client.
|
|
42
|
+
|
|
43
|
+
Client extensions share the same API as the Prisma Client, you can use the Yates client as a drop-in replacement for the Prisma Client in your application. They also share the same connection pool as the base client, which means that you can freely create new Yates clients with minimal performance impact.
|
|
44
|
+
|
|
45
|
+
The `setup` function will generate CRUD abilities for each model in your Prisma schema, as well as any additional abilities that you have defined in your configuration. It will then create a new PG role for each ability and apply the appropriate row-level security policies to each role. Finally, it will create a new PG role for each user role you specify and grant them the appropriate abilities.
|
|
44
46
|
|
|
45
|
-
The `setup` function will generate CRUD abilities for each model in your Prisma schema, as well as any additional abilities that you have defined in your configuration. It will then create a new PG role for each ability and apply the appropriate row level security policies to each role. Finally, it will create a new PG role for each user role you specify and grant them the appropriate abilities.
|
|
46
47
|
For Yates to be able to set the correct user role for each request, you must pass a function called `getContext` in the `setup` configuration that will return the user role for the current request. This function will be called for each request and the user role returned will be used to set the `role` in the current session. If you want to bypass RLS completely for a specific role, you can return `null` from the `getContext` function for that role.
|
|
48
|
+
|
|
47
49
|
For accessing the context of a Prisma query, we recommend using a package like [cls-hooked](https://www.npmjs.com/package/cls-hooked) to store the context in the current session.
|
|
48
50
|
|
|
51
|
+
### Example
|
|
52
|
+
|
|
49
53
|
```ts
|
|
50
54
|
import { setup } from "@cerebruminc/yates";
|
|
51
55
|
import { PrismaClient } from "@prisma/client";
|
|
52
56
|
|
|
53
|
-
|
|
54
57
|
const prisma = new PrismaClient();
|
|
55
58
|
|
|
56
59
|
const client = await setup({
|
|
@@ -85,7 +88,7 @@ const client = await setup({
|
|
|
85
88
|
},
|
|
86
89
|
operation: "DELETE",
|
|
87
90
|
},
|
|
88
|
-
}
|
|
91
|
+
},
|
|
89
92
|
User: {
|
|
90
93
|
updateOwnUser: {
|
|
91
94
|
description: "Update own user",
|
|
@@ -95,8 +98,7 @@ const client = await setup({
|
|
|
95
98
|
},
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
|
-
|
|
99
|
-
})
|
|
101
|
+
}),
|
|
100
102
|
// Return a mapping of user roles and abilities.
|
|
101
103
|
// This function is paramaterised with a list of all CRUD abilities that have been
|
|
102
104
|
// automatically generated by Yates, as well as any customAbilities that have been defined.
|
|
@@ -117,8 +119,6 @@ const client = await setup({
|
|
|
117
119
|
}
|
|
118
120
|
const { user } = ctx;
|
|
119
121
|
|
|
120
|
-
let role = user.role;
|
|
121
|
-
|
|
122
122
|
const role = user.role
|
|
123
123
|
|
|
124
124
|
return {
|
|
@@ -146,10 +146,8 @@ When defining an ability you need to provide the following properties:
|
|
|
146
146
|
|
|
147
147
|
- `description`: A description of the ability.
|
|
148
148
|
- `expression`: A boolean SQL expression that will be used to filter the results of the query. This expression can use any of the columns in the table that the ability is being applied to, as well as any context settings that have been defined in the `getContext` function.
|
|
149
|
-
|
|
150
149
|
- For `INSERT`, `UPDATE` and `DELETE` operations, the expression uses the values from the row being inserted. If the expression returns `false` for a row, that row will not be inserted, updated or deleted.
|
|
151
150
|
- For `SELECT` operations, the expression uses the values from the row being returned. If the expression returns `false` for a row, that row will not be returned.
|
|
152
|
-
|
|
153
151
|
- `operation`: The operation that the ability is being applied to. This can be one of `CREATE`, `READ`, `UPDATE` or `DELETE`.
|
|
154
152
|
|
|
155
153
|
### Debug
|
|
@@ -161,11 +159,11 @@ To run Yates in debug mode, use the environment variable `DEBUG=yates`.
|
|
|
161
159
|
### Nested transactions
|
|
162
160
|
|
|
163
161
|
Yates uses a transaction to apply the RLS policies to each query. This means that if you are using transactions in your application, rollbacks will not work as expected. This is because [Prisma has poor support for nested transactions](https://github.com/prisma/prisma/issues/15212) and will `COMMIT` the inner transaction even if the outer transaction is rolled back.
|
|
164
|
-
If you need this functionality and you are using Yates, you can return `null` from the `getContext()` setup method to bypass the internal transaction, and therefore the RLS policies for the current request.
|
|
162
|
+
If you need this functionality and you are using Yates, you can return `null` from the `getContext()` setup method to bypass the internal transaction, and therefore the RLS policies for the current request. See the `nested-transactions.spec.ts` test case for an example of how to do this.
|
|
165
163
|
|
|
166
164
|
### Unsupported Prisma Client query features
|
|
167
165
|
|
|
168
|
-
If you are using the Prisma
|
|
166
|
+
If you are using the Prisma Client to construct an ability expression, the following `where` keywords are not supported.
|
|
169
167
|
|
|
170
168
|
- `AND`
|
|
171
169
|
- `OR`
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type CustomAbilities<ContextKeys extends string = string, YModels extends
|
|
|
32
32
|
};
|
|
33
33
|
export type GetContextFn<ContextKeys extends string = string> = () => {
|
|
34
34
|
role: string;
|
|
35
|
+
transactionId?: string;
|
|
35
36
|
context?: {
|
|
36
37
|
[key in ContextKeys]: string | number | string[];
|
|
37
38
|
};
|
|
@@ -43,7 +44,7 @@ declare module "@prisma/client" {
|
|
|
43
44
|
}
|
|
44
45
|
export declare const createAbilityName: (model: string, ability: string) => string;
|
|
45
46
|
export declare const createRoleName: (name: string) => string;
|
|
46
|
-
export declare const createClient: (prisma: PrismaClient, getContext: GetContextFn, options?: ClientOptions) => import("@prisma/client/runtime/library").DynamicClientExtensionThis<Prisma.TypeMap<import("@prisma/client/runtime/library").
|
|
47
|
+
export declare const createClient: (prisma: PrismaClient, getContext: GetContextFn, options?: ClientOptions) => import("@prisma/client/runtime/library").DynamicClientExtensionThis<Prisma.TypeMap<import("@prisma/client/runtime/library").InternalArgs & {
|
|
47
48
|
result: {};
|
|
48
49
|
model: {};
|
|
49
50
|
query: {};
|
|
@@ -89,7 +90,7 @@ export interface SetupParams<ContextKeys extends string = string, YModels extend
|
|
|
89
90
|
/**
|
|
90
91
|
* Creates an extended client that sets contextual parameters and user role on every query
|
|
91
92
|
**/
|
|
92
|
-
export declare const setup: <ContextKeys extends string = string, YModels extends Prisma.ModelName = Prisma.ModelName, K extends CustomAbilities<ContextKeys, YModels> = CustomAbilities<ContextKeys, YModels>>(params: SetupParams<ContextKeys, YModels, K>) => Promise<import("@prisma/client/runtime/library").DynamicClientExtensionThis<Prisma.TypeMap<import("@prisma/client/runtime/library").
|
|
93
|
+
export declare const setup: <ContextKeys extends string = string, YModels extends Prisma.ModelName = Prisma.ModelName, K extends CustomAbilities<ContextKeys, YModels> = CustomAbilities<ContextKeys, YModels>>(params: SetupParams<ContextKeys, YModels, K>) => Promise<import("@prisma/client/runtime/library").DynamicClientExtensionThis<Prisma.TypeMap<import("@prisma/client/runtime/library").InternalArgs & {
|
|
93
94
|
result: {};
|
|
94
95
|
model: {};
|
|
95
96
|
query: {};
|
package/dist/index.js
CHANGED
|
@@ -185,149 +185,159 @@ var createClient = function (prisma, getContext, options) {
|
|
|
185
185
|
if (options === void 0) { options = {}; }
|
|
186
186
|
// Set default options
|
|
187
187
|
var _a = options.txMaxWait, txMaxWait = _a === void 0 ? 30000 : _a, _b = options.txTimeout, txTimeout = _b === void 0 ? 30000 : _b;
|
|
188
|
+
// biome-ignore lint/suspicious/noExplicitAny: TODO fix this
|
|
189
|
+
prisma._transactionWithCallback = function (_a) {
|
|
190
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
191
|
+
var headers, optionsWithDefaults, info, result, transaction, e_1;
|
|
192
|
+
var _c, _d, _e, _f;
|
|
193
|
+
var callback = _b.callback, options = _b.options;
|
|
194
|
+
return __generator(this, function (_g) {
|
|
195
|
+
switch (_g.label) {
|
|
196
|
+
case 0:
|
|
197
|
+
headers = { traceparent: this._tracingHelper.getTraceParent() };
|
|
198
|
+
optionsWithDefaults = {
|
|
199
|
+
maxWait: (_c = options === null || options === void 0 ? void 0 : options.maxWait) !== null && _c !== void 0 ? _c : this._engineConfig.transactionOptions.maxWait,
|
|
200
|
+
timeout: (_d = options === null || options === void 0 ? void 0 : options.timeout) !== null && _d !== void 0 ? _d : this._engineConfig.transactionOptions.timeout,
|
|
201
|
+
isolationLevel: (_e = options === null || options === void 0 ? void 0 : options.isolationLevel) !== null && _e !== void 0 ? _e : this._engineConfig.transactionOptions.isolationLevel,
|
|
202
|
+
new_tx_id: (_f = options === null || options === void 0 ? void 0 : options.new_tx_id) !== null && _f !== void 0 ? _f : undefined,
|
|
203
|
+
};
|
|
204
|
+
return [4 /*yield*/, this._engine.transaction("start", headers, optionsWithDefaults)];
|
|
205
|
+
case 1:
|
|
206
|
+
info = _g.sent();
|
|
207
|
+
_g.label = 2;
|
|
208
|
+
case 2:
|
|
209
|
+
_g.trys.push([2, 5, , 7]);
|
|
210
|
+
transaction = __assign({ kind: "itx" }, info);
|
|
211
|
+
transaction.yates_id = optionsWithDefaults.new_tx_id;
|
|
212
|
+
return [4 /*yield*/, callback(this._createItxClient(transaction))];
|
|
213
|
+
case 3:
|
|
214
|
+
result = _g.sent();
|
|
215
|
+
// it went well, then we commit the transaction
|
|
216
|
+
return [4 /*yield*/, this._engine.transaction("commit", headers, info)];
|
|
217
|
+
case 4:
|
|
218
|
+
// it went well, then we commit the transaction
|
|
219
|
+
_g.sent();
|
|
220
|
+
return [3 /*break*/, 7];
|
|
221
|
+
case 5:
|
|
222
|
+
e_1 = _g.sent();
|
|
223
|
+
// it went bad, then we rollback the transaction
|
|
224
|
+
return [4 /*yield*/, this._engine.transaction("rollback", headers, info).catch(function () { })];
|
|
225
|
+
case 6:
|
|
226
|
+
// it went bad, then we rollback the transaction
|
|
227
|
+
_g.sent();
|
|
228
|
+
throw e_1; // silent rollback, throw original error
|
|
229
|
+
case 7: return [2 /*return*/, result];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
};
|
|
188
234
|
var client = prisma.$extends({
|
|
189
235
|
name: "Yates client",
|
|
190
236
|
query: {
|
|
191
237
|
$allModels: {
|
|
192
238
|
$allOperations: function (params) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (Array.isArray(context[k])) {
|
|
228
|
-
try {
|
|
229
|
-
for (_c = (e_3 = void 0, __values(context[k])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
230
|
-
v = _d.value;
|
|
231
|
-
if (typeof v !== "string") {
|
|
232
|
-
throw new Error("Context variable \"".concat(k, "\" must be an array of strings. Got ").concat(typeof v));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
237
|
-
finally {
|
|
238
|
-
try {
|
|
239
|
-
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
240
|
-
}
|
|
241
|
-
finally { if (e_3) throw e_3.error; }
|
|
242
|
-
}
|
|
243
|
-
// Cast to a JSON string so that it can be used in RLS expressions
|
|
244
|
-
context[k] = JSON.stringify(context[k]);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
249
|
-
finally {
|
|
250
|
-
try {
|
|
251
|
-
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
239
|
+
var e_2, _a, e_3, _b;
|
|
240
|
+
var _c, _d;
|
|
241
|
+
var model = params.model, args = params.args, query = params.query, operation = params.operation;
|
|
242
|
+
if (!model) {
|
|
243
|
+
// If the model is not defined, we can't apply RLS
|
|
244
|
+
// This can occur when you are making a call with Prisma's $queryRaw method
|
|
245
|
+
// biome-ignore lint/suspicious/noExplicitAny: See above
|
|
246
|
+
return query(args);
|
|
247
|
+
}
|
|
248
|
+
var ctx = getContext();
|
|
249
|
+
// If ctx is null, the middleware is explicitly skipped
|
|
250
|
+
if (ctx === null) {
|
|
251
|
+
return query(args);
|
|
252
|
+
}
|
|
253
|
+
var role = ctx.role, context = ctx.context;
|
|
254
|
+
var pgRole = (0, exports.createRoleName)(role);
|
|
255
|
+
if (context) {
|
|
256
|
+
try {
|
|
257
|
+
for (var _e = __values(Object.keys(context)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
258
|
+
var k = _f.value;
|
|
259
|
+
if (!k.match(/^[a-z_\.]+$/)) {
|
|
260
|
+
throw new Error("Context variable \"".concat(k, "\" contains invalid characters. Context variables must only contain lowercase letters, numbers, periods and underscores."));
|
|
261
|
+
}
|
|
262
|
+
if (typeof context[k] !== "number" &&
|
|
263
|
+
typeof context[k] !== "string" &&
|
|
264
|
+
!Array.isArray(context[k])) {
|
|
265
|
+
throw new Error("Context variable \"".concat(k, "\" must be a string, number or array. Got ").concat(typeof context[k]));
|
|
266
|
+
}
|
|
267
|
+
if (Array.isArray(context[k])) {
|
|
268
|
+
try {
|
|
269
|
+
for (var _g = (e_3 = void 0, __values(context[k])), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
270
|
+
var v = _h.value;
|
|
271
|
+
if (typeof v !== "string") {
|
|
272
|
+
throw new Error("Context variable \"".concat(k, "\" must be an array of strings. Got ").concat(typeof v));
|
|
252
273
|
}
|
|
253
|
-
finally { if (e_2) throw e_2.error; }
|
|
254
274
|
}
|
|
255
275
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return __generator(this, function (_e) {
|
|
263
|
-
switch (_e.label) {
|
|
264
|
-
case 0:
|
|
265
|
-
// Switch to the user role, We can't use a prepared statement here, due to limitations in PG not allowing prepared statements to be used in SET ROLE
|
|
266
|
-
return [4 /*yield*/, tx.$queryRawUnsafe("SET ROLE ".concat(pgRole))];
|
|
267
|
-
case 1:
|
|
268
|
-
// Switch to the user role, We can't use a prepared statement here, due to limitations in PG not allowing prepared statements to be used in SET ROLE
|
|
269
|
-
_e.sent();
|
|
270
|
-
_e.label = 2;
|
|
271
|
-
case 2:
|
|
272
|
-
_e.trys.push([2, 7, 8, 9]);
|
|
273
|
-
_a = __values((0, toPairs_1.default)(context)), _b = _a.next();
|
|
274
|
-
_e.label = 3;
|
|
275
|
-
case 3:
|
|
276
|
-
if (!!_b.done) return [3 /*break*/, 6];
|
|
277
|
-
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
|
|
278
|
-
return [4 /*yield*/, tx.$queryRaw(templateObject_2 || (templateObject_2 = __makeTemplateObject(["SELECT set_config(", ", ", ", true);"], ["SELECT set_config(", ", ", ", true);"])), key, value.toString())];
|
|
279
|
-
case 4:
|
|
280
|
-
_e.sent();
|
|
281
|
-
_e.label = 5;
|
|
282
|
-
case 5:
|
|
283
|
-
_b = _a.next();
|
|
284
|
-
return [3 /*break*/, 3];
|
|
285
|
-
case 6: return [3 /*break*/, 9];
|
|
286
|
-
case 7:
|
|
287
|
-
e_4_1 = _e.sent();
|
|
288
|
-
e_4 = { error: e_4_1 };
|
|
289
|
-
return [3 /*break*/, 9];
|
|
290
|
-
case 8:
|
|
291
|
-
try {
|
|
292
|
-
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
293
|
-
}
|
|
294
|
-
finally { if (e_4) throw e_4.error; }
|
|
295
|
-
return [7 /*endfinally*/];
|
|
296
|
-
case 9:
|
|
297
|
-
txId = tx[Symbol.for("prisma.client.transaction.id")];
|
|
298
|
-
__internalParams = params.__internalParams;
|
|
299
|
-
return [4 /*yield*/, prisma._executeRequest(__assign(__assign({}, __internalParams), { transaction: {
|
|
300
|
-
kind: "itx",
|
|
301
|
-
id: txId,
|
|
302
|
-
} }))];
|
|
303
|
-
case 10:
|
|
304
|
-
result = _e.sent();
|
|
305
|
-
// Switch role back to admin user
|
|
306
|
-
return [4 /*yield*/, tx.$queryRawUnsafe("SET ROLE none")];
|
|
307
|
-
case 11:
|
|
308
|
-
// Switch role back to admin user
|
|
309
|
-
_e.sent();
|
|
310
|
-
return [2 /*return*/, result];
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}); }, {
|
|
314
|
-
maxWait: txMaxWait,
|
|
315
|
-
timeout: txTimeout,
|
|
316
|
-
})];
|
|
317
|
-
case 2:
|
|
318
|
-
queryResults = _h.sent();
|
|
319
|
-
return [2 /*return*/, queryResults];
|
|
320
|
-
case 3:
|
|
321
|
-
e_1 = _h.sent();
|
|
322
|
-
// Normalize RLS errors to make them a bit more readable.
|
|
323
|
-
if ((_g = e_1.message) === null || _g === void 0 ? void 0 : _g.includes("new row violates row-level security policy for table")) {
|
|
324
|
-
throw new Error("You do not have permission to perform this action: ".concat(model, ".").concat(operation, "(...)"));
|
|
276
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
277
|
+
finally {
|
|
278
|
+
try {
|
|
279
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
280
|
+
}
|
|
281
|
+
finally { if (e_3) throw e_3.error; }
|
|
325
282
|
}
|
|
326
|
-
|
|
327
|
-
|
|
283
|
+
// Cast to a JSON string so that it can be used in RLS expressions
|
|
284
|
+
context[k] = JSON.stringify(context[k]);
|
|
285
|
+
}
|
|
328
286
|
}
|
|
287
|
+
}
|
|
288
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
289
|
+
finally {
|
|
290
|
+
try {
|
|
291
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
292
|
+
}
|
|
293
|
+
finally { if (e_2) throw e_2.error; }
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
var txId = (_c = ctx.transactionId) !== null && _c !== void 0 ? _c : hashWithPrefix("yates_tx_", JSON.stringify(ctx));
|
|
298
|
+
// Because batch transactions inside a prisma client query extension can run out of order if used with async middleware,
|
|
299
|
+
// we need to run the logic inside an interactive transaction, however this brings a different set of problems in that the
|
|
300
|
+
// main query will no longer automatically run inside the transaction. We resolve this issue by manually executing the prisma request.
|
|
301
|
+
// See https://github.com/prisma/prisma/issues/18276
|
|
302
|
+
// @ts-ignore
|
|
303
|
+
return prisma.$transaction(function (tx) {
|
|
304
|
+
return Promise.all([
|
|
305
|
+
// Switch to the user role, We can't use a prepared statement here, due to limitations in PG not allowing prepared statements to be used in SET ROLE
|
|
306
|
+
tx.$queryRawUnsafe("SET ROLE ".concat(pgRole)),
|
|
307
|
+
// Now set all the context variables using `set_config` so that they can be used in RLS
|
|
308
|
+
Promise.all((0, toPairs_1.default)(context).map(function (_a) {
|
|
309
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
310
|
+
return tx.$queryRaw(templateObject_2 || (templateObject_2 = __makeTemplateObject(["SELECT set_config(", ", ", ", true);"], ["SELECT set_config(", ", ", ", true);"])), key, value.toString());
|
|
311
|
+
})),
|
|
312
|
+
// Inconveniently, the `query` function will not run inside an interactive transaction.
|
|
313
|
+
// We need to manually reconstruct the query, and attached the "secret" transaction ID.
|
|
314
|
+
// This ensures that the query will run inside the transaction AND that middlewares will not be re-applied
|
|
315
|
+
// https://github.com/prisma/prisma/blob/4.11.0/packages/client/src/runtime/getPrismaClient.ts#L1013
|
|
316
|
+
(function () {
|
|
317
|
+
// biome-ignore lint/suspicious/noExplicitAny: This is a private API, so not much we can do about it
|
|
318
|
+
var txId = tx[Symbol.for("prisma.client.transaction.id")];
|
|
319
|
+
// See https://github.com/prisma/prisma/blob/4.11.0/packages/client/src/runtime/getPrismaClient.ts#L860
|
|
320
|
+
// biome-ignore lint/suspicious/noExplicitAny: This is a private API, so not much we can do about it
|
|
321
|
+
var __internalParams = params.__internalParams;
|
|
322
|
+
return prisma._executeRequest(__assign(__assign({}, __internalParams), { transaction: {
|
|
323
|
+
kind: "itx",
|
|
324
|
+
id: txId,
|
|
325
|
+
} }));
|
|
326
|
+
})(),
|
|
327
|
+
]).then(function (results) { return results.pop(); });
|
|
328
|
+
}, {
|
|
329
|
+
maxWait: txMaxWait,
|
|
330
|
+
timeout: txTimeout,
|
|
331
|
+
new_tx_id: txId,
|
|
329
332
|
});
|
|
330
|
-
}
|
|
333
|
+
}
|
|
334
|
+
catch (e) {
|
|
335
|
+
// Normalize RLS errors to make them a bit more readable.
|
|
336
|
+
if ((_d = e.message) === null || _d === void 0 ? void 0 : _d.includes("new row violates row-level security policy for table")) {
|
|
337
|
+
throw new Error("You do not have permission to perform this action: ".concat(model, ".").concat(operation, "(...)"));
|
|
338
|
+
}
|
|
339
|
+
throw e;
|
|
340
|
+
}
|
|
331
341
|
},
|
|
332
342
|
},
|
|
333
343
|
},
|
|
@@ -335,8 +345,8 @@ var createClient = function (prisma, getContext, options) {
|
|
|
335
345
|
return client;
|
|
336
346
|
};
|
|
337
347
|
exports.createClient = createClient;
|
|
338
|
-
var setRLS = function (prisma,
|
|
339
|
-
var operation, rawExpression, description
|
|
348
|
+
var setRLS = function (prisma, table, roleName, slug, ability) { return __awaiter(void 0, void 0, void 0, function () {
|
|
349
|
+
var operation, rawExpression, description;
|
|
340
350
|
return __generator(this, function (_a) {
|
|
341
351
|
switch (_a.label) {
|
|
342
352
|
case 0:
|
|
@@ -344,71 +354,86 @@ var setRLS = function (prisma, existingAbilities, table, roleName, slug, ability
|
|
|
344
354
|
if (!rawExpression) {
|
|
345
355
|
throw new Error("Expression must be defined for RLS abilities");
|
|
346
356
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
357
|
+
// Take a lock and run the RLS setup in a transaction to prevent conflicts
|
|
358
|
+
// in a multi-server environment
|
|
359
|
+
return [4 /*yield*/, prisma.$transaction(function (tx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
360
|
+
var policyName, existingAbilities, existingAbility, shouldUpdateAbilityTable, expression, expression;
|
|
361
|
+
return __generator(this, function (_a) {
|
|
362
|
+
switch (_a.label) {
|
|
363
|
+
case 0: return [4 /*yield*/, takeLock(tx)];
|
|
364
|
+
case 1:
|
|
365
|
+
_a.sent();
|
|
366
|
+
policyName = roleName;
|
|
367
|
+
return [4 /*yield*/, tx.$queryRaw(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\t\t\tselect * from _yates._yates_abilities where ability_model = ", " and ability_policy_name = ", "\n\t\t"], ["\n\t\t\tselect * from _yates._yates_abilities where ability_model = ", " and ability_policy_name = ", "\n\t\t"])), table, policyName)];
|
|
368
|
+
case 2:
|
|
369
|
+
existingAbilities = _a.sent();
|
|
370
|
+
existingAbility = existingAbilities[0];
|
|
371
|
+
shouldUpdateAbilityTable = false;
|
|
372
|
+
if (!!existingAbility) return [3 /*break*/, 8];
|
|
373
|
+
debug("Creating RLS policy for", roleName, "on", table, "for", operation);
|
|
374
|
+
return [4 /*yield*/, (0, expressions_1.expressionToSQL)(rawExpression, table)];
|
|
375
|
+
case 3:
|
|
376
|
+
expression = _a.sent();
|
|
377
|
+
if (!(operation === "INSERT")) return [3 /*break*/, 5];
|
|
378
|
+
return [4 /*yield*/, tx.$queryRawUnsafe("\n\t\t\t\tCREATE POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" FOR ").concat(operation, " TO ").concat(roleName, " WITH CHECK (").concat(expression, ");\n\t\t\t"))];
|
|
379
|
+
case 4:
|
|
380
|
+
_a.sent();
|
|
381
|
+
return [3 /*break*/, 7];
|
|
382
|
+
case 5: return [4 /*yield*/, tx.$queryRawUnsafe("\n\t\t\t\tCREATE POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" FOR ").concat(operation, " TO ").concat(roleName, " USING (").concat(expression, ");\n\t\t\t"))];
|
|
383
|
+
case 6:
|
|
384
|
+
_a.sent();
|
|
385
|
+
_a.label = 7;
|
|
386
|
+
case 7:
|
|
387
|
+
shouldUpdateAbilityTable = true;
|
|
388
|
+
return [3 /*break*/, 14];
|
|
389
|
+
case 8:
|
|
390
|
+
if (!(existingAbility.ability_expression !== rawExpression.toString())) return [3 /*break*/, 14];
|
|
391
|
+
debug("Updating RLS policy for", roleName, "on", table, "for", operation);
|
|
392
|
+
return [4 /*yield*/, (0, expressions_1.expressionToSQL)(rawExpression, table)];
|
|
393
|
+
case 9:
|
|
394
|
+
expression = _a.sent();
|
|
395
|
+
if (!(operation === "INSERT")) return [3 /*break*/, 11];
|
|
396
|
+
return [4 /*yield*/, tx.$queryRawUnsafe("\n\t\t\t\tALTER POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" TO ").concat(roleName, " WITH CHECK (").concat(expression, ");\n\t\t\t"))];
|
|
397
|
+
case 10:
|
|
398
|
+
_a.sent();
|
|
399
|
+
return [3 /*break*/, 13];
|
|
400
|
+
case 11: return [4 /*yield*/, tx.$queryRawUnsafe("\n\t\t\t\tALTER POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" TO ").concat(roleName, " USING (").concat(expression, ");\n\t\t\t"))];
|
|
401
|
+
case 12:
|
|
402
|
+
_a.sent();
|
|
403
|
+
_a.label = 13;
|
|
404
|
+
case 13:
|
|
405
|
+
shouldUpdateAbilityTable = true;
|
|
406
|
+
_a.label = 14;
|
|
407
|
+
case 14:
|
|
408
|
+
if (!shouldUpdateAbilityTable) return [3 /*break*/, 16];
|
|
409
|
+
return [4 /*yield*/, upsertAbility(tx, {
|
|
410
|
+
ability_model: table,
|
|
411
|
+
ability_name: slug,
|
|
412
|
+
ability_policy_name: policyName,
|
|
413
|
+
ability_description: description !== null && description !== void 0 ? description : "",
|
|
414
|
+
ability_operation: operation,
|
|
415
|
+
// We store the string representation of the expression so that
|
|
416
|
+
// we can compare it later without having to recompute the SQL
|
|
417
|
+
ability_expression: rawExpression.toString(),
|
|
418
|
+
})];
|
|
419
|
+
case 15:
|
|
420
|
+
_a.sent();
|
|
421
|
+
_a.label = 16;
|
|
422
|
+
case 16: return [2 /*return*/];
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}); })];
|
|
355
426
|
case 1:
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return [4 /*yield*/, prisma.$queryRawUnsafe("\n\t\t\t\tCREATE POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" FOR ").concat(operation, " TO ").concat(roleName, " WITH CHECK (").concat(expression, ");\n\t\t\t"))];
|
|
359
|
-
case 2:
|
|
360
|
-
_a.sent();
|
|
361
|
-
return [3 /*break*/, 5];
|
|
362
|
-
case 3: return [4 /*yield*/, prisma.$queryRawUnsafe("\n\t\t\t\tCREATE POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" FOR ").concat(operation, " TO ").concat(roleName, " USING (").concat(expression, ");\n\t\t\t"))];
|
|
363
|
-
case 4:
|
|
364
|
-
_a.sent();
|
|
365
|
-
_a.label = 5;
|
|
366
|
-
case 5:
|
|
367
|
-
shouldUpdateAbilityTable = true;
|
|
368
|
-
return [3 /*break*/, 12];
|
|
369
|
-
case 6:
|
|
370
|
-
if (!(existingAbility.ability_expression !== rawExpression.toString())) return [3 /*break*/, 12];
|
|
371
|
-
debug("Updating RLS policy for", roleName, "on", table, "for", operation);
|
|
372
|
-
return [4 /*yield*/, (0, expressions_1.expressionToSQL)(rawExpression, table)];
|
|
373
|
-
case 7:
|
|
374
|
-
expression = _a.sent();
|
|
375
|
-
if (!(operation === "INSERT")) return [3 /*break*/, 9];
|
|
376
|
-
return [4 /*yield*/, prisma.$queryRawUnsafe("\n\t\t\t\tALTER POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" TO ").concat(roleName, " WITH CHECK (").concat(expression, ");\n\t\t\t"))];
|
|
377
|
-
case 8:
|
|
378
|
-
_a.sent();
|
|
379
|
-
return [3 /*break*/, 11];
|
|
380
|
-
case 9: return [4 /*yield*/, prisma.$queryRawUnsafe("\n\t\t\t\tALTER POLICY ".concat(policyName, " ON \"public\".\"").concat(table, "\" TO ").concat(roleName, " USING (").concat(expression, ");\n\t\t\t"))];
|
|
381
|
-
case 10:
|
|
382
|
-
_a.sent();
|
|
383
|
-
_a.label = 11;
|
|
384
|
-
case 11:
|
|
385
|
-
shouldUpdateAbilityTable = true;
|
|
386
|
-
_a.label = 12;
|
|
387
|
-
case 12:
|
|
388
|
-
if (!shouldUpdateAbilityTable) return [3 /*break*/, 14];
|
|
389
|
-
return [4 /*yield*/, prisma.$transaction([
|
|
390
|
-
takeLock(prisma),
|
|
391
|
-
upsertAbility(prisma, {
|
|
392
|
-
ability_model: table,
|
|
393
|
-
ability_name: slug,
|
|
394
|
-
ability_policy_name: policyName,
|
|
395
|
-
ability_description: description !== null && description !== void 0 ? description : "",
|
|
396
|
-
ability_operation: operation,
|
|
397
|
-
// We store the string representation of the expression so that
|
|
398
|
-
// we can compare it later without having to recompute the SQL
|
|
399
|
-
ability_expression: rawExpression.toString(),
|
|
400
|
-
}),
|
|
401
|
-
])];
|
|
402
|
-
case 13:
|
|
427
|
+
// Take a lock and run the RLS setup in a transaction to prevent conflicts
|
|
428
|
+
// in a multi-server environment
|
|
403
429
|
_a.sent();
|
|
404
|
-
|
|
405
|
-
case 14: return [2 /*return*/];
|
|
430
|
+
return [2 /*return*/];
|
|
406
431
|
}
|
|
407
432
|
});
|
|
408
433
|
}); };
|
|
409
434
|
var createRoles = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
410
435
|
var abilities, runtimeDataModel, models, diff, models_1, models_1_1, model, ability, operation, roles, pgRoles, existingAbilities, pgPolicies, migratedAbilities, _c, _d, _e, _i, model, table, _loop_1, _f, _g, _h, _j, slug, _loop_2, _k, _l, _m, _o, key;
|
|
411
|
-
var
|
|
436
|
+
var e_4, _p;
|
|
412
437
|
var _q;
|
|
413
438
|
var prisma = _b.prisma, customAbilities = _b.customAbilities, getRoles = _b.getRoles;
|
|
414
439
|
return __generator(this, function (_r) {
|
|
@@ -476,12 +501,12 @@ var createRoles = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
476
501
|
}
|
|
477
502
|
}
|
|
478
503
|
}
|
|
479
|
-
catch (
|
|
504
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
480
505
|
finally {
|
|
481
506
|
try {
|
|
482
507
|
if (models_1_1 && !models_1_1.done && (_p = models_1.return)) _p.call(models_1);
|
|
483
508
|
}
|
|
484
|
-
finally { if (
|
|
509
|
+
finally { if (e_4) throw e_4.error; }
|
|
485
510
|
}
|
|
486
511
|
debug("Setting up ability table");
|
|
487
512
|
return [4 /*yield*/, setupAbilityTable(prisma)];
|
|
@@ -562,7 +587,7 @@ var createRoles = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
562
587
|
_s.label = 3;
|
|
563
588
|
case 3:
|
|
564
589
|
if (!ability.expression) return [3 /*break*/, 5];
|
|
565
|
-
return [4 /*yield*/, setRLS(prisma,
|
|
590
|
+
return [4 /*yield*/, setRLS(prisma, table, roleName, slug,
|
|
566
591
|
// biome-ignore lint/suspicious/noExplicitAny: TODO fix this
|
|
567
592
|
ability)];
|
|
568
593
|
case 4:
|
|
@@ -716,5 +741,5 @@ var setup = function (params) { return __awaiter(void 0, void 0, void 0, functio
|
|
|
716
741
|
});
|
|
717
742
|
}); };
|
|
718
743
|
exports.setup = setup;
|
|
719
|
-
var templateObject_1, templateObject_2;
|
|
744
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
720
745
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiC;AAEjC,gDAA2B;AAC3B,iEAA2C;AAC3C,2DAAqC;AACrC,mDAA6B;AAC7B,2DAAqC;AACrC,6CAA8E;AAE9E,IAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,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AE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;gBAE7D,sBAAO,MAAM,EAAC;;;KACd,CAAC;AAvBW,QAAA,KAAK,SAuBhB"}
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
2
|
+
"name": "@cerebruminc/yates",
|
|
3
|
+
"version": "3.5.2-beta.dangerous.3edd915",
|
|
4
|
+
"description": "Role based access control for Prisma Apps",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"CHANGELOG.md",
|
|
8
|
+
"dist",
|
|
9
|
+
"images"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"generate": "prisma generate",
|
|
13
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
14
|
+
"test": "npm run lint",
|
|
15
|
+
"lint": "biome check .",
|
|
16
|
+
"lint:fix": "biome check . --apply",
|
|
17
|
+
"test:types": "tsc --noEmit",
|
|
18
|
+
"test:integration": "jest --runInBand test/integration",
|
|
19
|
+
"test:compose:integration": "docker compose -f docker-compose.yml --profile with-sut up db sut --exit-code-from sut",
|
|
20
|
+
"setup": "prisma generate && prisma migrate dev",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"author": "Cerebrum <hello@cerebrum.com> (https://cerebrum.com)",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@biomejs/biome": "1.5.3",
|
|
27
|
+
"@prisma/client": "^5.11.0",
|
|
28
|
+
"@types/cls-hooked": "^4.3.3",
|
|
29
|
+
"@types/jest": "^29.2.6",
|
|
30
|
+
"@types/lodash": "^4.14.191",
|
|
31
|
+
"@types/uuid": "^9.0.0",
|
|
32
|
+
"cls-hooked": "^4.2.2",
|
|
33
|
+
"jest": "^29.3.1",
|
|
34
|
+
"prisma": "^5.0.0",
|
|
35
|
+
"rimraf": "^5.0.5",
|
|
36
|
+
"ts-jest": "^29.0.5",
|
|
37
|
+
"typescript": "^5.3.3",
|
|
38
|
+
"uuid": "^9.0.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@types/debug": "^4.1.12",
|
|
42
|
+
"debug": "^4.3.4",
|
|
43
|
+
"lodash": "^4.17.21",
|
|
44
|
+
"node-sql-parser": "^4.12.0",
|
|
45
|
+
"type-fest": "^4.10.3"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@prisma/client": "^5.11.0",
|
|
49
|
+
"prisma": "^5.11.0"
|
|
50
|
+
}
|
|
51
51
|
}
|