@blamejs/core 0.14.1 → 0.14.2
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 +2 -0
- package/lib/_test/crypto-fixtures.js +3 -3
- package/lib/a2a-tasks.js +18 -18
- package/lib/a2a.js +4 -4
- package/lib/acme.js +3 -3
- package/lib/agent-idempotency.js +1 -1
- package/lib/agent-orchestrator.js +8 -8
- package/lib/agent-posture-chain.js +2 -2
- package/lib/agent-saga.js +1 -1
- package/lib/agent-snapshot.js +1 -1
- package/lib/agent-stream.js +1 -1
- package/lib/agent-tenant.js +1 -1
- package/lib/agent-trace.js +3 -3
- package/lib/ai-capability.js +1 -1
- package/lib/ai-dp.js +4 -4
- package/lib/ai-input.js +3 -3
- package/lib/ai-model-manifest.js +7 -7
- package/lib/ai-pref.js +3 -3
- package/lib/archive-gz.js +2 -2
- package/lib/archive-read.js +25 -25
- package/lib/archive-tar-read.js +2 -2
- package/lib/archive-tar.js +20 -20
- package/lib/archive-wrap.js +10 -10
- package/lib/argon2-builtin.js +1 -1
- package/lib/asn1-der.js +34 -34
- package/lib/atomic-file.js +2 -2
- package/lib/audit-daily-review.js +3 -3
- package/lib/audit-sign.js +5 -5
- package/lib/audit-tools.js +1 -1
- package/lib/audit.js +2 -2
- package/lib/auth/acr-vocabulary.js +2 -2
- package/lib/auth/bot-challenge.js +3 -3
- package/lib/auth/ciba.js +7 -7
- package/lib/auth/dpop.js +3 -3
- package/lib/auth/fido-mds3.js +8 -8
- package/lib/auth/jwt-external.js +5 -5
- package/lib/auth/oauth.js +2 -2
- package/lib/auth/oid4vci.js +9 -9
- package/lib/auth/oid4vp.js +2 -2
- package/lib/auth/openid-federation.js +2 -2
- package/lib/auth/passkey.js +3 -3
- package/lib/auth/saml.js +23 -23
- package/lib/auth/sd-jwt-vc-disclosure.js +1 -1
- package/lib/auth/sd-jwt-vc.js +4 -4
- package/lib/auth/status-list.js +10 -10
- package/lib/auth/step-up.js +1 -1
- package/lib/auth-bot-challenge.js +1 -1
- package/lib/backup/index.js +7 -7
- package/lib/base32.js +8 -8
- package/lib/budr.js +2 -2
- package/lib/cache-status.js +2 -2
- package/lib/calendar.js +23 -23
- package/lib/cbor.js +12 -12
- package/lib/cdn-cache-control.js +1 -1
- package/lib/cert.js +5 -5
- package/lib/cloud-events.js +5 -5
- package/lib/cms-codec.js +21 -21
- package/lib/codepoint-class.js +12 -12
- package/lib/compliance-sanctions-fuzzy.js +4 -4
- package/lib/compliance-sanctions.js +4 -4
- package/lib/compliance.js +29 -29
- package/lib/content-credentials.js +36 -36
- package/lib/cookies.js +1 -1
- package/lib/cose.js +13 -13
- package/lib/cra-report.js +1 -1
- package/lib/crdt.js +1 -1
- package/lib/crypto-field.js +2 -2
- package/lib/crypto-xwing.js +7 -7
- package/lib/crypto.js +6 -6
- package/lib/csp.js +2 -2
- package/lib/cwt.js +4 -4
- package/lib/dark-patterns.js +2 -2
- package/lib/data-act.js +2 -2
- package/lib/db-file-lifecycle.js +4 -4
- package/lib/db-query.js +1 -1
- package/lib/db.js +6 -6
- package/lib/dbsc.js +13 -13
- package/lib/did.js +17 -17
- package/lib/dora.js +4 -4
- package/lib/dsr.js +1 -1
- package/lib/early-hints.js +2 -2
- package/lib/eat.js +4 -4
- package/lib/external-db-migrate.js +1 -1
- package/lib/external-db.js +1 -1
- package/lib/flag-cache.js +1 -1
- package/lib/flag-evaluation-context.js +2 -2
- package/lib/graphql-federation.js +4 -4
- package/lib/guard-agent-registry.js +5 -5
- package/lib/guard-archive.js +24 -24
- package/lib/guard-cidr.js +33 -33
- package/lib/guard-csv.js +1 -1
- package/lib/guard-domain.js +10 -10
- package/lib/guard-dsn.js +4 -4
- package/lib/guard-email.js +19 -19
- package/lib/guard-event-bus-payload.js +4 -4
- package/lib/guard-event-bus-topic.js +6 -6
- package/lib/guard-filename.js +7 -7
- package/lib/guard-graphql.js +9 -9
- package/lib/guard-html-wcag-tagwalk.js +1 -1
- package/lib/guard-html-wcag.js +4 -4
- package/lib/guard-html.js +7 -7
- package/lib/guard-idempotency-key.js +6 -6
- package/lib/guard-image.js +4 -4
- package/lib/guard-imap-command.js +17 -17
- package/lib/guard-jmap.js +20 -20
- package/lib/guard-json.js +12 -12
- package/lib/guard-jsonpath.js +3 -3
- package/lib/guard-jwt.js +4 -4
- package/lib/guard-list-id.js +7 -7
- package/lib/guard-list-unsubscribe.js +8 -8
- package/lib/guard-mail-compose.js +4 -4
- package/lib/guard-mail-move.js +5 -5
- package/lib/guard-mail-query.js +3 -3
- package/lib/guard-mail-reply.js +3 -3
- package/lib/guard-mail-sieve.js +6 -6
- package/lib/guard-managesieve-command.js +25 -25
- package/lib/guard-markdown.js +31 -31
- package/lib/guard-message-id.js +5 -5
- package/lib/guard-mime.js +1 -1
- package/lib/guard-oauth.js +3 -3
- package/lib/guard-pdf.js +6 -6
- package/lib/guard-pop3-command.js +11 -11
- package/lib/guard-posture-chain.js +5 -5
- package/lib/guard-regex.js +10 -10
- package/lib/guard-saga-config.js +5 -5
- package/lib/guard-smtp-command.js +6 -6
- package/lib/guard-snapshot-envelope.js +3 -3
- package/lib/guard-stream-args.js +4 -4
- package/lib/guard-svg.js +11 -11
- package/lib/guard-tenant-id.js +5 -5
- package/lib/guard-time.js +15 -15
- package/lib/guard-trace-context.js +4 -4
- package/lib/guard-uuid.js +11 -11
- package/lib/guard-xml.js +12 -12
- package/lib/guard-yaml.js +16 -16
- package/lib/honeytoken.js +5 -5
- package/lib/http-client.js +1 -1
- package/lib/http-message-signature.js +2 -2
- package/lib/iab-mspa.js +3 -3
- package/lib/iab-tcf.js +70 -70
- package/lib/inbox.js +4 -4
- package/lib/ip-utils.js +15 -15
- package/lib/jose-jwe-experimental.js +2 -2
- package/lib/json-path.js +3 -3
- package/lib/json-schema.js +1 -1
- package/lib/jsonapi.js +3 -3
- package/lib/jtd.js +2 -2
- package/lib/link-header.js +1 -1
- package/lib/local-db-thin.js +1 -1
- package/lib/log.js +1 -1
- package/lib/lro.js +4 -4
- package/lib/mail-agent.js +1 -1
- package/lib/mail-arc-sign.js +6 -6
- package/lib/mail-auth.js +43 -43
- package/lib/mail-bimi.js +3 -3
- package/lib/mail-crypto-pgp.js +31 -31
- package/lib/mail-crypto-smime.js +5 -5
- package/lib/mail-dav.js +1 -1
- package/lib/mail-deploy.js +39 -39
- package/lib/mail-dkim.js +11 -11
- package/lib/mail-greylist.js +12 -12
- package/lib/mail-helo.js +1 -1
- package/lib/mail-journal.js +8 -8
- package/lib/mail-rbl.js +7 -7
- package/lib/mail-scan.js +7 -7
- package/lib/mail-send-deliver.js +2 -2
- package/lib/mail-server-imap.js +12 -12
- package/lib/mail-server-jmap.js +16 -16
- package/lib/mail-server-managesieve.js +4 -4
- package/lib/mail-server-mx.js +17 -17
- package/lib/mail-server-pop3.js +4 -4
- package/lib/mail-server-rate-limit.js +2 -2
- package/lib/mail-server-submission.js +21 -21
- package/lib/mail-sieve.js +2 -2
- package/lib/mail-spam-score.js +5 -5
- package/lib/mail-srs.js +12 -12
- package/lib/mail-store-fts.js +2 -2
- package/lib/mail-store.js +8 -8
- package/lib/mail-unsubscribe.js +4 -4
- package/lib/mail.js +4 -4
- package/lib/mcp-tool-registry.js +4 -4
- package/lib/mcp.js +8 -8
- package/lib/mdoc.js +2 -2
- package/lib/metrics.js +8 -8
- package/lib/middleware/age-gate.js +1 -1
- package/lib/middleware/api-encrypt.js +7 -7
- package/lib/middleware/assetlinks.js +2 -2
- package/lib/middleware/asyncapi-serve.js +2 -2
- package/lib/middleware/bearer-auth.js +5 -5
- package/lib/middleware/body-parser.js +5 -5
- package/lib/middleware/compose-pipeline.js +15 -15
- package/lib/middleware/csp-report.js +4 -4
- package/lib/middleware/daily-byte-quota.js +1 -1
- package/lib/middleware/dpop.js +1 -1
- package/lib/middleware/headers.js +2 -2
- package/lib/middleware/host-allowlist.js +1 -1
- package/lib/middleware/idempotency-key.js +12 -12
- package/lib/middleware/nel.js +1 -1
- package/lib/middleware/openapi-serve.js +2 -2
- package/lib/middleware/protected-resource-metadata.js +2 -2
- package/lib/middleware/require-aal.js +1 -1
- package/lib/middleware/require-bound-key.js +2 -2
- package/lib/middleware/require-content-type.js +1 -1
- package/lib/middleware/require-methods.js +1 -1
- package/lib/middleware/require-step-up.js +2 -2
- package/lib/middleware/scim-server.js +1 -1
- package/lib/middleware/security-txt.js +3 -3
- package/lib/middleware/tus-upload.js +12 -12
- package/lib/middleware/web-app-manifest.js +2 -2
- package/lib/network-byte-quota.js +1 -1
- package/lib/network-dns-resolver.js +23 -23
- package/lib/network-dns.js +29 -29
- package/lib/network-dnssec.js +33 -33
- package/lib/network-smtp-policy.js +10 -10
- package/lib/network-tls.js +87 -87
- package/lib/network-tsig.js +33 -33
- package/lib/nis2-report.js +1 -1
- package/lib/ntp-check.js +3 -3
- package/lib/observability-otlp-exporter.js +17 -17
- package/lib/observability-tracer.js +6 -6
- package/lib/observability.js +8 -8
- package/lib/openapi-yaml.js +1 -1
- package/lib/openapi.js +1 -1
- package/lib/outbox.js +6 -6
- package/lib/pqc-agent.js +4 -4
- package/lib/pqc-software.js +1 -1
- package/lib/privacy-pass.js +5 -5
- package/lib/problem-details.js +5 -5
- package/lib/promise-pool.js +1 -1
- package/lib/protobuf-encoder.js +1 -1
- package/lib/redact.js +2 -2
- package/lib/request-helpers.js +1 -1
- package/lib/router.js +10 -10
- package/lib/safe-async.js +2 -2
- package/lib/safe-dns.js +71 -71
- package/lib/safe-ical.js +19 -19
- package/lib/safe-icap.js +24 -24
- package/lib/safe-jsonpath.js +2 -2
- package/lib/safe-mime.js +10 -10
- package/lib/safe-mount-info.js +3 -3
- package/lib/safe-redirect.js +1 -1
- package/lib/safe-sieve.js +23 -23
- package/lib/safe-smtp.js +1 -1
- package/lib/safe-vcard.js +14 -14
- package/lib/sandbox.js +5 -5
- package/lib/sec-cyber.js +1 -1
- package/lib/self-update-standalone-verifier.js +3 -3
- package/lib/self-update.js +3 -3
- package/lib/server-timing.js +3 -3
- package/lib/session-device-binding.js +7 -7
- package/lib/session.js +8 -8
- package/lib/standard-webhooks.js +4 -4
- package/lib/storage.js +2 -2
- package/lib/stream-throttle.js +1 -1
- package/lib/structured-fields.js +15 -15
- package/lib/subject.js +1 -1
- package/lib/tcpa-10dlc.js +1 -1
- package/lib/tenant-quota.js +3 -3
- package/lib/test-harness.js +1 -1
- package/lib/tracing.js +1 -1
- package/lib/tsa.js +5 -5
- package/lib/uri-template.js +5 -5
- package/lib/vault/index.js +2 -2
- package/lib/vault/seal-pem-file.js +4 -4
- package/lib/vc.js +2 -2
- package/lib/vendor-data.js +1 -1
- package/lib/watcher.js +4 -4
- package/lib/web-push-vapid.js +21 -21
- package/lib/webhook.js +2 -2
- package/lib/websocket.js +3 -3
- package/lib/worker-pool.js +3 -3
- package/lib/ws-client.js +24 -24
- package/lib/xml-c14n.js +2 -2
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/lib/guard-markdown.js
CHANGED
|
@@ -100,8 +100,8 @@ var EMPH_RUN_RE = /[*_]{20,}/;
|
|
|
100
100
|
|
|
101
101
|
function _decodeHtmlEntities(s) {
|
|
102
102
|
return s.replace(HTML_ENTITY_NUM_RE, function (match, hex, dec) {
|
|
103
|
-
var code = hex !== undefined ? parseInt(hex, 16) : parseInt(dec, 10); //
|
|
104
|
-
if (!isFinite(code) || code < 0 || code > 0x10ffff) return match; //
|
|
103
|
+
var code = hex !== undefined ? parseInt(hex, 16) : parseInt(dec, 10); // parseInt radix args (16 hex / 10 decimal)
|
|
104
|
+
if (!isFinite(code) || code < 0 || code > 0x10ffff) return match; // Unicode codepoint range
|
|
105
105
|
try { return String.fromCodePoint(code); } catch (_e) { return match; }
|
|
106
106
|
});
|
|
107
107
|
}
|
|
@@ -118,7 +118,7 @@ function _isDangerousUrl(url, opts) {
|
|
|
118
118
|
var stripped = "";
|
|
119
119
|
for (var ci = 0; ci < s.length; ci += 1) {
|
|
120
120
|
var cc = s.charCodeAt(ci);
|
|
121
|
-
if (cc > 0x1f && cc !== 0x7f) stripped += s.charAt(ci); //
|
|
121
|
+
if (cc > 0x1f && cc !== 0x7f) stripped += s.charAt(ci); // ASCII control range thresholds
|
|
122
122
|
}
|
|
123
123
|
s = stripped;
|
|
124
124
|
if (DANGEROUS_SCHEME_RE.test(s)) return s.match(/^[a-z]+/i)[0].toLowerCase(); // allow:regex-no-length-cap — `s` is a markdown URL token already bounded by the inline-link / autolink / ref-def matchers (which themselves run on input bounded by maxBytes)
|
|
@@ -147,13 +147,13 @@ var PROFILES = Object.freeze({
|
|
|
147
147
|
nullBytePolicy: "reject",
|
|
148
148
|
zeroWidthPolicy: "reject",
|
|
149
149
|
maxBytes: C.BYTES.mib(1),
|
|
150
|
-
maxLines: 4096, //
|
|
151
|
-
maxLinks: 256, //
|
|
152
|
-
maxImages: 128, //
|
|
153
|
-
maxAutolinks: 128, //
|
|
154
|
-
maxRefDefs: 64, //
|
|
155
|
-
maxListDepth: 16, //
|
|
156
|
-
maxBlockquoteDepth: 16, //
|
|
150
|
+
maxLines: 4096, // line count cap
|
|
151
|
+
maxLinks: 256, // link count cap
|
|
152
|
+
maxImages: 128, // image count cap
|
|
153
|
+
maxAutolinks: 128, // autolink count cap
|
|
154
|
+
maxRefDefs: 64, // ref-def count cap
|
|
155
|
+
maxListDepth: 16, // nesting depth
|
|
156
|
+
maxBlockquoteDepth: 16, // nesting depth
|
|
157
157
|
},
|
|
158
158
|
"balanced": {
|
|
159
159
|
rawHtmlPolicy: "audit",
|
|
@@ -173,13 +173,13 @@ var PROFILES = Object.freeze({
|
|
|
173
173
|
nullBytePolicy: "strip",
|
|
174
174
|
zeroWidthPolicy: "strip",
|
|
175
175
|
maxBytes: C.BYTES.mib(8),
|
|
176
|
-
maxLines: 32768, //
|
|
177
|
-
maxLinks: 2048, //
|
|
178
|
-
maxImages: 1024, //
|
|
179
|
-
maxAutolinks: 1024, //
|
|
180
|
-
maxRefDefs: 512, //
|
|
181
|
-
maxListDepth: 64, //
|
|
182
|
-
maxBlockquoteDepth: 64, //
|
|
176
|
+
maxLines: 32768, // line count cap
|
|
177
|
+
maxLinks: 2048, // link count cap
|
|
178
|
+
maxImages: 1024, // image count cap
|
|
179
|
+
maxAutolinks: 1024, // autolink count cap
|
|
180
|
+
maxRefDefs: 512, // ref-def count cap
|
|
181
|
+
maxListDepth: 64, // nesting depth
|
|
182
|
+
maxBlockquoteDepth: 64, // nesting depth
|
|
183
183
|
},
|
|
184
184
|
"permissive": {
|
|
185
185
|
rawHtmlPolicy: "allow",
|
|
@@ -199,13 +199,13 @@ var PROFILES = Object.freeze({
|
|
|
199
199
|
nullBytePolicy: "reject",
|
|
200
200
|
zeroWidthPolicy: "audit",
|
|
201
201
|
maxBytes: C.BYTES.mib(64),
|
|
202
|
-
maxLines: 262144, //
|
|
203
|
-
maxLinks: 16384, //
|
|
204
|
-
maxImages: 8192, //
|
|
205
|
-
maxAutolinks: 8192, //
|
|
206
|
-
maxRefDefs: 4096, //
|
|
207
|
-
maxListDepth: 256, //
|
|
208
|
-
maxBlockquoteDepth: 256, //
|
|
202
|
+
maxLines: 262144, // line count cap
|
|
203
|
+
maxLinks: 16384, // link count cap
|
|
204
|
+
maxImages: 8192, // image count cap
|
|
205
|
+
maxAutolinks: 8192, // autolink count cap
|
|
206
|
+
maxRefDefs: 4096, // ref-def count cap
|
|
207
|
+
maxListDepth: 256, // nesting depth
|
|
208
|
+
maxBlockquoteDepth: 256, // nesting depth
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
|
|
@@ -261,7 +261,7 @@ function _detectIssues(input, opts) {
|
|
|
261
261
|
// Line count cap — line-based parsers scale O(lines).
|
|
262
262
|
var lineCount = 0;
|
|
263
263
|
for (var li = 0; li < input.length; li += 1) {
|
|
264
|
-
if (input.charCodeAt(li) === 10) lineCount += 1; //
|
|
264
|
+
if (input.charCodeAt(li) === 10) lineCount += 1; // newline char code
|
|
265
265
|
}
|
|
266
266
|
if (lineCount > opts.maxLines) {
|
|
267
267
|
issues.push({
|
|
@@ -342,7 +342,7 @@ function _detectIssues(input, opts) {
|
|
|
342
342
|
snippet: (isImage ? "image" : "link") +
|
|
343
343
|
" uses dangerous scheme '" + scheme + ":'",
|
|
344
344
|
});
|
|
345
|
-
if (issues.length > 256) break; //
|
|
345
|
+
if (issues.length > 256) break; // issue accumulator cap
|
|
346
346
|
}
|
|
347
347
|
if (linkCount > opts.maxLinks) {
|
|
348
348
|
issues.push({
|
|
@@ -372,7 +372,7 @@ function _detectIssues(input, opts) {
|
|
|
372
372
|
ruleId: "markdown.autolink-scheme",
|
|
373
373
|
snippet: "autolink uses dangerous scheme '" + aScheme + ":'",
|
|
374
374
|
});
|
|
375
|
-
if (issues.length > 256) break; //
|
|
375
|
+
if (issues.length > 256) break; // issue accumulator cap
|
|
376
376
|
}
|
|
377
377
|
if (autolinkCount > opts.maxAutolinks) {
|
|
378
378
|
issues.push({
|
|
@@ -398,7 +398,7 @@ function _detectIssues(input, opts) {
|
|
|
398
398
|
snippet: "reference-link definition uses dangerous scheme '" +
|
|
399
399
|
rScheme + ":' (smuggled through `[ref]` text)",
|
|
400
400
|
});
|
|
401
|
-
if (issues.length > 256) break; //
|
|
401
|
+
if (issues.length > 256) break; // issue accumulator cap
|
|
402
402
|
}
|
|
403
403
|
if (refDefCount > opts.maxRefDefs) {
|
|
404
404
|
issues.push({
|
|
@@ -422,9 +422,9 @@ function _detectIssues(input, opts) {
|
|
|
422
422
|
severity: opts.codeFenceLangPolicy === "reject" ? "critical" : "high",
|
|
423
423
|
ruleId: "markdown.code-fence-lang",
|
|
424
424
|
snippet: "code-fence language tag contains attribute-breaking " +
|
|
425
|
-
"characters: " + JSON.stringify(lang.slice(0, 64)), //
|
|
425
|
+
"characters: " + JSON.stringify(lang.slice(0, 64)), // snippet truncation
|
|
426
426
|
});
|
|
427
|
-
if (issues.length > 256) break; //
|
|
427
|
+
if (issues.length > 256) break; // issue accumulator cap
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -458,7 +458,7 @@ function _detectIssues(input, opts) {
|
|
|
458
458
|
var marker = line.charAt(leading);
|
|
459
459
|
if (marker === "-" || marker === "*" || marker === "+" ||
|
|
460
460
|
(marker >= "0" && marker <= "9")) {
|
|
461
|
-
var depth = Math.floor(leading / 2); //
|
|
461
|
+
var depth = Math.floor(leading / 2); // markdown convention: 2 spaces per nest level
|
|
462
462
|
if (depth > maxListDepthSeen) maxListDepthSeen = depth;
|
|
463
463
|
}
|
|
464
464
|
}
|
package/lib/guard-message-id.js
CHANGED
|
@@ -56,9 +56,9 @@ var GuardMessageIdError = defineClass("GuardMessageIdError", { alwaysPermanent:
|
|
|
56
56
|
var DEFAULT_PROFILE = "strict";
|
|
57
57
|
|
|
58
58
|
var PROFILES = Object.freeze({
|
|
59
|
-
strict: { requireBrackets: true, maxBytes: 998 },
|
|
60
|
-
balanced: { requireBrackets: false, maxBytes: 998 },
|
|
61
|
-
permissive: { requireBrackets: false, maxBytes: 4096 }, //
|
|
59
|
+
strict: { requireBrackets: true, maxBytes: 998 },
|
|
60
|
+
balanced: { requireBrackets: false, maxBytes: 998 },
|
|
61
|
+
permissive: { requireBrackets: false, maxBytes: 4096 }, // permissive cap, not bytes-as-storage
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -130,7 +130,7 @@ function validate(value, opts) {
|
|
|
130
130
|
// CR/LF into a Message-Id to fold an attacker-chosen From: line).
|
|
131
131
|
for (var i = 0; i < value.length; i += 1) {
|
|
132
132
|
var c = value.charCodeAt(i);
|
|
133
|
-
if (c < 0x20 || c === 0x7F) { //
|
|
133
|
+
if (c < 0x20 || c === 0x7F) { // C0 + DEL refusal
|
|
134
134
|
throw new GuardMessageIdError("message-id/control-char",
|
|
135
135
|
"guardMessageId.validate: control char 0x" + c.toString(16) + " at offset " + i);
|
|
136
136
|
}
|
|
@@ -209,7 +209,7 @@ function validate(value, opts) {
|
|
|
209
209
|
*/
|
|
210
210
|
function validateList(value, opts) {
|
|
211
211
|
opts = opts || {};
|
|
212
|
-
var maxIds = typeof opts.maxIds === "number" ? opts.maxIds : 100; //
|
|
212
|
+
var maxIds = typeof opts.maxIds === "number" ? opts.maxIds : 100; // References-chain cap, not bytes
|
|
213
213
|
if (typeof value !== "string") {
|
|
214
214
|
throw new GuardMessageIdError("message-id/bad-input",
|
|
215
215
|
"guardMessageId.validateList: value must be a string");
|
package/lib/guard-mime.js
CHANGED
|
@@ -58,7 +58,7 @@ var TOKEN_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&\-^_.+]{0,126}$/;
|
|
|
58
58
|
var PARAM_TOKEN_RE = safeBuffer.RFC7230_TCHAR_RE;
|
|
59
59
|
|
|
60
60
|
// Quoted-string body (between double quotes) per RFC 7230 §3.2.6.
|
|
61
|
-
var QUOTED_STRING_BODY_RE = /^[\t\x20-\x7e]*$/; //
|
|
61
|
+
var QUOTED_STRING_BODY_RE = /^[\t\x20-\x7e]*$/; // printable ASCII range
|
|
62
62
|
|
|
63
63
|
// Risky-type refuse list (operator-supplied scripts handed to a host).
|
|
64
64
|
var RISKY_TYPES = Object.freeze([
|
package/lib/guard-oauth.js
CHANGED
|
@@ -91,7 +91,7 @@ void observability;
|
|
|
91
91
|
|
|
92
92
|
var _err = GuardOauthError.factory;
|
|
93
93
|
|
|
94
|
-
var SCOPE_TOKEN_RE = /^[\x21\x23-\x5b\x5d-\x7e]+$/; //
|
|
94
|
+
var SCOPE_TOKEN_RE = /^[\x21\x23-\x5b\x5d-\x7e]+$/; // RFC 6749 §3.3 scope-token charset
|
|
95
95
|
var DEFAULT_RESPONSE_TYPES = Object.freeze(["code"]);
|
|
96
96
|
|
|
97
97
|
// ---- Profile presets ----
|
|
@@ -612,7 +612,7 @@ module.exports = {
|
|
|
612
612
|
redirect_uri: "https://app.example.com/callback",
|
|
613
613
|
state: "csrf-rand-1",
|
|
614
614
|
scope: "openid profile",
|
|
615
|
-
code_challenge: "abc123def456ghi789jkl012mno345pqr678", //
|
|
615
|
+
code_challenge: "abc123def456ghi789jkl012mno345pqr678", // base64url-shaped fixture
|
|
616
616
|
code_challenge_method: "S256",
|
|
617
617
|
}), "utf8"),
|
|
618
618
|
hostileBytes: Buffer.from(JSON.stringify({
|
|
@@ -626,7 +626,7 @@ module.exports = {
|
|
|
626
626
|
redirect_uri: "https://app.example.com/callback",
|
|
627
627
|
state: "csrf-rand-1",
|
|
628
628
|
scope: "openid profile",
|
|
629
|
-
code_challenge: "abc123def456ghi789jkl012mno345pqr678", //
|
|
629
|
+
code_challenge: "abc123def456ghi789jkl012mno345pqr678", // base64url-shaped fixture
|
|
630
630
|
code_challenge_method: "S256",
|
|
631
631
|
},
|
|
632
632
|
hostileOauthFlow: {
|
package/lib/guard-pdf.js
CHANGED
|
@@ -95,8 +95,8 @@ var PROFILES = Object.freeze({
|
|
|
95
95
|
polyglotPolicy: "reject",
|
|
96
96
|
pageCountPolicy: "reject",
|
|
97
97
|
embeddedFileCountPolicy: "reject",
|
|
98
|
-
maxPageCount: 500, //
|
|
99
|
-
maxEmbeddedFileCount: 0, //
|
|
98
|
+
maxPageCount: 500, // page-count ceiling
|
|
99
|
+
maxEmbeddedFileCount: 0, // strict refuses any embedded file
|
|
100
100
|
maxBytes: C.BYTES.mib(64),
|
|
101
101
|
maxRuntimeMs: C.TIME.seconds(5),
|
|
102
102
|
},
|
|
@@ -110,8 +110,8 @@ var PROFILES = Object.freeze({
|
|
|
110
110
|
polyglotPolicy: "reject", // polyglot refused at every profile
|
|
111
111
|
pageCountPolicy: "audit",
|
|
112
112
|
embeddedFileCountPolicy: "audit",
|
|
113
|
-
maxPageCount: 5000, //
|
|
114
|
-
maxEmbeddedFileCount: 10, //
|
|
113
|
+
maxPageCount: 5000, // page-count ceiling
|
|
114
|
+
maxEmbeddedFileCount: 10, // embedded file ceiling
|
|
115
115
|
maxBytes: C.BYTES.mib(128),
|
|
116
116
|
maxRuntimeMs: C.TIME.seconds(5),
|
|
117
117
|
},
|
|
@@ -125,8 +125,8 @@ var PROFILES = Object.freeze({
|
|
|
125
125
|
polyglotPolicy: "reject", // polyglot refused at every profile
|
|
126
126
|
pageCountPolicy: "audit",
|
|
127
127
|
embeddedFileCountPolicy: "audit",
|
|
128
|
-
maxPageCount: 50000, //
|
|
129
|
-
maxEmbeddedFileCount: 100, //
|
|
128
|
+
maxPageCount: 50000, // page-count ceiling
|
|
129
|
+
maxEmbeddedFileCount: 100, // embedded file ceiling
|
|
130
130
|
maxBytes: C.BYTES.mib(512),
|
|
131
131
|
maxRuntimeMs: C.TIME.seconds(5),
|
|
132
132
|
},
|
|
@@ -81,23 +81,23 @@ var DEFAULT_PROFILE = "strict";
|
|
|
81
81
|
|
|
82
82
|
var PROFILES = Object.freeze({
|
|
83
83
|
strict: {
|
|
84
|
-
maxLineBytes: 255, //
|
|
85
|
-
maxUsernameBytes: 40, //
|
|
86
|
-
maxPasswordBytes: 40, //
|
|
84
|
+
maxLineBytes: 255, // RFC 2449 §4 cap
|
|
85
|
+
maxUsernameBytes: 40, // RFC 1939 §3 cap
|
|
86
|
+
maxPasswordBytes: 40, // RFC 1939 §3 cap
|
|
87
87
|
allowBareLf: false,
|
|
88
88
|
allowApop: false, // RFC 1939 §7 — legacy challenge-response with MD5; refuse under strict (M³AAWG)
|
|
89
89
|
},
|
|
90
90
|
balanced: {
|
|
91
|
-
maxLineBytes: 512, //
|
|
92
|
-
maxUsernameBytes: 128, //
|
|
93
|
-
maxPasswordBytes: 128, //
|
|
91
|
+
maxLineBytes: 512, // RFC 2449 §4 response cap
|
|
92
|
+
maxUsernameBytes: 128, // balanced username cap
|
|
93
|
+
maxPasswordBytes: 128, // balanced password cap
|
|
94
94
|
allowBareLf: false,
|
|
95
95
|
allowApop: true,
|
|
96
96
|
},
|
|
97
97
|
permissive: {
|
|
98
|
-
maxLineBytes: 1024, //
|
|
99
|
-
maxUsernameBytes: 256, //
|
|
100
|
-
maxPasswordBytes: 256, //
|
|
98
|
+
maxLineBytes: 1024, // permissive cap for legacy peers
|
|
99
|
+
maxUsernameBytes: 256, // permissive username cap
|
|
100
|
+
maxPasswordBytes: 256, // permissive password cap
|
|
101
101
|
allowBareLf: true,
|
|
102
102
|
allowApop: true,
|
|
103
103
|
},
|
|
@@ -173,10 +173,10 @@ function validate(line, opts) {
|
|
|
173
173
|
}
|
|
174
174
|
for (var i = 0; i < line.length; i += 1) {
|
|
175
175
|
var c = line.charCodeAt(i);
|
|
176
|
-
if (c === 0x00 || c === 0x7F || (c < 0x20 && c !== 0x09)) { //
|
|
176
|
+
if (c === 0x00 || c === 0x7F || (c < 0x20 && c !== 0x09)) { // control-byte refusal
|
|
177
177
|
if (c === 0x0A && caps.allowBareLf) continue;
|
|
178
178
|
throw new GuardPop3CommandError("guard-pop3-command/bad-byte",
|
|
179
|
-
"guardPop3Command.validate: control byte 0x" + c.toString(16) + " at offset " + i); //
|
|
179
|
+
"guardPop3Command.validate: control byte 0x" + c.toString(16) + " at offset " + i); // hex format literal in error message
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -32,9 +32,9 @@ var GuardPostureChainError = defineClass("GuardPostureChainError", { alwaysPerma
|
|
|
32
32
|
var DEFAULT_PROFILE = "strict";
|
|
33
33
|
|
|
34
34
|
var PROFILES = Object.freeze({
|
|
35
|
-
strict: { maxHops: 16, maxHopBytes: 64, maxRegimes: 8 },
|
|
36
|
-
balanced: { maxHops: 32, maxHopBytes: 128, maxRegimes: 16 },
|
|
37
|
-
permissive: { maxHops: 128, maxHopBytes: 256, maxRegimes: 64 },
|
|
35
|
+
strict: { maxHops: 16, maxHopBytes: 64, maxRegimes: 8 },
|
|
36
|
+
balanced: { maxHops: 32, maxHopBytes: 128, maxRegimes: 16 },
|
|
37
|
+
permissive: { maxHops: 128, maxHopBytes: 256, maxRegimes: 64 },
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -119,11 +119,11 @@ function validate(envelope, opts) {
|
|
|
119
119
|
}
|
|
120
120
|
for (var hi = 0; hi < hop.length; hi += 1) {
|
|
121
121
|
var hc = hop.charCodeAt(hi);
|
|
122
|
-
if (hc > 0x7F) { //
|
|
122
|
+
if (hc > 0x7F) { // ASCII-only
|
|
123
123
|
throw new GuardPostureChainError("posture-chain/non-ascii-hop",
|
|
124
124
|
"guardPostureChain.validate: chainTrail[" + h + "] has non-ASCII codepoint");
|
|
125
125
|
}
|
|
126
|
-
if (hc < 0x20 || hc === 0x7F) { //
|
|
126
|
+
if (hc < 0x20 || hc === 0x7F) { // C0/DEL
|
|
127
127
|
throw new GuardPostureChainError("posture-chain/bad-hop-char",
|
|
128
128
|
"guardPostureChain.validate: chainTrail[" + h + "] has forbidden char 0x" + hc.toString(16));
|
|
129
129
|
}
|
package/lib/guard-regex.js
CHANGED
|
@@ -93,8 +93,8 @@ var PROFILES = Object.freeze({
|
|
|
93
93
|
consecutiveStarPolicy: "reject",
|
|
94
94
|
nestedExtglobPolicy: "reject",
|
|
95
95
|
inputKind: "regex", // CVE-2026-26996 + CVE-2026-33671 detectors apply only when inputKind=="glob"
|
|
96
|
-
maxBoundedRepeat: 100, //
|
|
97
|
-
maxConsecutiveStars: 2, //
|
|
96
|
+
maxBoundedRepeat: 100, // bounded repeat ceiling
|
|
97
|
+
maxConsecutiveStars: 2, // `**` recursive glob permitted; >=3 refused
|
|
98
98
|
maxPatternBytes: C.BYTES.kib(1),
|
|
99
99
|
maxBytes: C.BYTES.kib(1),
|
|
100
100
|
maxRuntimeMs: C.TIME.seconds(2),
|
|
@@ -110,8 +110,8 @@ var PROFILES = Object.freeze({
|
|
|
110
110
|
lookaroundQuantPolicy: "audit",
|
|
111
111
|
consecutiveStarPolicy: "reject", // CVE-2026-26996 refused at every profile
|
|
112
112
|
nestedExtglobPolicy: "reject", // CVE-2026-33671 refused at every profile
|
|
113
|
-
maxBoundedRepeat: 1000, //
|
|
114
|
-
maxConsecutiveStars: 2, //
|
|
113
|
+
maxBoundedRepeat: 1000, // bounded repeat ceiling
|
|
114
|
+
maxConsecutiveStars: 2, // `**` recursive glob permitted; >=3 refused
|
|
115
115
|
maxPatternBytes: C.BYTES.kib(2),
|
|
116
116
|
maxBytes: C.BYTES.kib(2),
|
|
117
117
|
maxRuntimeMs: C.TIME.seconds(2),
|
|
@@ -127,8 +127,8 @@ var PROFILES = Object.freeze({
|
|
|
127
127
|
lookaroundQuantPolicy: "audit",
|
|
128
128
|
consecutiveStarPolicy: "reject", // CVE-2026-26996 refused at every profile
|
|
129
129
|
nestedExtglobPolicy: "reject", // CVE-2026-33671 refused at every profile
|
|
130
|
-
maxBoundedRepeat: 10000, //
|
|
131
|
-
maxConsecutiveStars: 2, //
|
|
130
|
+
maxBoundedRepeat: 10000, // bounded repeat ceiling
|
|
131
|
+
maxConsecutiveStars: 2, // `**` recursive glob permitted; >=3 refused
|
|
132
132
|
maxPatternBytes: C.BYTES.kib(8),
|
|
133
133
|
maxBytes: C.BYTES.kib(8),
|
|
134
134
|
maxRuntimeMs: C.TIME.seconds(2),
|
|
@@ -223,9 +223,9 @@ function _detectIssues(input, opts) {
|
|
|
223
223
|
BOUNDED_REPEAT_RE.lastIndex = 0;
|
|
224
224
|
var match;
|
|
225
225
|
while ((match = BOUNDED_REPEAT_RE.exec(input)) !== null) { // allow:regex-no-length-cap — input bounded by maxPatternBytes
|
|
226
|
-
var lower = parseInt(match[1], 10); //
|
|
226
|
+
var lower = parseInt(match[1], 10); // base-10 radix
|
|
227
227
|
var upper = match[2] === undefined ? lower :
|
|
228
|
-
match[2] === "" ? Infinity : parseInt(match[2], 10); //
|
|
228
|
+
match[2] === "" ? Infinity : parseInt(match[2], 10); // base-10 radix
|
|
229
229
|
var ceiling = (upper === Infinity || upper > lower) ? upper : lower;
|
|
230
230
|
if (ceiling > opts.maxBoundedRepeat) {
|
|
231
231
|
issues.push({
|
|
@@ -273,7 +273,7 @@ function _detectConsecutiveStar(input, opts, issues) {
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
var starCeiling = opts.maxConsecutiveStars === undefined ?
|
|
276
|
-
2 : opts.maxConsecutiveStars; //
|
|
276
|
+
2 : opts.maxConsecutiveStars; // `**` glob ceiling
|
|
277
277
|
if (starRunMax > starCeiling) {
|
|
278
278
|
issues.push({
|
|
279
279
|
kind: "consecutive-star",
|
|
@@ -315,7 +315,7 @@ function _detectNestedExtglob(input, opts, issues) {
|
|
|
315
315
|
}
|
|
316
316
|
heads.push(idx);
|
|
317
317
|
scanFrom = idx + 1;
|
|
318
|
-
if (heads.length > 1024) break; //
|
|
318
|
+
if (heads.length > 1024) break; // head-count safety cap
|
|
319
319
|
}
|
|
320
320
|
var nested = false;
|
|
321
321
|
for (var hi = 0; hi < heads.length && !nested; hi += 1) {
|
package/lib/guard-saga-config.js
CHANGED
|
@@ -22,9 +22,9 @@ var GuardSagaConfigError = defineClass("GuardSagaConfigError", { alwaysPermanent
|
|
|
22
22
|
var DEFAULT_PROFILE = "strict";
|
|
23
23
|
|
|
24
24
|
var PROFILES = Object.freeze({
|
|
25
|
-
strict: { maxSteps: 32, maxNameBytes: 64 },
|
|
26
|
-
balanced: { maxSteps: 128, maxNameBytes: 128 },
|
|
27
|
-
permissive: { maxSteps: 512, maxNameBytes: 256 },
|
|
25
|
+
strict: { maxSteps: 32, maxNameBytes: 64 },
|
|
26
|
+
balanced: { maxSteps: 128, maxNameBytes: 128 },
|
|
27
|
+
permissive: { maxSteps: 512, maxNameBytes: 256 },
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -72,11 +72,11 @@ function validate(config, opts) {
|
|
|
72
72
|
}
|
|
73
73
|
for (var i = 0; i < config.name.length; i += 1) {
|
|
74
74
|
var c = config.name.charCodeAt(i);
|
|
75
|
-
if (c > 0x7F) { //
|
|
75
|
+
if (c > 0x7F) { // ASCII-only
|
|
76
76
|
throw new GuardSagaConfigError("saga-config/non-ascii-name",
|
|
77
77
|
"guardSagaConfig.validate: name has non-ASCII codepoint at offset " + i);
|
|
78
78
|
}
|
|
79
|
-
if (c < 0x20 || c === 0x7F) { //
|
|
79
|
+
if (c < 0x20 || c === 0x7F) { // C0/DEL
|
|
80
80
|
throw new GuardSagaConfigError("saga-config/bad-name-char",
|
|
81
81
|
"guardSagaConfig.validate: name has forbidden char 0x" + c.toString(16));
|
|
82
82
|
}
|
|
@@ -98,9 +98,9 @@ var DEFAULT_PROFILE = "strict";
|
|
|
98
98
|
// CRLF). SMTPUTF8 / EAI extends this in practice; balanced/permissive
|
|
99
99
|
// raise the cap accordingly.
|
|
100
100
|
var PROFILES = Object.freeze({
|
|
101
|
-
strict: { maxLineBytes: 512, maxMailbox: 256, maxLocalPart: 64, maxDomain: 255, allowBareLf: false, allowSmtpUtf8: false }, //
|
|
102
|
-
balanced: { maxLineBytes: 1024, maxMailbox: 320, maxLocalPart: 64, maxDomain: 255, allowBareLf: false, allowSmtpUtf8: true }, //
|
|
103
|
-
permissive: { maxLineBytes: 4096, maxMailbox: 512, maxLocalPart: 64, maxDomain: 255, allowBareLf: true, allowSmtpUtf8: true }, //
|
|
101
|
+
strict: { maxLineBytes: 512, maxMailbox: 256, maxLocalPart: 64, maxDomain: 255, allowBareLf: false, allowSmtpUtf8: false }, // RFC 5321 §4.5.3.1.1 caps
|
|
102
|
+
balanced: { maxLineBytes: 1024, maxMailbox: 320, maxLocalPart: 64, maxDomain: 255, allowBareLf: false, allowSmtpUtf8: true }, // SMTPUTF8 (RFC 6531) line cap
|
|
103
|
+
permissive: { maxLineBytes: 4096, maxMailbox: 512, maxLocalPart: 64, maxDomain: 255, allowBareLf: true, allowSmtpUtf8: true }, // permissive cap for legacy peers
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -191,12 +191,12 @@ function validate(line, opts) {
|
|
|
191
191
|
// bare-LF refusal earlier in this fn. Skip the control-char throw
|
|
192
192
|
// so the documented allowBareLf path actually accepts LF (Codex
|
|
193
193
|
// caught this: permissive profile was effectively broken).
|
|
194
|
-
if (c === 0x0a && caps.allowBareLf) continue; //
|
|
195
|
-
if (c < 0x20 || c === 0x7f) { //
|
|
194
|
+
if (c === 0x0a && caps.allowBareLf) continue; // RFC 5321 §2.3.8 LF, permissive bypass
|
|
195
|
+
if (c < 0x20 || c === 0x7f) { // RFC 5321 §2.3.8 forbids C0 / DEL
|
|
196
196
|
throw new GuardSmtpCommandError("guard-smtp-command/control-char",
|
|
197
197
|
"guardSmtpCommand.validate: control char 0x" + c.toString(16) + " refused");
|
|
198
198
|
}
|
|
199
|
-
if (!caps.allowSmtpUtf8 && c > 0x7e) { //
|
|
199
|
+
if (!caps.allowSmtpUtf8 && c > 0x7e) { // RFC 5321 §2.3.1 7-bit ASCII; SMTPUTF8 relaxes
|
|
200
200
|
throw new GuardSmtpCommandError("guard-smtp-command/non-ascii",
|
|
201
201
|
"guardSmtpCommand.validate: non-ASCII byte refused (no SMTPUTF8 negotiated)");
|
|
202
202
|
}
|
|
@@ -35,9 +35,9 @@ var GuardSnapshotEnvelopeError = defineClass("GuardSnapshotEnvelopeError", { alw
|
|
|
35
35
|
var DEFAULT_PROFILE = "strict";
|
|
36
36
|
|
|
37
37
|
var PROFILES = Object.freeze({
|
|
38
|
-
strict: { maxBytes: 52428800, maxInFlight: 65536 }, //
|
|
39
|
-
balanced: { maxBytes: 209715200, maxInFlight: 262144 }, //
|
|
40
|
-
permissive: { maxBytes: 1073741824, maxInFlight: 1048576 }, //
|
|
38
|
+
strict: { maxBytes: 52428800, maxInFlight: 65536 }, // 50 MiB cap
|
|
39
|
+
balanced: { maxBytes: 209715200, maxInFlight: 262144 }, // 200 MiB
|
|
40
|
+
permissive: { maxBytes: 1073741824, maxInFlight: 1048576 }, // 1 GiB
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
var COMPLIANCE_POSTURES = Object.freeze({
|
package/lib/guard-stream-args.js
CHANGED
|
@@ -26,9 +26,9 @@ var GuardStreamArgsError = defineClass("GuardStreamArgsError", { alwaysPermanent
|
|
|
26
26
|
var DEFAULT_PROFILE = "strict";
|
|
27
27
|
|
|
28
28
|
var PROFILES = Object.freeze({
|
|
29
|
-
strict: { maxBatchSize: 1024, minBatchSize: 1, maxOpenStreams: 4 },
|
|
30
|
-
balanced: { maxBatchSize: 4096, minBatchSize: 1, maxOpenStreams: 16 },
|
|
31
|
-
permissive: { maxBatchSize: 16384, minBatchSize: 1, maxOpenStreams: 64 },
|
|
29
|
+
strict: { maxBatchSize: 1024, minBatchSize: 1, maxOpenStreams: 4 },
|
|
30
|
+
balanced: { maxBatchSize: 4096, minBatchSize: 1, maxOpenStreams: 16 },
|
|
31
|
+
permissive: { maxBatchSize: 16384, minBatchSize: 1, maxOpenStreams: 64 },
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -109,7 +109,7 @@ function compliancePosture(posture) {
|
|
|
109
109
|
|
|
110
110
|
function _checkCursorOpts(cursorOpts, depth) {
|
|
111
111
|
depth = depth || 0;
|
|
112
|
-
if (depth > 8) { //
|
|
112
|
+
if (depth > 8) { // recursion depth cap
|
|
113
113
|
throw new GuardStreamArgsError("stream-args/cursor-opts-too-deep",
|
|
114
114
|
"guardStreamArgs.validate: cursorOpts nesting depth exceeds 8");
|
|
115
115
|
}
|
package/lib/guard-svg.js
CHANGED
|
@@ -118,7 +118,7 @@ var observability = lazyRequire(function () { return require("./observability");
|
|
|
118
118
|
void observability;
|
|
119
119
|
|
|
120
120
|
var _err = GuardSvgError.factory;
|
|
121
|
-
var HEX_RADIX = 16; //
|
|
121
|
+
var HEX_RADIX = 16; // base-16 radix, not byte size
|
|
122
122
|
|
|
123
123
|
// ---- Codepoint catalog (shared via lib/codepoint-class) ----
|
|
124
124
|
|
|
@@ -221,7 +221,7 @@ var EVENT_HANDLER_RE = /^on[a-z]/i;
|
|
|
221
221
|
// signature; SVG spec allows compressed delivery but content-safety
|
|
222
222
|
// gates can't peer inside without ungzipping. Refused at gate level
|
|
223
223
|
// regardless of profile.
|
|
224
|
-
var GZIP_MAGIC = Buffer.from([0x1F, 0x8B]); //
|
|
224
|
+
var GZIP_MAGIC = Buffer.from([0x1F, 0x8B]); // gzip RFC 1952 §2.3.1 magic, not byte size
|
|
225
225
|
|
|
226
226
|
// ---- Profile presets ----
|
|
227
227
|
|
|
@@ -253,9 +253,9 @@ var PROFILES = Object.freeze({
|
|
|
253
253
|
svgzPolicy: "reject",
|
|
254
254
|
maxBytes: C.BYTES.mib(2),
|
|
255
255
|
maxAttrValueBytes: C.BYTES.kib(8),
|
|
256
|
-
maxElementCount: 0x2000, //
|
|
257
|
-
maxUseDepth: 8, //
|
|
258
|
-
maxAttrsPerTag: 64, //
|
|
256
|
+
maxElementCount: 0x2000, // element count limit, not bytes
|
|
257
|
+
maxUseDepth: 8, // use-element nesting count, not bytes
|
|
258
|
+
maxAttrsPerTag: 64, // attribute count, not bytes
|
|
259
259
|
},
|
|
260
260
|
"balanced": {
|
|
261
261
|
allowedTags: BALANCED_ALLOWED_TAGS,
|
|
@@ -276,9 +276,9 @@ var PROFILES = Object.freeze({
|
|
|
276
276
|
svgzPolicy: "reject",
|
|
277
277
|
maxBytes: C.BYTES.mib(8),
|
|
278
278
|
maxAttrValueBytes: C.BYTES.kib(32),
|
|
279
|
-
maxElementCount: 0x10000, //
|
|
280
|
-
maxUseDepth: 16, //
|
|
281
|
-
maxAttrsPerTag: 128, //
|
|
279
|
+
maxElementCount: 0x10000, // element count limit, not bytes
|
|
280
|
+
maxUseDepth: 16, // use-element nesting count, not bytes
|
|
281
|
+
maxAttrsPerTag: 128, // attribute count, not bytes
|
|
282
282
|
},
|
|
283
283
|
"permissive": {
|
|
284
284
|
allowedTags: PERMISSIVE_ALLOWED_TAGS,
|
|
@@ -299,9 +299,9 @@ var PROFILES = Object.freeze({
|
|
|
299
299
|
svgzPolicy: "reject",
|
|
300
300
|
maxBytes: C.BYTES.mib(32),
|
|
301
301
|
maxAttrValueBytes: C.BYTES.kib(64),
|
|
302
|
-
maxElementCount: 0x40000, //
|
|
303
|
-
maxUseDepth: 32, //
|
|
304
|
-
maxAttrsPerTag: 256, //
|
|
302
|
+
maxElementCount: 0x40000, // element count limit, not bytes
|
|
303
|
+
maxUseDepth: 32, // use-element nesting count, not bytes
|
|
304
|
+
maxAttrsPerTag: 256, // attribute count, not bytes
|
|
305
305
|
},
|
|
306
306
|
});
|
|
307
307
|
|
package/lib/guard-tenant-id.js
CHANGED
|
@@ -29,9 +29,9 @@ var GuardTenantIdError = defineClass("GuardTenantIdError", { alwaysPermanent: tr
|
|
|
29
29
|
var DEFAULT_PROFILE = "strict";
|
|
30
30
|
|
|
31
31
|
var PROFILES = Object.freeze({
|
|
32
|
-
strict: { maxBytes: 64 },
|
|
33
|
-
balanced: { maxBytes: 128 },
|
|
34
|
-
permissive: { maxBytes: 512 },
|
|
32
|
+
strict: { maxBytes: 64 },
|
|
33
|
+
balanced: { maxBytes: 128 },
|
|
34
|
+
permissive: { maxBytes: 512 },
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -85,11 +85,11 @@ function validate(tenantId, opts) {
|
|
|
85
85
|
}
|
|
86
86
|
for (var i = 0; i < tenantId.length; i += 1) {
|
|
87
87
|
var c = tenantId.charCodeAt(i);
|
|
88
|
-
if (c > 0x7F) { //
|
|
88
|
+
if (c > 0x7F) { // ASCII-only cap
|
|
89
89
|
throw new GuardTenantIdError("tenant-id/non-ascii",
|
|
90
90
|
"guardTenantId.validate: non-ASCII codepoint at offset " + i);
|
|
91
91
|
}
|
|
92
|
-
if (c < 0x20 || c === 0x7F || c === 0x2F || c === 0x5C) { //
|
|
92
|
+
if (c < 0x20 || c === 0x7F || c === 0x2F || c === 0x5C) { // C0/DEL/slash/backslash
|
|
93
93
|
throw new GuardTenantIdError("tenant-id/bad-char",
|
|
94
94
|
"guardTenantId.validate: forbidden char 0x" + c.toString(16) + " at offset " + i);
|
|
95
95
|
}
|