@blamejs/core 0.14.26 → 0.15.0
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 +6 -0
- package/README.md +2 -2
- package/index.js +4 -0
- package/lib/agent-envelope-mac.js +104 -0
- package/lib/agent-event-bus.js +105 -4
- package/lib/agent-posture-chain.js +8 -42
- package/lib/ai-content-detect.js +9 -10
- package/lib/api-key.js +107 -74
- package/lib/atomic-file.js +62 -4
- package/lib/audit-chain.js +47 -11
- package/lib/audit-sign.js +77 -2
- package/lib/audit-tools.js +79 -51
- package/lib/audit.js +249 -123
- package/lib/auth/openid-federation.js +108 -47
- package/lib/backup/index.js +13 -10
- package/lib/break-glass.js +202 -144
- package/lib/cache.js +174 -105
- package/lib/chain-writer.js +38 -16
- package/lib/cli.js +19 -14
- package/lib/cluster-provider-db.js +130 -104
- package/lib/cluster-storage.js +119 -22
- package/lib/cluster.js +119 -71
- package/lib/compliance.js +169 -4
- package/lib/consent.js +73 -24
- package/lib/constants.js +16 -11
- package/lib/crypto-field.js +474 -92
- package/lib/db-declare-row-policy.js +35 -22
- package/lib/db-file-lifecycle.js +3 -2
- package/lib/db-query.js +497 -255
- package/lib/db-schema.js +209 -44
- package/lib/db.js +176 -95
- package/lib/error-page.js +14 -1
- package/lib/external-db-migrate.js +229 -139
- package/lib/external-db.js +25 -15
- package/lib/file-upload.js +52 -7
- package/lib/framework-error.js +14 -1
- package/lib/framework-files.js +73 -0
- package/lib/framework-schema.js +695 -394
- package/lib/gate-contract.js +649 -1
- package/lib/guard-agent-registry.js +26 -44
- package/lib/guard-all.js +1 -0
- package/lib/guard-auth.js +42 -112
- package/lib/guard-cidr.js +33 -154
- package/lib/guard-csv.js +46 -113
- package/lib/guard-domain.js +34 -157
- package/lib/guard-dsn.js +27 -43
- package/lib/guard-email.js +47 -69
- package/lib/guard-envelope.js +19 -32
- package/lib/guard-event-bus-payload.js +24 -42
- package/lib/guard-event-bus-topic.js +25 -43
- package/lib/guard-filename.js +42 -106
- package/lib/guard-graphql.js +42 -123
- package/lib/guard-html.js +53 -108
- package/lib/guard-idempotency-key.js +24 -42
- package/lib/guard-image.js +46 -103
- package/lib/guard-imap-command.js +18 -32
- package/lib/guard-jmap.js +16 -30
- package/lib/guard-json.js +38 -108
- package/lib/guard-jsonpath.js +38 -171
- package/lib/guard-jwt.js +49 -179
- package/lib/guard-list-id.js +25 -41
- package/lib/guard-list-unsubscribe.js +27 -43
- package/lib/guard-mail-compose.js +24 -42
- package/lib/guard-mail-move.js +26 -44
- package/lib/guard-mail-query.js +28 -46
- package/lib/guard-mail-reply.js +24 -42
- package/lib/guard-mail-sieve.js +24 -42
- package/lib/guard-managesieve-command.js +17 -31
- package/lib/guard-markdown.js +37 -104
- package/lib/guard-message-id.js +26 -45
- package/lib/guard-mime.js +39 -151
- package/lib/guard-oauth.js +54 -135
- package/lib/guard-pdf.js +45 -101
- package/lib/guard-pop3-command.js +21 -31
- package/lib/guard-posture-chain.js +24 -42
- package/lib/guard-regex.js +33 -107
- package/lib/guard-saga-config.js +24 -42
- package/lib/guard-shell.js +42 -172
- package/lib/guard-smtp-command.js +48 -54
- package/lib/guard-snapshot-envelope.js +24 -42
- package/lib/guard-sql.js +1491 -0
- package/lib/guard-stream-args.js +24 -43
- package/lib/guard-svg.js +47 -65
- package/lib/guard-template.js +35 -172
- package/lib/guard-tenant-id.js +26 -45
- package/lib/guard-time.js +32 -154
- package/lib/guard-trace-context.js +25 -44
- package/lib/guard-uuid.js +32 -153
- package/lib/guard-xml.js +38 -113
- package/lib/guard-yaml.js +51 -163
- package/lib/http-client.js +37 -9
- package/lib/inbox.js +120 -107
- package/lib/legal-hold.js +107 -50
- package/lib/log-stream-cloudwatch.js +47 -31
- package/lib/log-stream-otlp.js +32 -18
- package/lib/mail-crypto-smime.js +2 -6
- package/lib/mail-greylist.js +2 -6
- package/lib/mail-helo.js +2 -6
- package/lib/mail-journal.js +85 -64
- package/lib/mail-rbl.js +2 -6
- package/lib/mail-scan.js +2 -6
- package/lib/mail-server-jmap.js +117 -12
- package/lib/mail-spam-score.js +2 -6
- package/lib/mail-store.js +287 -154
- package/lib/middleware/body-parser.js +71 -25
- package/lib/middleware/csrf-protect.js +19 -8
- package/lib/middleware/fetch-metadata.js +17 -7
- package/lib/middleware/idempotency-key.js +54 -38
- package/lib/middleware/rate-limit.js +102 -32
- package/lib/middleware/security-headers.js +21 -5
- package/lib/migrations.js +108 -66
- package/lib/network-heartbeat.js +7 -0
- package/lib/nonce-store.js +31 -9
- package/lib/object-store/azure-blob-bucket-ops.js +9 -4
- package/lib/object-store/azure-blob.js +57 -3
- package/lib/object-store/sigv4.js +10 -0
- package/lib/observability.js +87 -0
- package/lib/otel-export.js +25 -1
- package/lib/outbox.js +136 -82
- package/lib/parsers/safe-xml.js +47 -7
- package/lib/pqc-agent.js +44 -0
- package/lib/pubsub-cluster.js +42 -20
- package/lib/queue-local.js +202 -139
- package/lib/queue-redis.js +9 -1
- package/lib/queue-sqs.js +6 -0
- package/lib/redact.js +68 -11
- package/lib/redis-client.js +160 -31
- package/lib/retention.js +82 -39
- package/lib/router.js +212 -5
- package/lib/safe-dns.js +29 -45
- package/lib/safe-ical.js +18 -33
- package/lib/safe-icap.js +27 -43
- package/lib/safe-sieve.js +21 -40
- package/lib/safe-sql.js +124 -3
- package/lib/safe-vcard.js +18 -33
- package/lib/scheduler.js +35 -12
- package/lib/seeders.js +122 -74
- package/lib/session-stores.js +42 -14
- package/lib/session.js +109 -72
- package/lib/sql.js +3885 -0
- package/lib/ssrf-guard.js +51 -4
- package/lib/static.js +177 -34
- package/lib/subject.js +55 -17
- package/lib/vault/index.js +3 -2
- package/lib/vault/passphrase-ops.js +3 -2
- package/lib/vault/rotate.js +104 -64
- package/lib/vendor-data.js +2 -0
- package/lib/websocket.js +35 -5
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
var { defineClass } = require("./framework-error");
|
|
39
|
+
var gateContract = require("./gate-contract");
|
|
39
40
|
|
|
40
41
|
var GuardMailComposeError = defineClass("GuardMailComposeError", { alwaysPermanent: true });
|
|
41
42
|
|
|
@@ -47,11 +48,14 @@ var PROFILES = Object.freeze({
|
|
|
47
48
|
permissive: { maxRecipients: 2000, maxAttachmentBytes: 104857600, maxSubjectBytes: 998 }, // 100 MiB
|
|
48
49
|
});
|
|
49
50
|
|
|
50
|
-
var COMPLIANCE_POSTURES =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
52
|
+
|
|
53
|
+
var _resolveProfile = gateContract.makeProfileResolver({
|
|
54
|
+
profiles: PROFILES,
|
|
55
|
+
postures: COMPLIANCE_POSTURES,
|
|
56
|
+
defaults: DEFAULT_PROFILE,
|
|
57
|
+
errorClass: GuardMailComposeError,
|
|
58
|
+
codePrefix: "mail-compose",
|
|
55
59
|
});
|
|
56
60
|
|
|
57
61
|
/**
|
|
@@ -131,22 +135,10 @@ function validate(draft, opts) {
|
|
|
131
135
|
return draft;
|
|
132
136
|
}
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
* @status stable
|
|
139
|
-
*
|
|
140
|
-
* Return the effective profile for a given compliance posture name.
|
|
141
|
-
* Returns `null` for unknown posture names so operator typos surface
|
|
142
|
-
* here instead of silently falling through to the default profile.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* b.guardMailCompose.compliancePosture("hipaa"); // → "strict"
|
|
146
|
-
*/
|
|
147
|
-
function compliancePosture(posture) {
|
|
148
|
-
return COMPLIANCE_POSTURES[posture] || null;
|
|
149
|
-
}
|
|
138
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
139
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
140
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
141
|
+
// generator.
|
|
150
142
|
|
|
151
143
|
function _checkAddrList(list, label, profile) {
|
|
152
144
|
if (typeof list === "undefined" || list === null) return;
|
|
@@ -259,24 +251,14 @@ function _anyRecipient(draft) {
|
|
|
259
251
|
});
|
|
260
252
|
}
|
|
261
253
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
module.exports = {
|
|
275
|
-
validate: validate,
|
|
276
|
-
compliancePosture: compliancePosture,
|
|
277
|
-
PROFILES: PROFILES,
|
|
278
|
-
COMPLIANCE_POSTURES: COMPLIANCE_POSTURES,
|
|
279
|
-
GuardMailComposeError: GuardMailComposeError,
|
|
280
|
-
NAME: "mailCompose",
|
|
281
|
-
KIND: "mail-compose",
|
|
282
|
-
};
|
|
254
|
+
module.exports = gateContract.defineParser({
|
|
255
|
+
name: "mailCompose",
|
|
256
|
+
entry: validate,
|
|
257
|
+
errorClass: GuardMailComposeError,
|
|
258
|
+
profiles: PROFILES,
|
|
259
|
+
postures: COMPLIANCE_POSTURES,
|
|
260
|
+
extra: {
|
|
261
|
+
NAME: "mailCompose",
|
|
262
|
+
KIND: "mail-compose",
|
|
263
|
+
},
|
|
264
|
+
});
|
package/lib/guard-mail-move.js
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
var { defineClass } = require("./framework-error");
|
|
37
|
+
var gateContract = require("./gate-contract");
|
|
37
38
|
|
|
38
39
|
var GuardMailMoveError = defineClass("GuardMailMoveError", { alwaysPermanent: true });
|
|
39
40
|
|
|
@@ -45,18 +46,21 @@ var PROFILES = Object.freeze({
|
|
|
45
46
|
permissive: { maxObjectIds: 50000, maxFolderNameBytes: 1024 },
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
var COMPLIANCE_POSTURES =
|
|
49
|
-
hipaa: "strict",
|
|
50
|
-
"pci-dss": "strict",
|
|
51
|
-
gdpr: "strict",
|
|
52
|
-
soc2: "strict",
|
|
53
|
-
});
|
|
49
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
54
50
|
|
|
55
51
|
// System folders every actor may write to without admin scope.
|
|
56
52
|
var SYSTEM_FOLDERS = Object.freeze({
|
|
57
53
|
INBOX: true, Sent: true, Drafts: true, Trash: true, Junk: true, Archive: true,
|
|
58
54
|
});
|
|
59
55
|
|
|
56
|
+
var _resolveProfile = gateContract.makeProfileResolver({
|
|
57
|
+
profiles: PROFILES,
|
|
58
|
+
postures: COMPLIANCE_POSTURES,
|
|
59
|
+
defaults: DEFAULT_PROFILE,
|
|
60
|
+
errorClass: GuardMailMoveError,
|
|
61
|
+
codePrefix: "mail-move",
|
|
62
|
+
});
|
|
63
|
+
|
|
60
64
|
/**
|
|
61
65
|
* @primitive b.guardMailMove.validate
|
|
62
66
|
* @signature b.guardMailMove.validate(move, opts?)
|
|
@@ -128,22 +132,10 @@ function validate(move, opts) {
|
|
|
128
132
|
"' requires mailScope:'admin' or membership in actor.allowedFolders");
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
* @status stable
|
|
136
|
-
*
|
|
137
|
-
* Return the effective profile for a given compliance posture name.
|
|
138
|
-
* Returns `null` for unknown posture names so operator typos surface
|
|
139
|
-
* here instead of silently falling through to the default profile.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* b.guardMailMove.compliancePosture("hipaa"); // → "strict"
|
|
143
|
-
*/
|
|
144
|
-
function compliancePosture(posture) {
|
|
145
|
-
return COMPLIANCE_POSTURES[posture] || null;
|
|
146
|
-
}
|
|
135
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
136
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
137
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
138
|
+
// generator.
|
|
147
139
|
|
|
148
140
|
function _checkFolderName(name, label, profile) {
|
|
149
141
|
if (typeof name !== "string" || name.length === 0) {
|
|
@@ -178,25 +170,15 @@ function _checkFolderName(name, label, profile) {
|
|
|
178
170
|
}
|
|
179
171
|
}
|
|
180
172
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
module.exports = {
|
|
194
|
-
validate: validate,
|
|
195
|
-
compliancePosture: compliancePosture,
|
|
196
|
-
PROFILES: PROFILES,
|
|
197
|
-
COMPLIANCE_POSTURES: COMPLIANCE_POSTURES,
|
|
198
|
-
SYSTEM_FOLDERS: SYSTEM_FOLDERS,
|
|
199
|
-
GuardMailMoveError: GuardMailMoveError,
|
|
200
|
-
NAME: "mailMove",
|
|
201
|
-
KIND: "mail-move",
|
|
202
|
-
};
|
|
173
|
+
module.exports = gateContract.defineParser({
|
|
174
|
+
name: "mailMove",
|
|
175
|
+
entry: validate,
|
|
176
|
+
errorClass: GuardMailMoveError,
|
|
177
|
+
profiles: PROFILES,
|
|
178
|
+
postures: COMPLIANCE_POSTURES,
|
|
179
|
+
extra: {
|
|
180
|
+
SYSTEM_FOLDERS: SYSTEM_FOLDERS,
|
|
181
|
+
NAME: "mailMove",
|
|
182
|
+
KIND: "mail-move",
|
|
183
|
+
},
|
|
184
|
+
});
|
package/lib/guard-mail-query.js
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
var { defineClass } = require("./framework-error");
|
|
30
|
+
var gateContract = require("./gate-contract");
|
|
30
31
|
|
|
31
32
|
var GuardMailQueryError = defineClass("GuardMailQueryError", { alwaysPermanent: true });
|
|
32
33
|
|
|
@@ -38,12 +39,7 @@ var PROFILES = Object.freeze({
|
|
|
38
39
|
permissive: { maxDepth: 24, maxKeys: 512, maxStringBytes: 65536, maxArrayLen: 4096 },
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
var COMPLIANCE_POSTURES =
|
|
42
|
-
hipaa: "strict",
|
|
43
|
-
"pci-dss": "strict",
|
|
44
|
-
gdpr: "strict",
|
|
45
|
-
soc2: "strict",
|
|
46
|
-
});
|
|
42
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
47
43
|
|
|
48
44
|
// Columns the filter may reference and the projection may request.
|
|
49
45
|
// Sealed columns can be `=` / `IN` matched (the mail-store walks
|
|
@@ -92,6 +88,14 @@ var POSTURE_ACTOR_FIELDS = Object.freeze({
|
|
|
92
88
|
soc2: [],
|
|
93
89
|
});
|
|
94
90
|
|
|
91
|
+
var _resolveProfile = gateContract.makeProfileResolver({
|
|
92
|
+
profiles: PROFILES,
|
|
93
|
+
postures: COMPLIANCE_POSTURES,
|
|
94
|
+
defaults: DEFAULT_PROFILE,
|
|
95
|
+
errorClass: GuardMailQueryError,
|
|
96
|
+
codePrefix: "mail-query",
|
|
97
|
+
});
|
|
98
|
+
|
|
95
99
|
/**
|
|
96
100
|
* @primitive b.guardMailQuery.validate
|
|
97
101
|
* @signature b.guardMailQuery.validate(filter, opts?)
|
|
@@ -174,22 +178,10 @@ function validateActor(actor, posture) {
|
|
|
174
178
|
return actor;
|
|
175
179
|
}
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
* @status stable
|
|
182
|
-
*
|
|
183
|
-
* Return the effective profile for a given compliance posture name.
|
|
184
|
-
* Returns `null` when the posture is unknown (operator-supplied typos
|
|
185
|
-
* surface here instead of silently falling back to the default).
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* b.guardMailQuery.compliancePosture("hipaa"); // → "strict"
|
|
189
|
-
*/
|
|
190
|
-
function compliancePosture(posture) {
|
|
191
|
-
return COMPLIANCE_POSTURES[posture] || null;
|
|
192
|
-
}
|
|
181
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
182
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
183
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
184
|
+
// generator.
|
|
193
185
|
|
|
194
186
|
function _walk(node, depth, profile, visited) {
|
|
195
187
|
if (depth > profile.maxDepth) {
|
|
@@ -284,27 +276,17 @@ function _checkScalar(v, profile) {
|
|
|
284
276
|
}
|
|
285
277
|
}
|
|
286
278
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
validateActor: validateActor,
|
|
302
|
-
compliancePosture: compliancePosture,
|
|
303
|
-
PROFILES: PROFILES,
|
|
304
|
-
COMPLIANCE_POSTURES: COMPLIANCE_POSTURES,
|
|
305
|
-
FILTERABLE_COLUMNS: FILTERABLE_COLUMNS,
|
|
306
|
-
POSTURE_ACTOR_FIELDS: POSTURE_ACTOR_FIELDS,
|
|
307
|
-
GuardMailQueryError: GuardMailQueryError,
|
|
308
|
-
NAME: "mailQuery",
|
|
309
|
-
KIND: "mail-query",
|
|
310
|
-
};
|
|
279
|
+
module.exports = gateContract.defineParser({
|
|
280
|
+
name: "mailQuery",
|
|
281
|
+
entry: validate,
|
|
282
|
+
errorClass: GuardMailQueryError,
|
|
283
|
+
profiles: PROFILES,
|
|
284
|
+
postures: COMPLIANCE_POSTURES,
|
|
285
|
+
extra: {
|
|
286
|
+
validateActor: validateActor,
|
|
287
|
+
FILTERABLE_COLUMNS: FILTERABLE_COLUMNS,
|
|
288
|
+
POSTURE_ACTOR_FIELDS: POSTURE_ACTOR_FIELDS,
|
|
289
|
+
NAME: "mailQuery",
|
|
290
|
+
KIND: "mail-query",
|
|
291
|
+
},
|
|
292
|
+
});
|
package/lib/guard-mail-reply.js
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
var { defineClass } = require("./framework-error");
|
|
32
32
|
var guardMessageId = require("./guard-message-id");
|
|
33
|
+
var gateContract = require("./gate-contract");
|
|
33
34
|
|
|
34
35
|
var GuardMailReplyError = defineClass("GuardMailReplyError", { alwaysPermanent: true });
|
|
35
36
|
|
|
@@ -41,11 +42,14 @@ var PROFILES = Object.freeze({
|
|
|
41
42
|
permissive: { maxChainLength: 2000, maxQuotedBytes: 10485760, maxForwardedAttachments: 512 }, // chain count + 10 MiB
|
|
42
43
|
});
|
|
43
44
|
|
|
44
|
-
var COMPLIANCE_POSTURES =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
46
|
+
|
|
47
|
+
var _resolveProfile = gateContract.makeProfileResolver({
|
|
48
|
+
profiles: PROFILES,
|
|
49
|
+
postures: COMPLIANCE_POSTURES,
|
|
50
|
+
defaults: DEFAULT_PROFILE,
|
|
51
|
+
errorClass: GuardMailReplyError,
|
|
52
|
+
codePrefix: "mail-reply",
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
/**
|
|
@@ -132,41 +136,19 @@ function validate(reply, opts) {
|
|
|
132
136
|
return reply;
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @status stable
|
|
140
|
-
*
|
|
141
|
-
* Return the effective profile for a given compliance posture name.
|
|
142
|
-
* Returns `null` for unknown posture names so operator typos surface
|
|
143
|
-
* here instead of silently falling through to the default profile.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* b.guardMailReply.compliancePosture("hipaa"); // → "strict"
|
|
147
|
-
*/
|
|
148
|
-
function compliancePosture(posture) {
|
|
149
|
-
return COMPLIANCE_POSTURES[posture] || null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function _resolveProfile(opts) {
|
|
153
|
-
if (opts.posture && COMPLIANCE_POSTURES[opts.posture]) {
|
|
154
|
-
return COMPLIANCE_POSTURES[opts.posture];
|
|
155
|
-
}
|
|
156
|
-
var p = opts.profile || DEFAULT_PROFILE;
|
|
157
|
-
if (!PROFILES[p]) {
|
|
158
|
-
throw new GuardMailReplyError("mail-reply/bad-profile",
|
|
159
|
-
"guardMailReply: unknown profile '" + p + "'");
|
|
160
|
-
}
|
|
161
|
-
return p;
|
|
162
|
-
}
|
|
139
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
140
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
141
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
142
|
+
// generator.
|
|
163
143
|
|
|
164
|
-
module.exports = {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
144
|
+
module.exports = gateContract.defineParser({
|
|
145
|
+
name: "mail-reply",
|
|
146
|
+
entry: validate,
|
|
147
|
+
errorClass: GuardMailReplyError,
|
|
148
|
+
profiles: PROFILES,
|
|
149
|
+
postures: COMPLIANCE_POSTURES,
|
|
150
|
+
extra: {
|
|
151
|
+
NAME: "mailReply",
|
|
152
|
+
KIND: "mail-reply",
|
|
153
|
+
},
|
|
154
|
+
});
|
package/lib/guard-mail-sieve.js
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
var { defineClass } = require("./framework-error");
|
|
36
|
+
var gateContract = require("./gate-contract");
|
|
36
37
|
|
|
37
38
|
var GuardMailSieveError = defineClass("GuardMailSieveError", { alwaysPermanent: true });
|
|
38
39
|
|
|
@@ -44,11 +45,14 @@ var PROFILES = Object.freeze({
|
|
|
44
45
|
permissive: { maxScriptBytes: 1048576, maxNameBytes: 1024, maxLines: 50000 },
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
var COMPLIANCE_POSTURES =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
49
|
+
|
|
50
|
+
var _resolveProfile = gateContract.makeProfileResolver({
|
|
51
|
+
profiles: PROFILES,
|
|
52
|
+
postures: COMPLIANCE_POSTURES,
|
|
53
|
+
defaults: DEFAULT_PROFILE,
|
|
54
|
+
errorClass: GuardMailSieveError,
|
|
55
|
+
codePrefix: "mail-sieve",
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
/**
|
|
@@ -145,22 +149,10 @@ function validate(op, opts) {
|
|
|
145
149
|
return op;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* @status stable
|
|
153
|
-
*
|
|
154
|
-
* Return the effective profile for a given compliance posture name.
|
|
155
|
-
* Returns `null` for unknown posture names so operator typos surface
|
|
156
|
-
* here instead of silently falling through to the default profile.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* b.guardMailSieve.compliancePosture("hipaa"); // → "strict"
|
|
160
|
-
*/
|
|
161
|
-
function compliancePosture(posture) {
|
|
162
|
-
return COMPLIANCE_POSTURES[posture] || null;
|
|
163
|
-
}
|
|
152
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
153
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
154
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
155
|
+
// generator.
|
|
164
156
|
|
|
165
157
|
function _checkName(name, profile) {
|
|
166
158
|
if (typeof name !== "string" || name.length === 0) {
|
|
@@ -184,24 +176,14 @@ function _checkName(name, profile) {
|
|
|
184
176
|
}
|
|
185
177
|
}
|
|
186
178
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
module.exports = {
|
|
200
|
-
validate: validate,
|
|
201
|
-
compliancePosture: compliancePosture,
|
|
202
|
-
PROFILES: PROFILES,
|
|
203
|
-
COMPLIANCE_POSTURES: COMPLIANCE_POSTURES,
|
|
204
|
-
GuardMailSieveError: GuardMailSieveError,
|
|
205
|
-
NAME: "mailSieve",
|
|
206
|
-
KIND: "mail-sieve",
|
|
207
|
-
};
|
|
179
|
+
module.exports = gateContract.defineParser({
|
|
180
|
+
name: "mail-sieve",
|
|
181
|
+
entry: validate,
|
|
182
|
+
errorClass: GuardMailSieveError,
|
|
183
|
+
profiles: PROFILES,
|
|
184
|
+
postures: COMPLIANCE_POSTURES,
|
|
185
|
+
extra: {
|
|
186
|
+
NAME: "mailSieve",
|
|
187
|
+
KIND: "mail-sieve",
|
|
188
|
+
},
|
|
189
|
+
});
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
103
|
var { defineClass } = require("./framework-error");
|
|
104
|
+
var gateContract = require("./gate-contract");
|
|
104
105
|
|
|
105
106
|
var GuardManageSieveCommandError = defineClass("GuardManageSieveCommandError",
|
|
106
107
|
{ alwaysPermanent: true });
|
|
@@ -134,12 +135,7 @@ var PROFILES = Object.freeze({
|
|
|
134
135
|
},
|
|
135
136
|
});
|
|
136
137
|
|
|
137
|
-
var COMPLIANCE_POSTURES =
|
|
138
|
-
hipaa: "strict",
|
|
139
|
-
"pci-dss": "strict",
|
|
140
|
-
gdpr: "strict",
|
|
141
|
-
soc2: "strict",
|
|
142
|
-
});
|
|
138
|
+
var COMPLIANCE_POSTURES = gateContract.ALL_STRICT_POSTURES;
|
|
143
139
|
|
|
144
140
|
// ManageSieve verbs per RFC 5804 §2.
|
|
145
141
|
var KNOWN_VERBS = Object.freeze({
|
|
@@ -539,28 +535,18 @@ function _checkScriptNameBytes(name, caps) {
|
|
|
539
535
|
}
|
|
540
536
|
}
|
|
541
537
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
module.exports = {
|
|
559
|
-
validate: validate,
|
|
560
|
-
compliancePosture: compliancePosture,
|
|
561
|
-
PROFILES: PROFILES,
|
|
562
|
-
COMPLIANCE_POSTURES: COMPLIANCE_POSTURES,
|
|
563
|
-
KNOWN_VERBS: KNOWN_VERBS,
|
|
564
|
-
ZERO_ARG_VERBS: ZERO_ARG_VERBS,
|
|
565
|
-
GuardManageSieveCommandError: GuardManageSieveCommandError,
|
|
566
|
-
};
|
|
538
|
+
// compliancePosture is assembled by gateContract.defineParser below; its
|
|
539
|
+
// wiki section renders from the single-sourced @abiTemplate (defineParser)
|
|
540
|
+
// block in gate-contract.js, instantiated for this guard by the page
|
|
541
|
+
// generator.
|
|
542
|
+
module.exports = gateContract.defineParser({
|
|
543
|
+
name: "managesieve-command",
|
|
544
|
+
entry: validate,
|
|
545
|
+
errorClass: GuardManageSieveCommandError,
|
|
546
|
+
profiles: PROFILES,
|
|
547
|
+
postures: COMPLIANCE_POSTURES,
|
|
548
|
+
extra: {
|
|
549
|
+
KNOWN_VERBS: KNOWN_VERBS,
|
|
550
|
+
ZERO_ARG_VERBS: ZERO_ARG_VERBS,
|
|
551
|
+
},
|
|
552
|
+
});
|