@adaptic/backend 0.0.1045 → 0.0.1047
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/esm/auth/credential-redaction.d.ts +12 -8
- package/esm/auth/credential-redaction.d.ts.map +1 -1
- package/esm/auth/credential-redaction.js.map +1 -1
- package/esm/auth/credential-redaction.mjs +40 -10
- package/esm/generated/typegraphql-prisma/models/TradeAuditEvent.d.ts +2 -2
- package/esm/generated/typegraphql-prisma/models/TradeAuditEvent.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/models/TradeAuditEvent.js.map +1 -1
- package/esm/generated/typegraphql-prisma/models/TradeAuditEvent.mjs +4 -4
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.mjs +2 -2
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.mjs +2 -2
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.mjs +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.mjs +2 -2
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.d.ts.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.js.map +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.mjs +2 -2
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.d.ts +144 -0
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.d.ts.map +1 -0
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.js.map +1 -0
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.mjs +920 -0
- package/esm/middleware/audit-log-write-redaction.d.ts +82 -0
- package/esm/middleware/audit-log-write-redaction.d.ts.map +1 -0
- package/esm/middleware/audit-log-write-redaction.js.map +1 -0
- package/esm/middleware/audit-log-write-redaction.mjs +138 -0
- package/esm/middleware/audit-logger.d.ts +80 -17
- package/esm/middleware/audit-logger.d.ts.map +1 -1
- package/esm/middleware/audit-logger.js.map +1 -1
- package/esm/middleware/audit-logger.mjs +182 -67
- package/esm/middleware/index.d.ts +1 -0
- package/esm/middleware/index.d.ts.map +1 -1
- package/esm/middleware/index.js.map +1 -1
- package/esm/middleware/index.mjs +3 -0
- package/esm/prismaClient.d.ts +22 -0
- package/esm/prismaClient.d.ts.map +1 -1
- package/esm/prismaClient.js.map +1 -1
- package/esm/prismaClient.mjs +27 -3
- package/generated/typegraphql-prisma/models/TradeAuditEvent.cjs +3 -3
- package/generated/typegraphql-prisma/models/TradeAuditEvent.d.ts +2 -2
- package/generated/typegraphql-prisma/models/TradeAuditEvent.d.ts.map +1 -1
- package/generated/typegraphql-prisma/models/TradeAuditEvent.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.cjs +2 -2
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.cjs +2 -2
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventCreateManyInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithAggregationInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventOrderByWithRelationInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventScalarWhereWithAggregatesInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventUpdateManyMutationInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/inputs/TradeAuditEventWhereUniqueInput.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.cjs +2 -2
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradeAuditEvent.js.map +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.cjs +2 -2
- package/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.d.ts.map +1 -1
- package/generated/typegraphql-prisma/resolvers/outputs/TradeAuditEventGroupBy.js.map +1 -1
- package/package.json +1 -1
- package/prismaClient.cjs +28 -2
- package/prismaClient.d.ts +22 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stored-credential values never reach an `AuditLog` row written through the
|
|
3
|
+
* server's Prisma client, whoever writes it.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* An audit row is readable far more widely than the credential column it
|
|
8
|
+
* copies, so a key stored in one is a second, unguarded copy of the secret.
|
|
9
|
+
* The GraphQL audit plugin (`./audit-logger`) and the TradingPolicy audit
|
|
10
|
+
* trail (`./trading-policy-audit`) each redact the payload they build, but a
|
|
11
|
+
* row can be written without either of them: the generated
|
|
12
|
+
* `createOneAuditLog`, `createManyAuditLog`, `createManyAndReturnAuditLog`,
|
|
13
|
+
* `updateOneAuditLog`, `updateManyAuditLog` and `upsertOneAuditLog` mutations
|
|
14
|
+
* hand their arguments to Prisma as the caller sent them, and so would any
|
|
15
|
+
* other server-side `auditLog` write. Redaction that depends on each writer
|
|
16
|
+
* remembering to call it holds only for the writers that remember.
|
|
17
|
+
*
|
|
18
|
+
* This extension applies the redaction where every one of those paths
|
|
19
|
+
* converges — the Prisma client the server hands to resolvers, plugins and
|
|
20
|
+
* guards — so it holds regardless of caller. In every row an `AuditLog`
|
|
21
|
+
* operation writes (under `data`, `create` or `update`, one row or many),
|
|
22
|
+
* each column value that holds a credential-named key is replaced by its
|
|
23
|
+
* {@link redactCredentials} copy before the query engine sees it: the same
|
|
24
|
+
* function and key set the audit payload guard applies on read, so a stored
|
|
25
|
+
* row is already what an unprivileged reader is served. The operation is
|
|
26
|
+
* recognised by the arguments it carries rather than by its name, so a write
|
|
27
|
+
* operation Prisma adds later is covered without an edit here.
|
|
28
|
+
*
|
|
29
|
+
* ## Why redaction by key name is enough here
|
|
30
|
+
*
|
|
31
|
+
* The rule recognises a credential by the name of the key that holds it, so
|
|
32
|
+
* it holds when every recorded value sits under its column's own name. The
|
|
33
|
+
* audit plugin, the one writer that records what callers send, resolves each
|
|
34
|
+
* mutation's arguments from the executed field, so a credential passed as
|
|
35
|
+
* `APIKey: $key` is recorded at `input.APIKey` rather than under the
|
|
36
|
+
* operation's variable name; and the vocabulary is held to every
|
|
37
|
+
* credential-shaped column in the Prisma schema by its own test. A caller
|
|
38
|
+
* that writes an audit row directly and stores a credential under a name that
|
|
39
|
+
* is no credential column's is not recognised: no rule keyed on names can see
|
|
40
|
+
* it, and one keyed on value shapes would rewrite credential-free rows.
|
|
41
|
+
*
|
|
42
|
+
* ## What it leaves alone, and what it replaces without a credential
|
|
43
|
+
*
|
|
44
|
+
* A column value in which redaction would replace nothing
|
|
45
|
+
* ({@link credentialKeyPaths} is empty) is passed on exactly as received, so
|
|
46
|
+
* a row without a credential is written as the unextended client would write
|
|
47
|
+
* it — including Prisma's `DbNull` / `JsonNull` sentinels and `Date` values,
|
|
48
|
+
* which a redaction pass would otherwise turn into `{}` and an ISO string. A
|
|
49
|
+
* credential key that holds nothing (absent, `null`, or an update's
|
|
50
|
+
* `{ set: null }`) replaces nothing, so a clear stays visible as a clear.
|
|
51
|
+
* Reads, deletes and filters carry no row payload and pass through untouched.
|
|
52
|
+
*
|
|
53
|
+
* The redaction walks a value only to a fixed depth (`MAX_DEPTH` in
|
|
54
|
+
* `auth/credential-redaction`): whatever sits 12 or more levels inside a
|
|
55
|
+
* column value cannot be inspected, so it is replaced with the placeholder
|
|
56
|
+
* whether or not it holds a credential, and that column is not passed on
|
|
57
|
+
* unchanged. Treating a value it cannot inspect as a credential is the
|
|
58
|
+
* fail-closed choice, and it is the same limit the audit plugin, the
|
|
59
|
+
* TradingPolicy trail and the read guard apply.
|
|
60
|
+
*
|
|
61
|
+
* @module middleware/audit-log-write-redaction
|
|
62
|
+
*/
|
|
63
|
+
import type { PrismaClient } from '@prisma/client';
|
|
64
|
+
/** Argument keys through which a Prisma operation writes row content. */
|
|
65
|
+
export declare const ROW_PAYLOAD_ARGS: readonly ["data", "create", "update"];
|
|
66
|
+
/**
|
|
67
|
+
* The arguments of an `AuditLog` operation with every credential value in the
|
|
68
|
+
* rows it writes redacted. Returns the same object when nothing needed
|
|
69
|
+
* redacting, so an operation without a credential reaches Prisma unchanged.
|
|
70
|
+
*
|
|
71
|
+
* @param args - The operation's arguments as Prisma received them.
|
|
72
|
+
* @returns The arguments to execute.
|
|
73
|
+
*/
|
|
74
|
+
export declare function redactAuditLogWriteArgs<T>(args: T): T;
|
|
75
|
+
/**
|
|
76
|
+
* Apply AuditLog write redaction to a Prisma client.
|
|
77
|
+
*
|
|
78
|
+
* @param client - The client to wrap.
|
|
79
|
+
* @returns The client with every `AuditLog` write redacted.
|
|
80
|
+
*/
|
|
81
|
+
export declare function withAuditLogWriteRedaction(client: PrismaClient): PrismaClient;
|
|
82
|
+
//# sourceMappingURL=audit-log-write-redaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log-write-redaction.d.ts","sourceRoot":"","sources":["../../../src/middleware/audit-log-write-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,uCAAwC,CAAC;AAyBtE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAcrD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAgB7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log-write-redaction.js","sourceRoot":"","sources":["../../../src/middleware/audit-log-write-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAIH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAErF,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAEtE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,6FAA6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xC,IAAI,QAAQ,KAAK,OAAO;YAAE,SAAS;QACnC,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC;QACpB,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACtB,CAAC;IACD,yEAAyE;IACzE,uEAAuE;IACvE,OAAO,CAAC,GAAG,IAAI,IAAI,CAAM,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAoB;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC/B,IAAI,EAAE,2BAA2B;QACjC,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;oBAC5B,OAAO,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC9C,CAAC;aACF;SACF;KACF,CAAC,CAAC;IACH,yEAAyE;IACzE,4EAA4E;IAC5E,0EAA0E;IAC1E,6CAA6C;IAC7C,OAAO,QAAmC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stored-credential values never reach an `AuditLog` row written through the
|
|
3
|
+
* server's Prisma client, whoever writes it.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* An audit row is readable far more widely than the credential column it
|
|
8
|
+
* copies, so a key stored in one is a second, unguarded copy of the secret.
|
|
9
|
+
* The GraphQL audit plugin (`./audit-logger`) and the TradingPolicy audit
|
|
10
|
+
* trail (`./trading-policy-audit`) each redact the payload they build, but a
|
|
11
|
+
* row can be written without either of them: the generated
|
|
12
|
+
* `createOneAuditLog`, `createManyAuditLog`, `createManyAndReturnAuditLog`,
|
|
13
|
+
* `updateOneAuditLog`, `updateManyAuditLog` and `upsertOneAuditLog` mutations
|
|
14
|
+
* hand their arguments to Prisma as the caller sent them, and so would any
|
|
15
|
+
* other server-side `auditLog` write. Redaction that depends on each writer
|
|
16
|
+
* remembering to call it holds only for the writers that remember.
|
|
17
|
+
*
|
|
18
|
+
* This extension applies the redaction where every one of those paths
|
|
19
|
+
* converges — the Prisma client the server hands to resolvers, plugins and
|
|
20
|
+
* guards — so it holds regardless of caller. In every row an `AuditLog`
|
|
21
|
+
* operation writes (under `data`, `create` or `update`, one row or many),
|
|
22
|
+
* each column value that holds a credential-named key is replaced by its
|
|
23
|
+
* {@link redactCredentials} copy before the query engine sees it: the same
|
|
24
|
+
* function and key set the audit payload guard applies on read, so a stored
|
|
25
|
+
* row is already what an unprivileged reader is served. The operation is
|
|
26
|
+
* recognised by the arguments it carries rather than by its name, so a write
|
|
27
|
+
* operation Prisma adds later is covered without an edit here.
|
|
28
|
+
*
|
|
29
|
+
* ## Why redaction by key name is enough here
|
|
30
|
+
*
|
|
31
|
+
* The rule recognises a credential by the name of the key that holds it, so
|
|
32
|
+
* it holds when every recorded value sits under its column's own name. The
|
|
33
|
+
* audit plugin, the one writer that records what callers send, resolves each
|
|
34
|
+
* mutation's arguments from the executed field, so a credential passed as
|
|
35
|
+
* `APIKey: $key` is recorded at `input.APIKey` rather than under the
|
|
36
|
+
* operation's variable name; and the vocabulary is held to every
|
|
37
|
+
* credential-shaped column in the Prisma schema by its own test. A caller
|
|
38
|
+
* that writes an audit row directly and stores a credential under a name that
|
|
39
|
+
* is no credential column's is not recognised: no rule keyed on names can see
|
|
40
|
+
* it, and one keyed on value shapes would rewrite credential-free rows.
|
|
41
|
+
*
|
|
42
|
+
* ## What it leaves alone, and what it replaces without a credential
|
|
43
|
+
*
|
|
44
|
+
* A column value in which redaction would replace nothing
|
|
45
|
+
* ({@link credentialKeyPaths} is empty) is passed on exactly as received, so
|
|
46
|
+
* a row without a credential is written as the unextended client would write
|
|
47
|
+
* it — including Prisma's `DbNull` / `JsonNull` sentinels and `Date` values,
|
|
48
|
+
* which a redaction pass would otherwise turn into `{}` and an ISO string. A
|
|
49
|
+
* credential key that holds nothing (absent, `null`, or an update's
|
|
50
|
+
* `{ set: null }`) replaces nothing, so a clear stays visible as a clear.
|
|
51
|
+
* Reads, deletes and filters carry no row payload and pass through untouched.
|
|
52
|
+
*
|
|
53
|
+
* The redaction walks a value only to a fixed depth (`MAX_DEPTH` in
|
|
54
|
+
* `auth/credential-redaction`): whatever sits 12 or more levels inside a
|
|
55
|
+
* column value cannot be inspected, so it is replaced with the placeholder
|
|
56
|
+
* whether or not it holds a credential, and that column is not passed on
|
|
57
|
+
* unchanged. Treating a value it cannot inspect as a credential is the
|
|
58
|
+
* fail-closed choice, and it is the same limit the audit plugin, the
|
|
59
|
+
* TradingPolicy trail and the read guard apply.
|
|
60
|
+
*
|
|
61
|
+
* @module middleware/audit-log-write-redaction
|
|
62
|
+
*/
|
|
63
|
+
import { credentialKeyPaths, redactCredentials } from '../auth/credential-redaction.mjs';
|
|
64
|
+
/** Argument keys through which a Prisma operation writes row content. */
|
|
65
|
+
export const ROW_PAYLOAD_ARGS = ['data', 'create', 'update'];
|
|
66
|
+
function isRecord(value) {
|
|
67
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
68
|
+
}
|
|
69
|
+
/** One row with each credential-bearing column value redacted; the same row when none is. */
|
|
70
|
+
function redactRow(row) {
|
|
71
|
+
if (!isRecord(row))
|
|
72
|
+
return row;
|
|
73
|
+
let out;
|
|
74
|
+
for (const [column, value] of Object.entries(row)) {
|
|
75
|
+
if (credentialKeyPaths(value).length === 0)
|
|
76
|
+
continue;
|
|
77
|
+
out ??= { ...row };
|
|
78
|
+
out[column] = redactCredentials(value);
|
|
79
|
+
}
|
|
80
|
+
return out ?? row;
|
|
81
|
+
}
|
|
82
|
+
/** A row payload (one row or many) redacted; the same payload when nothing needed it. */
|
|
83
|
+
function redactPayload(payload) {
|
|
84
|
+
if (!Array.isArray(payload))
|
|
85
|
+
return redactRow(payload);
|
|
86
|
+
const rows = payload.map(redactRow);
|
|
87
|
+
return rows.some((row, index) => row !== payload[index]) ? rows : payload;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The arguments of an `AuditLog` operation with every credential value in the
|
|
91
|
+
* rows it writes redacted. Returns the same object when nothing needed
|
|
92
|
+
* redacting, so an operation without a credential reaches Prisma unchanged.
|
|
93
|
+
*
|
|
94
|
+
* @param args - The operation's arguments as Prisma received them.
|
|
95
|
+
* @returns The arguments to execute.
|
|
96
|
+
*/
|
|
97
|
+
export function redactAuditLogWriteArgs(args) {
|
|
98
|
+
if (!isRecord(args))
|
|
99
|
+
return args;
|
|
100
|
+
let out;
|
|
101
|
+
for (const key of ROW_PAYLOAD_ARGS) {
|
|
102
|
+
const payload = args[key];
|
|
103
|
+
if (payload === undefined)
|
|
104
|
+
continue;
|
|
105
|
+
const redacted = redactPayload(payload);
|
|
106
|
+
if (redacted === payload)
|
|
107
|
+
continue;
|
|
108
|
+
out ??= { ...args };
|
|
109
|
+
out[key] = redacted;
|
|
110
|
+
}
|
|
111
|
+
// Cast justified: `out` is `args` with row payloads replaced by redacted
|
|
112
|
+
// copies of the same shape, so it satisfies whatever `args` satisfied.
|
|
113
|
+
return (out ?? args);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Apply AuditLog write redaction to a Prisma client.
|
|
117
|
+
*
|
|
118
|
+
* @param client - The client to wrap.
|
|
119
|
+
* @returns The client with every `AuditLog` write redacted.
|
|
120
|
+
*/
|
|
121
|
+
export function withAuditLogWriteRedaction(client) {
|
|
122
|
+
const extended = client.$extends({
|
|
123
|
+
name: 'audit-log-write-redaction',
|
|
124
|
+
query: {
|
|
125
|
+
auditLog: {
|
|
126
|
+
$allOperations({ args, query }) {
|
|
127
|
+
return query(redactAuditLogWriteArgs(args));
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
// Prisma types an extended client as a structurally distinct object even
|
|
133
|
+
// though this extension only rewrites query arguments and adds, removes and
|
|
134
|
+
// renames nothing on the model surface; the assertion states that at this
|
|
135
|
+
// one boundary, as `withFindManyGuard` does.
|
|
136
|
+
return extended;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=audit-log-write-redaction.js.map
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Audit Logging Middleware
|
|
3
3
|
*
|
|
4
|
-
* Captures
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Captures every generated write mutation (a create, update, upsert or
|
|
5
|
+
* delete of a Prisma model, except the excluded models below) and records an
|
|
6
|
+
* append-only audit trail. Each audit log entry includes: user ID (from JWT
|
|
7
|
+
* context), timestamp, operation type, model name, record ID, and changed
|
|
8
|
+
* fields. The changed fields are the executed field's own arguments, each
|
|
9
|
+
* under its schema path, with stored-credential values redacted.
|
|
7
10
|
*
|
|
8
11
|
* This middleware is implemented as an Apollo Server plugin that intercepts
|
|
9
12
|
* mutation operations and logs them to the AuditLog table.
|
|
10
13
|
*/
|
|
11
14
|
import type { ApolloServerPlugin } from '@apollo/server';
|
|
12
|
-
import type
|
|
15
|
+
import { type PrismaClient } from '@prisma/client';
|
|
16
|
+
import { type FieldNode, type FragmentDefinitionNode, type OperationDefinitionNode, type SelectionSetNode } from 'graphql';
|
|
13
17
|
import type { BackendPrincipal } from '../auth/token-verifier';
|
|
14
18
|
/** Represents the user object decoded from JWT context */
|
|
15
19
|
interface AuditUser {
|
|
@@ -37,27 +41,39 @@ interface MutationAuditData {
|
|
|
37
41
|
operationName: string;
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
41
|
-
* TypeGraphQL-Prisma generates
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
44
|
+
* Resolves a mutation field onto the model it writes and the audit operation
|
|
45
|
+
* type. TypeGraphQL-Prisma generates, per model, `createOne`, `createMany`,
|
|
46
|
+
* `createManyAndReturn`, `updateOne`, `updateMany`, `upsertOne`, `deleteOne`
|
|
47
|
+
* and `deleteMany` followed by the model name.
|
|
48
|
+
*
|
|
49
|
+
* The field is read with the classifier the mutation-authorization guard uses
|
|
50
|
+
* (`classifyMutationField`): prefixes are matched longest first and the
|
|
51
|
+
* remainder must be a Prisma model, so the audit row names the model the
|
|
52
|
+
* guard authorised. A leading-prefix match alone reads
|
|
53
|
+
* `createManyAndReturnSession` as `createMany` of a model `AndReturnSession`,
|
|
54
|
+
* which mislabels the row and lets the write of an excluded model (whose
|
|
55
|
+
* payload carries its tokens) into the audit trail.
|
|
45
56
|
*
|
|
46
57
|
* @param operationName - The name of the GraphQL field being executed
|
|
47
|
-
* @
|
|
58
|
+
* @param models - Every Prisma model name; defaults to the generated client's
|
|
59
|
+
* @returns Parsed mutation data, or null for a field that is not a generated
|
|
60
|
+
* write of a model
|
|
48
61
|
*/
|
|
49
|
-
declare function parseMutationOperation(operationName: string): MutationAuditData | null;
|
|
62
|
+
declare function parseMutationOperation(operationName: string, models?: ReadonlySet<string>): MutationAuditData | null;
|
|
50
63
|
declare function extractUserId(user: AuditUser | string | null | undefined): string | null;
|
|
51
64
|
/**
|
|
52
65
|
* Extracts the record ID from the mutation result data.
|
|
53
66
|
* Looks for 'id' field in the top-level result object.
|
|
54
67
|
*
|
|
55
68
|
* @param data - The result data from the mutation
|
|
69
|
+
* @param responseKey - The audited field's response key (its alias, else its
|
|
70
|
+
* name). An operation with several mutation fields returns one result per
|
|
71
|
+
* key; without a key the first result is read.
|
|
56
72
|
* @returns The record ID as a string, or 'unknown'
|
|
57
73
|
*/
|
|
58
|
-
declare function extractRecordId(data: Record<string, unknown> | null | undefined): string;
|
|
74
|
+
declare function extractRecordId(data: Record<string, unknown> | null | undefined, responseKey?: string): string;
|
|
59
75
|
/**
|
|
60
|
-
* Extracts changed fields from the
|
|
76
|
+
* Extracts changed fields from the audited field's arguments.
|
|
61
77
|
* For create operations, captures all input data.
|
|
62
78
|
* For update operations, captures the data being set.
|
|
63
79
|
* For delete operations, captures the where clause.
|
|
@@ -65,13 +81,60 @@ declare function extractRecordId(data: Record<string, unknown> | null | undefine
|
|
|
65
81
|
* Stored-credential values (broker keys, OAuth / session / invite tokens) are
|
|
66
82
|
* replaced with a placeholder: an audit row is readable far more widely than
|
|
67
83
|
* the credential column, so a key copied into one is an unguarded second copy
|
|
68
|
-
* of the secret.
|
|
84
|
+
* of the secret. The replacement is directed by key name, so it holds only
|
|
85
|
+
* because every value here sits under its schema path (see
|
|
86
|
+
* {@link resolveFieldArguments}).
|
|
69
87
|
*
|
|
70
88
|
* @param operationType - The type of mutation operation
|
|
71
|
-
* @param
|
|
89
|
+
* @param args - The audited field's arguments, by schema argument name
|
|
72
90
|
* @returns A JSON-serializable object representing the changed fields
|
|
73
91
|
*/
|
|
74
|
-
declare function extractChangedFields(operationType: 'CREATE' | 'UPDATE' | 'DELETE',
|
|
92
|
+
declare function extractChangedFields(operationType: 'CREATE' | 'UPDATE' | 'DELETE', args: Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* The operation's variable values as execution sees them: the request's
|
|
95
|
+
* values, plus the operation's declared default for each variable the request
|
|
96
|
+
* omitted. Held in a prototype-free map so a variable reference can only ever
|
|
97
|
+
* read a value the request or the operation supplied.
|
|
98
|
+
*
|
|
99
|
+
* @param operation - The executed operation
|
|
100
|
+
* @param variables - The request's variable values
|
|
101
|
+
* @returns The effective variable values
|
|
102
|
+
*/
|
|
103
|
+
declare function operationVariables(operation: OperationDefinitionNode, variables: Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
104
|
+
/**
|
|
105
|
+
* The value of each argument the field passes, under the argument's schema
|
|
106
|
+
* name, with every variable reference replaced by its value.
|
|
107
|
+
*
|
|
108
|
+
* This is what the audit row records, rather than the request's variables
|
|
109
|
+
* map: a variable is named by the calling operation, not by the schema, so a
|
|
110
|
+
* credential passed as `$key` into `data: { apiKey: $key }` would be stored
|
|
111
|
+
* under `key`, where no key-directed redaction can recognise it. Resolved
|
|
112
|
+
* against the field, the same value sits at `data.apiKey`, the column's own
|
|
113
|
+
* name, whatever the operation called its variables. It also records
|
|
114
|
+
* arguments written inline, which a variables map does not carry at all.
|
|
115
|
+
*
|
|
116
|
+
* @param field - The audited root field
|
|
117
|
+
* @param variables - The effective variable values ({@link operationVariables})
|
|
118
|
+
* @returns The field's arguments, by schema argument name
|
|
119
|
+
*/
|
|
120
|
+
declare function resolveFieldArguments(field: FieldNode, variables: Record<string, unknown>): Record<string, unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* The root fields an operation executes, by response key (alias, else name),
|
|
123
|
+
* in execution order, following the rules graphql-js applies when it collects
|
|
124
|
+
* them: inline fragments and fragment spreads are entered, `@skip` /
|
|
125
|
+
* `@include` are honoured, each fragment is entered once, and a response key
|
|
126
|
+
* keeps its first field node, which is the one graphql-js reads arguments
|
|
127
|
+
* from. Fragment type conditions are not checked: at the root of a validated
|
|
128
|
+
* operation every fragment is on the root type.
|
|
129
|
+
*
|
|
130
|
+
* @param selectionSet - The operation's (or a root fragment's) selection set
|
|
131
|
+
* @param fragments - The document's fragment definitions, by name
|
|
132
|
+
* @param variables - The effective variable values
|
|
133
|
+
* @param fields - Accumulator for the recursion
|
|
134
|
+
* @param visitedFragments - Fragments already entered
|
|
135
|
+
* @returns Each executed root field node, by response key
|
|
136
|
+
*/
|
|
137
|
+
declare function collectRootFields(selectionSet: SelectionSetNode, fragments: ReadonlyMap<string, FragmentDefinitionNode>, variables: Record<string, unknown>, fields?: Map<string, FieldNode>, visitedFragments?: Set<string>): Map<string, FieldNode>;
|
|
75
138
|
/**
|
|
76
139
|
* The acting principal as recorded on an audit row. `userId` holds only a
|
|
77
140
|
* UUID subject, so a service or anonymous write needs its identity here or
|
|
@@ -91,5 +154,5 @@ declare function principalMetadata(principal: BackendPrincipal | null | undefine
|
|
|
91
154
|
* @returns An Apollo Server plugin instance
|
|
92
155
|
*/
|
|
93
156
|
export declare function createAuditLogPlugin(): ApolloServerPlugin<AuditContext>;
|
|
94
|
-
export { parseMutationOperation, extractUserId, extractRecordId, extractChangedFields, principalMetadata, };
|
|
157
|
+
export { parseMutationOperation, extractUserId, extractRecordId, extractChangedFields, operationVariables, resolveFieldArguments, collectRootFields, principalMetadata, };
|
|
95
158
|
//# sourceMappingURL=audit-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-logger.d.ts","sourceRoot":"","sources":["../../../src/middleware/audit-logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit-logger.d.ts","sourceRoot":"","sources":["../../../src/middleware/audit-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,0DAA0D;AAC1D,UAAU,SAAS;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wDAAwD;AACxD,UAAU,YAAY;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,GAAG,CAAC,EAAE;QACJ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;KACzD,CAAC;CAC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;AACH,iBAAS,iBAAiB,CACxB,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACtD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,GAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAa,EAC1C,gBAAgB,GAAE,GAAG,CAAC,MAAM,CAAa,GACxC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAkBxB;AAaD;;;;GAIG;AACH,iBAAS,iBAAiB,CACxB,SAAS,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC7C;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,kBAAkB,CAAC,YAAY,CAAC,CAkHvE;AAED,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-logger.js","sourceRoot":"","sources":["../../../src/middleware/audit-logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit-logger.js","sourceRoot":"","sources":["../../../src/middleware/audit-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAAE,MAAM,EAAqB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACL,mBAAmB,GAOpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAuB,MAAM,gCAAgC,CAAC;AAE5F,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA8BzC,uFAAuF;AACvF,MAAM,eAAe,GAAG,I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