@blamejs/core 0.14.0 → 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 +4 -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 +45 -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/jar.js +11 -0
- package/lib/auth/jwt-external.js +5 -5
- package/lib/auth/oauth.js +7 -9
- package/lib/auth/oid4vci.js +10 -10
- 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 +29 -25
- 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 +53 -45
- 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 +99 -94
- 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 +9 -1
- package/lib/queue.js +4 -2
- 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-mail-sieve.js
CHANGED
|
@@ -39,9 +39,9 @@ var GuardMailSieveError = defineClass("GuardMailSieveError", { alwaysPermanent:
|
|
|
39
39
|
var DEFAULT_PROFILE = "strict";
|
|
40
40
|
|
|
41
41
|
var PROFILES = Object.freeze({
|
|
42
|
-
strict: { maxScriptBytes: 65536, maxNameBytes: 256, maxLines: 2000 },
|
|
43
|
-
balanced: { maxScriptBytes: 262144, maxNameBytes: 256, maxLines: 10000 },
|
|
44
|
-
permissive: { maxScriptBytes: 1048576, maxNameBytes: 1024, maxLines: 50000 },
|
|
42
|
+
strict: { maxScriptBytes: 65536, maxNameBytes: 256, maxLines: 2000 },
|
|
43
|
+
balanced: { maxScriptBytes: 262144, maxNameBytes: 256, maxLines: 10000 },
|
|
44
|
+
permissive: { maxScriptBytes: 1048576, maxNameBytes: 1024, maxLines: 50000 },
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
var COMPLIANCE_POSTURES = Object.freeze({
|
|
@@ -112,7 +112,7 @@ function validate(op, opts) {
|
|
|
112
112
|
// but blows up later parser stages; refuse here).
|
|
113
113
|
var lineCount = 1;
|
|
114
114
|
for (var i = 0; i < op.script.length; i += 1) {
|
|
115
|
-
if (op.script.charCodeAt(i) === 0x0A) lineCount += 1; //
|
|
115
|
+
if (op.script.charCodeAt(i) === 0x0A) lineCount += 1; // LF
|
|
116
116
|
}
|
|
117
117
|
if (lineCount > profile.maxLines) {
|
|
118
118
|
throw new GuardMailSieveError("mail-sieve/too-many-lines",
|
|
@@ -123,7 +123,7 @@ function validate(op, opts) {
|
|
|
123
123
|
// text-only per RFC 5228 §1.4).
|
|
124
124
|
for (var j = 0; j < op.script.length; j += 1) {
|
|
125
125
|
var c = op.script.charCodeAt(j);
|
|
126
|
-
if (c === 0x00 || (c < 0x20 && c !== 0x09 && c !== 0x0A && c !== 0x0D) || c === 0x7F) { //
|
|
126
|
+
if (c === 0x00 || (c < 0x20 && c !== 0x09 && c !== 0x0A && c !== 0x0D) || c === 0x7F) { // NUL / C0 except TAB/LF/CR / DEL refusal
|
|
127
127
|
throw new GuardMailSieveError("mail-sieve/control-char-in-script",
|
|
128
128
|
"guardMailSieve.validate: control char 0x" + c.toString(16) + " at offset " + j);
|
|
129
129
|
}
|
|
@@ -177,7 +177,7 @@ function _checkName(name, profile) {
|
|
|
177
177
|
}
|
|
178
178
|
for (var i = 0; i < name.length; i += 1) {
|
|
179
179
|
var c = name.charCodeAt(i);
|
|
180
|
-
if (c < 0x20 || c === 0x7F || c === 0x2F || c === 0x5C) { //
|
|
180
|
+
if (c < 0x20 || c === 0x7F || c === 0x2F || c === 0x5C) { // C0 / DEL / slash / backslash refusal
|
|
181
181
|
throw new GuardMailSieveError("mail-sieve/bad-name-char",
|
|
182
182
|
"guardMailSieve.validate: op.name contains forbidden char 0x" + c.toString(16));
|
|
183
183
|
}
|
|
@@ -109,25 +109,25 @@ var DEFAULT_PROFILE = "strict";
|
|
|
109
109
|
|
|
110
110
|
var PROFILES = Object.freeze({
|
|
111
111
|
strict: {
|
|
112
|
-
maxLineBytes: 8192, //
|
|
113
|
-
maxScriptBytes: 65536, //
|
|
114
|
-
maxScriptNameBytes: 512, //
|
|
112
|
+
maxLineBytes: 8192, // 8 KiB per-line cap (strict)
|
|
113
|
+
maxScriptBytes: 65536, // 64 KiB script cap (matches safeSieve strict)
|
|
114
|
+
maxScriptNameBytes: 512, // RFC 5804 §2.1 script-name cap
|
|
115
115
|
allowBareLf: false,
|
|
116
116
|
allowCleartextAuth: false,
|
|
117
|
-
allowLiteralPlus: true, // RFC 7888 LITERAL+ accepted under strict (operator MAY refuse via opts.allowLiteralPlus=false) //
|
|
117
|
+
allowLiteralPlus: true, // RFC 7888 LITERAL+ accepted under strict (operator MAY refuse via opts.allowLiteralPlus=false) // RFC number
|
|
118
118
|
},
|
|
119
119
|
balanced: {
|
|
120
|
-
maxLineBytes: 16384, //
|
|
121
|
-
maxScriptBytes: 262144, //
|
|
122
|
-
maxScriptNameBytes: 512, //
|
|
120
|
+
maxLineBytes: 16384, // 16 KiB per-line cap (balanced)
|
|
121
|
+
maxScriptBytes: 262144, // 256 KiB script cap (matches safeSieve balanced)
|
|
122
|
+
maxScriptNameBytes: 512, // RFC 5804 §2.1 script-name cap
|
|
123
123
|
allowBareLf: false,
|
|
124
124
|
allowCleartextAuth: false,
|
|
125
125
|
allowLiteralPlus: true,
|
|
126
126
|
},
|
|
127
127
|
permissive: {
|
|
128
|
-
maxLineBytes: 65536, //
|
|
129
|
-
maxScriptBytes: 1048576, //
|
|
130
|
-
maxScriptNameBytes: 512, //
|
|
128
|
+
maxLineBytes: 65536, // 64 KiB per-line cap (permissive)
|
|
129
|
+
maxScriptBytes: 1048576, // 1 MiB script cap (matches safeSieve permissive)
|
|
130
|
+
maxScriptNameBytes: 512, // RFC 5804 §2.1 script-name cap
|
|
131
131
|
allowBareLf: true,
|
|
132
132
|
allowCleartextAuth: true,
|
|
133
133
|
allowLiteralPlus: true,
|
|
@@ -231,16 +231,16 @@ function validate(line, opts) {
|
|
|
231
231
|
var inQuote = false;
|
|
232
232
|
for (var i = 0; i < line.length; i += 1) {
|
|
233
233
|
var c = line.charCodeAt(i);
|
|
234
|
-
if (c === 0x22 && !_isEscaped(line, i)) { //
|
|
234
|
+
if (c === 0x22 && !_isEscaped(line, i)) { // DQUOTE
|
|
235
235
|
inQuote = !inQuote;
|
|
236
236
|
continue;
|
|
237
237
|
}
|
|
238
238
|
if (inQuote) continue;
|
|
239
|
-
if (c === 0x00 || c === 0x7F || (c < 0x20 && c !== 0x09)) { //
|
|
239
|
+
if (c === 0x00 || c === 0x7F || (c < 0x20 && c !== 0x09)) { // control-byte refusal
|
|
240
240
|
if (c === 0x0A && caps.allowBareLf) continue;
|
|
241
241
|
throw new GuardManageSieveCommandError("guard-managesieve-command/bad-byte",
|
|
242
242
|
"guardManageSieveCommand.validate: control byte 0x" +
|
|
243
|
-
c.toString(16) + " at offset " + i); //
|
|
243
|
+
c.toString(16) + " at offset " + i); // base-16 toString radix
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
if (inQuote) {
|
|
@@ -322,7 +322,7 @@ function _validateAuthenticate(rest, caps, profileName, opts) {
|
|
|
322
322
|
// Base64-initial-response cap: bound by the script-name cap
|
|
323
323
|
// (initial-response is a SASL token, not a script body; 4 KiB
|
|
324
324
|
// is generous).
|
|
325
|
-
if (n > 4096) { //
|
|
325
|
+
if (n > 4096) { // 4 KiB SASL initial-response cap
|
|
326
326
|
throw new GuardManageSieveCommandError("guard-managesieve-command/literal-too-large",
|
|
327
327
|
"guardManageSieveCommand.validate: AUTHENTICATE initial-response " +
|
|
328
328
|
n + " bytes exceeds 4096-byte cap");
|
|
@@ -463,26 +463,26 @@ function _validateRenamescript(rest, caps) {
|
|
|
463
463
|
// Returns null if `s` does not begin with a DQUOTE. RFC 5804 §1.2
|
|
464
464
|
// quoted strings allow UTF-8 content and `\"` / `\\` escape sequences.
|
|
465
465
|
function _parseQuotedString(s) {
|
|
466
|
-
if (s.length === 0 || s.charCodeAt(0) !== 0x22) return null; //
|
|
466
|
+
if (s.length === 0 || s.charCodeAt(0) !== 0x22) return null; // DQUOTE
|
|
467
467
|
var out = "";
|
|
468
468
|
var i = 1;
|
|
469
469
|
while (i < s.length) {
|
|
470
470
|
var c = s.charCodeAt(i);
|
|
471
|
-
if (c === 0x5C) { //
|
|
471
|
+
if (c === 0x5C) { // backslash escape
|
|
472
472
|
if (i + 1 >= s.length) return null;
|
|
473
473
|
var esc = s.charCodeAt(i + 1);
|
|
474
|
-
if (esc === 0x22) { out += '"'; i += 2; continue; } //
|
|
475
|
-
if (esc === 0x5C) { out += "\\"; i += 2; continue; } //
|
|
474
|
+
if (esc === 0x22) { out += '"'; i += 2; continue; } // DQUOTE
|
|
475
|
+
if (esc === 0x5C) { out += "\\"; i += 2; continue; } // backslash
|
|
476
476
|
return null;
|
|
477
477
|
}
|
|
478
|
-
if (c === 0x22) { //
|
|
478
|
+
if (c === 0x22) { // closing DQUOTE
|
|
479
479
|
var rest = s.slice(i + 1);
|
|
480
480
|
// Trim leading whitespace from rest.
|
|
481
481
|
var k = 0;
|
|
482
|
-
while (k < rest.length && (rest.charCodeAt(k) === 0x20 || rest.charCodeAt(k) === 0x09)) k += 1; //
|
|
482
|
+
while (k < rest.length && (rest.charCodeAt(k) === 0x20 || rest.charCodeAt(k) === 0x09)) k += 1; // SP / HTAB
|
|
483
483
|
return { value: out, rest: rest.slice(k) };
|
|
484
484
|
}
|
|
485
|
-
if (c === 0x00 || c === 0x0D || c === 0x0A) return null; //
|
|
485
|
+
if (c === 0x00 || c === 0x0D || c === 0x0A) return null; // NUL/CR/LF refused in quoted strings
|
|
486
486
|
out += s[i];
|
|
487
487
|
i += 1;
|
|
488
488
|
}
|
|
@@ -495,7 +495,7 @@ function _parseQuotedString(s) {
|
|
|
495
495
|
function _isEscaped(line, i) {
|
|
496
496
|
var n = 0;
|
|
497
497
|
var j = i - 1;
|
|
498
|
-
while (j >= 0 && line.charCodeAt(j) === 0x5C) { n += 1; j -= 1; } //
|
|
498
|
+
while (j >= 0 && line.charCodeAt(j) === 0x5C) { n += 1; j -= 1; } // backslash count
|
|
499
499
|
return (n & 1) === 1;
|
|
500
500
|
}
|
|
501
501
|
|
|
@@ -513,12 +513,12 @@ function _checkScriptName(name, caps) {
|
|
|
513
513
|
_checkScriptNameBytes(name, caps);
|
|
514
514
|
for (var i = 0; i < name.length; i += 1) {
|
|
515
515
|
var c = name.charCodeAt(i);
|
|
516
|
-
if (c === 0x2F || c === 0x5C) { //
|
|
516
|
+
if (c === 0x2F || c === 0x5C) { // forward-slash + backslash refused
|
|
517
517
|
throw new GuardManageSieveCommandError("guard-managesieve-command/bad-name-byte",
|
|
518
518
|
"guardManageSieveCommand.validate: script-name byte 0x" +
|
|
519
|
-
c.toString(16) + " refused (RFC 5804 §2.1)"); //
|
|
519
|
+
c.toString(16) + " refused (RFC 5804 §2.1)"); // base-16 toString radix
|
|
520
520
|
}
|
|
521
|
-
if (c === 0x00) { //
|
|
521
|
+
if (c === 0x00) { // NUL refused
|
|
522
522
|
throw new GuardManageSieveCommandError("guard-managesieve-command/bad-name-byte",
|
|
523
523
|
"guardManageSieveCommand.validate: NUL byte refused in script-name (RFC 5804 §2.1)");
|
|
524
524
|
}
|
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
|
}
|