@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/network-tsig.js
CHANGED
|
@@ -39,8 +39,8 @@ var { defineClass } = require("./framework-error");
|
|
|
39
39
|
|
|
40
40
|
var TsigError = defineClass("TsigError", { alwaysPermanent: true });
|
|
41
41
|
|
|
42
|
-
var TYPE_TSIG = 250; //
|
|
43
|
-
var CLASS_ANY = 255; //
|
|
42
|
+
var TYPE_TSIG = 250; // IANA RR type TSIG
|
|
43
|
+
var CLASS_ANY = 255; // TSIG RRs use CLASS ANY
|
|
44
44
|
var DEFAULT_FUDGE = 300; // allow:raw-time-literal — RFC 8945 recommended fudge window (seconds)
|
|
45
45
|
|
|
46
46
|
// Algorithm name → Node hash. The strong HMAC-SHA-2 family is the safe set;
|
|
@@ -57,7 +57,7 @@ var LEGACY_ALGORITHMS = {
|
|
|
57
57
|
"hmac-md5": "md5",
|
|
58
58
|
};
|
|
59
59
|
// RFC 8945 §5.2.2.1 — TSIG error RCODEs.
|
|
60
|
-
var ERROR = { NOERROR: 0, BADSIG: 16, BADKEY: 17, BADTIME: 18, BADTRUNC: 22 }; //
|
|
60
|
+
var ERROR = { NOERROR: 0, BADSIG: 16, BADKEY: 17, BADTIME: 18, BADTRUNC: 22 }; // RFC 8945 extended-RCODE values
|
|
61
61
|
|
|
62
62
|
function _normAlg(name, allowLegacy) {
|
|
63
63
|
var key = String(name || "hmac-sha256").toLowerCase().replace(/\.$/, "");
|
|
@@ -90,7 +90,7 @@ function _encodeName(name) {
|
|
|
90
90
|
var out = [];
|
|
91
91
|
for (var i = 0; i < parts.length; i++) {
|
|
92
92
|
var lab = Buffer.from(parts[i], "ascii");
|
|
93
|
-
if (lab.length === 0 || lab.length > 63) throw new TsigError("tsig/bad-name", "tsig: invalid label in name '" + name + "'"); //
|
|
93
|
+
if (lab.length === 0 || lab.length > 63) throw new TsigError("tsig/bad-name", "tsig: invalid label in name '" + name + "'"); // RFC 1035 max label length
|
|
94
94
|
out.push(Buffer.from([lab.length]), lab);
|
|
95
95
|
}
|
|
96
96
|
out.push(Buffer.from([0]));
|
|
@@ -109,15 +109,15 @@ function _readName(buf, off) {
|
|
|
109
109
|
if (i >= buf.length) throw new TsigError("tsig/truncated", "tsig: truncated name in message");
|
|
110
110
|
var len = buf[i];
|
|
111
111
|
if (len === 0) { if (end === -1) end = i + 1; break; }
|
|
112
|
-
if ((len & 0xc0) === 0xc0) { //
|
|
112
|
+
if ((len & 0xc0) === 0xc0) { // RFC 1035 §4.1.4 compression-pointer flag
|
|
113
113
|
if (i + 1 >= buf.length) throw new TsigError("tsig/truncated", "tsig: truncated compression pointer");
|
|
114
114
|
if (end === -1) end = i + 2;
|
|
115
|
-
var ptr = ((len & 0x3f) << 8) | buf[i + 1]; //
|
|
116
|
-
if (++jumps > 128) throw new TsigError("tsig/bad-name", "tsig: compression-pointer loop"); //
|
|
115
|
+
var ptr = ((len & 0x3f) << 8) | buf[i + 1]; // 14-bit pointer offset
|
|
116
|
+
if (++jumps > 128) throw new TsigError("tsig/bad-name", "tsig: compression-pointer loop"); // pointer-chase cap
|
|
117
117
|
i = ptr;
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
|
-
if ((len & 0xc0) !== 0) throw new TsigError("tsig/bad-name", "tsig: reserved label-length bits set"); //
|
|
120
|
+
if ((len & 0xc0) !== 0) throw new TsigError("tsig/bad-name", "tsig: reserved label-length bits set"); // RFC 1035 label top-bits
|
|
121
121
|
i++;
|
|
122
122
|
labels.push(buf.slice(i, i + len).toString("ascii"));
|
|
123
123
|
i += len;
|
|
@@ -132,8 +132,8 @@ function _skipName(buf, off) {
|
|
|
132
132
|
if (i >= buf.length) throw new TsigError("tsig/truncated", "tsig: truncated name");
|
|
133
133
|
var len = buf[i];
|
|
134
134
|
if (len === 0) return i + 1;
|
|
135
|
-
if ((len & 0xc0) === 0xc0) return i + 2; //
|
|
136
|
-
if ((len & 0xc0) !== 0) throw new TsigError("tsig/bad-name", "tsig: reserved label-length bits set"); //
|
|
135
|
+
if ((len & 0xc0) === 0xc0) return i + 2; // compression pointer is terminal
|
|
136
|
+
if ((len & 0xc0) !== 0) throw new TsigError("tsig/bad-name", "tsig: reserved label-length bits set"); // RFC 1035 label top-bits
|
|
137
137
|
i += 1 + len;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -141,20 +141,20 @@ function _skipName(buf, off) {
|
|
|
141
141
|
// Walk the message to the start of the LAST resource record, which a
|
|
142
142
|
// TSIG-bearing message requires to be the TSIG RR (RFC 8945 §5.1).
|
|
143
143
|
function _findTsigRr(buf) {
|
|
144
|
-
if (buf.length < 12) throw new TsigError("tsig/truncated", "tsig: message shorter than the 12-byte header"); //
|
|
144
|
+
if (buf.length < 12) throw new TsigError("tsig/truncated", "tsig: message shorter than the 12-byte header"); // DNS header length
|
|
145
145
|
var qd = buf.readUInt16BE(4), an = buf.readUInt16BE(6), ns = buf.readUInt16BE(8), ar = buf.readUInt16BE(10);
|
|
146
146
|
if (ar < 1) throw new TsigError("tsig/no-tsig", "tsig: message has no additional records (no TSIG)");
|
|
147
|
-
var off = 12; //
|
|
147
|
+
var off = 12; // past the DNS header
|
|
148
148
|
var q;
|
|
149
|
-
for (q = 0; q < qd; q++) { off = _skipName(buf, off); off += 4; } //
|
|
149
|
+
for (q = 0; q < qd; q++) { off = _skipName(buf, off); off += 4; } // QTYPE + QCLASS
|
|
150
150
|
var total = an + ns + ar;
|
|
151
151
|
var rrStart = -1;
|
|
152
152
|
for (var r = 0; r < total; r++) {
|
|
153
153
|
rrStart = off;
|
|
154
154
|
off = _skipName(buf, off);
|
|
155
|
-
if (off + 10 > buf.length) throw new TsigError("tsig/truncated", "tsig: truncated RR header"); //
|
|
156
|
-
var rdlen = buf.readUInt16BE(off + 8); //
|
|
157
|
-
off += 10 + rdlen; //
|
|
155
|
+
if (off + 10 > buf.length) throw new TsigError("tsig/truncated", "tsig: truncated RR header"); // type+class+ttl+rdlength
|
|
156
|
+
var rdlen = buf.readUInt16BE(off + 8); // rdlength offset within RR header
|
|
157
|
+
off += 10 + rdlen; // RR fixed header before RDATA
|
|
158
158
|
}
|
|
159
159
|
if (off !== buf.length) throw new TsigError("tsig/trailing-bytes", "tsig: trailing bytes after the final record");
|
|
160
160
|
return rrStart;
|
|
@@ -162,12 +162,12 @@ function _findTsigRr(buf) {
|
|
|
162
162
|
|
|
163
163
|
// Build the TSIG-variables byte block (RFC 8945 §4.3.3).
|
|
164
164
|
function _tsigVariables(keyName, algName, timeSigned, fudge, error, otherData) {
|
|
165
|
-
var time = Buffer.alloc(6); //
|
|
166
|
-
time.writeUIntBE(timeSigned, 0, 6); //
|
|
167
|
-
var head = Buffer.alloc(6); //
|
|
165
|
+
var time = Buffer.alloc(6); // 48-bit time-signed field
|
|
166
|
+
time.writeUIntBE(timeSigned, 0, 6); // 48-bit big-endian
|
|
167
|
+
var head = Buffer.alloc(6); // CLASS(2) + TTL(4)
|
|
168
168
|
head.writeUInt16BE(CLASS_ANY, 0);
|
|
169
169
|
head.writeUInt32BE(0, 2); // TTL is always 0 (4 bytes)
|
|
170
|
-
var tail = Buffer.alloc(6); //
|
|
170
|
+
var tail = Buffer.alloc(6); // fudge(2)+error(2)+otherlen(2)
|
|
171
171
|
tail.writeUInt16BE(fudge, 0);
|
|
172
172
|
tail.writeUInt16BE(error, 2);
|
|
173
173
|
tail.writeUInt16BE(otherData.length, 4);
|
|
@@ -224,7 +224,7 @@ function sign(message, opts) {
|
|
|
224
224
|
var alg = _normAlg(opts.algorithm, opts.allowLegacy === true);
|
|
225
225
|
var secret = _secretBuf(opts.secret);
|
|
226
226
|
var fudge = opts.fudge == null ? DEFAULT_FUDGE : opts.fudge;
|
|
227
|
-
if (typeof fudge !== "number" || !isFinite(fudge) || fudge < 0 || fudge > 0xffff) throw new TsigError("tsig/bad-opt", "tsig.sign: fudge must be 0..65535 seconds"); //
|
|
227
|
+
if (typeof fudge !== "number" || !isFinite(fudge) || fudge < 0 || fudge > 0xffff) throw new TsigError("tsig/bad-opt", "tsig.sign: fudge must be 0..65535 seconds"); // 16-bit fudge field
|
|
228
228
|
var time = opts.time == null ? Math.floor(Date.now() / 1000) : opts.time; // allow:raw-time-literal — ms→s
|
|
229
229
|
if (typeof time !== "number" || !isFinite(time) || time < 0) throw new TsigError("tsig/bad-opt", "tsig.sign: time must be a non-negative Unix-seconds number");
|
|
230
230
|
var error = opts.error == null ? 0 : opts.error;
|
|
@@ -241,25 +241,25 @@ function sign(message, opts) {
|
|
|
241
241
|
|
|
242
242
|
// TSIG RDATA: algorithm name, time signed, fudge, MAC size + MAC,
|
|
243
243
|
// original ID, error, other len + other data.
|
|
244
|
-
var rtime = Buffer.alloc(6); rtime.writeUIntBE(time, 0, 6); //
|
|
245
|
-
var fixed = Buffer.alloc(4); //
|
|
244
|
+
var rtime = Buffer.alloc(6); rtime.writeUIntBE(time, 0, 6); // 48-bit time-signed
|
|
245
|
+
var fixed = Buffer.alloc(4); // fudge(2)+macsize(2)
|
|
246
246
|
fixed.writeUInt16BE(fudge, 0);
|
|
247
247
|
fixed.writeUInt16BE(mac.length, 2);
|
|
248
|
-
var trailer = Buffer.alloc(6); //
|
|
248
|
+
var trailer = Buffer.alloc(6); // origid(2)+error(2)+otherlen(2)
|
|
249
249
|
trailer.writeUInt16BE(originalId, 0);
|
|
250
250
|
trailer.writeUInt16BE(error, 2);
|
|
251
251
|
trailer.writeUInt16BE(otherData.length, 4);
|
|
252
252
|
var rdata = Buffer.concat([_encodeName(algName), rtime, fixed, mac, trailer, otherData]);
|
|
253
253
|
|
|
254
|
-
var rrHead = Buffer.alloc(10); //
|
|
254
|
+
var rrHead = Buffer.alloc(10); // type+class+ttl+rdlength
|
|
255
255
|
rrHead.writeUInt16BE(TYPE_TSIG, 0);
|
|
256
256
|
rrHead.writeUInt16BE(CLASS_ANY, 2);
|
|
257
257
|
rrHead.writeUInt32BE(0, 4); // TTL 0
|
|
258
|
-
rrHead.writeUInt16BE(rdata.length, 8); //
|
|
258
|
+
rrHead.writeUInt16BE(rdata.length, 8); // rdlength offset within the 10-byte RR header
|
|
259
259
|
var tsigRr = Buffer.concat([_encodeName(opts.keyName), rrHead, rdata]);
|
|
260
260
|
|
|
261
261
|
var out = Buffer.from(message); // copy so we can bump ARCOUNT
|
|
262
|
-
out.writeUInt16BE(out.readUInt16BE(10) + 1, 10); //
|
|
262
|
+
out.writeUInt16BE(out.readUInt16BE(10) + 1, 10); // ARCOUNT offset
|
|
263
263
|
return { wire: Buffer.concat([out, tsigRr]), mac: mac };
|
|
264
264
|
}
|
|
265
265
|
|
|
@@ -272,15 +272,15 @@ function _parseTsigRr(buf, rrStart) {
|
|
|
272
272
|
// TTL are outside the signed data — they MUST be validated explicitly or
|
|
273
273
|
// an attacker could flip them in transit and still verify (RFC 8945 §4.2:
|
|
274
274
|
// CLASS = ANY, TTL = 0).
|
|
275
|
-
var rrClass = buf.readUInt16BE(off + 2); //
|
|
276
|
-
var rrTtl = buf.readUInt32BE(off + 4); //
|
|
275
|
+
var rrClass = buf.readUInt16BE(off + 2); // CLASS offset within RR header
|
|
276
|
+
var rrTtl = buf.readUInt32BE(off + 4); // TTL offset within RR header
|
|
277
277
|
if (rrClass !== CLASS_ANY) throw new TsigError("tsig/bad-rr", "tsig: TSIG RR CLASS must be ANY (255), got " + rrClass);
|
|
278
278
|
if (rrTtl !== 0) throw new TsigError("tsig/bad-rr", "tsig: TSIG RR TTL must be 0, got " + rrTtl);
|
|
279
|
-
off += 8; //
|
|
279
|
+
off += 8; // type(2)+class(2)+ttl(4)
|
|
280
280
|
var rdlen = buf.readUInt16BE(off); off += 2;
|
|
281
281
|
var rdStart = off;
|
|
282
282
|
var alg = _readName(buf, off); off = alg.end;
|
|
283
|
-
var timeSigned = buf.readUIntBE(off, 6); off += 6; //
|
|
283
|
+
var timeSigned = buf.readUIntBE(off, 6); off += 6; // 48-bit time-signed
|
|
284
284
|
var fudge = buf.readUInt16BE(off); off += 2;
|
|
285
285
|
var macSize = buf.readUInt16BE(off); off += 2;
|
|
286
286
|
var mac = buf.slice(off, off + macSize); off += macSize;
|
|
@@ -361,7 +361,7 @@ function verify(message, opts) {
|
|
|
361
361
|
// ARCOUNT decremented and the ID restored to the original ID.
|
|
362
362
|
var digestMsg = Buffer.from(message.slice(0, rrStart));
|
|
363
363
|
digestMsg.writeUInt16BE(rr.originalId, 0);
|
|
364
|
-
digestMsg.writeUInt16BE(digestMsg.readUInt16BE(10) - 1, 10); //
|
|
364
|
+
digestMsg.writeUInt16BE(digestMsg.readUInt16BE(10) - 1, 10); // ARCOUNT offset
|
|
365
365
|
|
|
366
366
|
var digest = Buffer.concat([
|
|
367
367
|
_requestMacPrefix(opts.requestMac),
|
|
@@ -375,7 +375,7 @@ function verify(message, opts) {
|
|
|
375
375
|
var macValid = false;
|
|
376
376
|
if (rr.mac.length === expected.length) {
|
|
377
377
|
macValid = timingSafeEqual(rr.mac, expected);
|
|
378
|
-
} else if (rr.mac.length >= Math.max(10, expected.length / 2) && rr.mac.length < expected.length) { //
|
|
378
|
+
} else if (rr.mac.length >= Math.max(10, expected.length / 2) && rr.mac.length < expected.length) { // RFC 8945 §5.2.2.1 minimum truncated-MAC length
|
|
379
379
|
macValid = timingSafeEqual(rr.mac, expected.slice(0, rr.mac.length));
|
|
380
380
|
}
|
|
381
381
|
|
package/lib/nis2-report.js
CHANGED
|
@@ -102,7 +102,7 @@ function create(opts) {
|
|
|
102
102
|
body: Buffer.from(JSON.stringify(payload), "utf8"),
|
|
103
103
|
responseMode: "always-resolve",
|
|
104
104
|
});
|
|
105
|
-
var ok = res.statusCode >= 200 && res.statusCode < 300; //
|
|
105
|
+
var ok = res.statusCode >= 200 && res.statusCode < 300; // HTTP status range
|
|
106
106
|
_emitAudit("submitted", ok ? "success" : "failure", { statusCode: res.statusCode });
|
|
107
107
|
return { submitted: ok, statusCode: res.statusCode };
|
|
108
108
|
} catch (e) {
|
package/lib/ntp-check.js
CHANGED
|
@@ -207,8 +207,8 @@ function querySingle(server, opts) {
|
|
|
207
207
|
return done({ code: "ntp/bad-reply", message: "reply too short (" + (msg && msg.length) + " bytes)" });
|
|
208
208
|
}
|
|
209
209
|
// Bytes 40-47 = Transmit Timestamp (NTP epoch seconds.fraction)
|
|
210
|
-
var ntpSeconds = msg.readUInt32BE(40); //
|
|
211
|
-
var ntpFraction = msg.readUInt32BE(44); //
|
|
210
|
+
var ntpSeconds = msg.readUInt32BE(40); // NTP packet offset
|
|
211
|
+
var ntpFraction = msg.readUInt32BE(44); // NTP packet offset
|
|
212
212
|
// Refuse a reply whose Transmit Timestamp is zero or earlier than
|
|
213
213
|
// the NTP epoch (1900-01-01). RFC 5905 §7.3 — a Stratum-16
|
|
214
214
|
// unsynchronized server emits 0 here; fed to the Unix-offset
|
|
@@ -222,7 +222,7 @@ function querySingle(server, opts) {
|
|
|
222
222
|
message: "server returned NTP transmit timestamp < Unix epoch (likely Stratum-16 unsynchronized)" });
|
|
223
223
|
}
|
|
224
224
|
var serverUnixSeconds = ntpSeconds - NTP_TO_UNIX_OFFSET_SECONDS;
|
|
225
|
-
var fracMs = Math.round(C.TIME.seconds(ntpFraction / 0x100000000)); //
|
|
225
|
+
var fracMs = Math.round(C.TIME.seconds(ntpFraction / 0x100000000)); // NTP fraction divisor (2^32)
|
|
226
226
|
var serverTimeMs = C.TIME.seconds(serverUnixSeconds) + fracMs;
|
|
227
227
|
|
|
228
228
|
// Round-trip-corrected drift: assume the server's reply transmit
|
|
@@ -65,16 +65,16 @@ function _defaultFetchImpl(endpoint, init) {
|
|
|
65
65
|
}).then(function (res) {
|
|
66
66
|
var status = res && res.statusCode;
|
|
67
67
|
return {
|
|
68
|
-
ok: status >= 200 && status < 300, //
|
|
68
|
+
ok: status >= 200 && status < 300, // HTTP status ranges
|
|
69
69
|
status: status,
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
var DEFAULT_BATCH_SIZE = 200; //
|
|
75
|
-
var DEFAULT_MAX_QUEUE_SIZE = 4096; //
|
|
74
|
+
var DEFAULT_BATCH_SIZE = 200; // OTLP recommended batch
|
|
75
|
+
var DEFAULT_MAX_QUEUE_SIZE = 4096; // operator-side queue cap
|
|
76
76
|
var DEFAULT_FLUSH_INTERVAL_MS = C.TIME.seconds(5);
|
|
77
|
-
var DEFAULT_MAX_ATTEMPTS = 3; //
|
|
77
|
+
var DEFAULT_MAX_ATTEMPTS = 3; // retry attempt count
|
|
78
78
|
var DEFAULT_BACKOFF_INITIAL_MS = C.TIME.seconds(1);
|
|
79
79
|
var DEFAULT_BACKOFF_MAX_MS = C.TIME.seconds(30);
|
|
80
80
|
var DEFAULT_TIMEOUT_MS = C.TIME.seconds(30);
|
|
@@ -82,17 +82,17 @@ var DEFAULT_TIMEOUT_MS = C.TIME.seconds(30);
|
|
|
82
82
|
// OTLP severity numbers per §3.5 (logs); not used for traces but
|
|
83
83
|
// retained as a reference for future log-export support.
|
|
84
84
|
var STATUS_CODE_TO_OTLP = Object.freeze({
|
|
85
|
-
unset: 0, //
|
|
86
|
-
ok: 1, //
|
|
87
|
-
error: 2, //
|
|
85
|
+
unset: 0, // OTLP STATUS_CODE_UNSET enum
|
|
86
|
+
ok: 1, // OTLP STATUS_CODE_OK enum
|
|
87
|
+
error: 2, // OTLP STATUS_CODE_ERROR enum
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
var KIND_TO_OTLP = Object.freeze({
|
|
91
|
-
internal: 1, //
|
|
92
|
-
server: 2, //
|
|
93
|
-
client: 3, //
|
|
94
|
-
producer: 4, //
|
|
95
|
-
consumer: 5, //
|
|
91
|
+
internal: 1, // OTLP SPAN_KIND_INTERNAL
|
|
92
|
+
server: 2, // OTLP SPAN_KIND_SERVER
|
|
93
|
+
client: 3, // OTLP SPAN_KIND_CLIENT
|
|
94
|
+
producer: 4, // OTLP SPAN_KIND_PRODUCER
|
|
95
|
+
consumer: 5, // OTLP SPAN_KIND_CONSUMER
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
function _attrToOtlp(attrs) {
|
|
@@ -249,7 +249,7 @@ function _bundleSpans(spans) {
|
|
|
249
249
|
// AnyValue recursion is capped at MAX_ANYVALUE_DEPTH to defend the
|
|
250
250
|
// CVE-2024-7254 + CVE-2025-4565 protobuf nested-group DoS class.
|
|
251
251
|
|
|
252
|
-
var MAX_ANYVALUE_DEPTH = 100; //
|
|
252
|
+
var MAX_ANYVALUE_DEPTH = 100; // protobuf nested-message DoS cap
|
|
253
253
|
|
|
254
254
|
function _hexToBytes(hex) {
|
|
255
255
|
if (typeof hex !== "string" || hex.length === 0) return Buffer.alloc(0);
|
|
@@ -259,7 +259,7 @@ function _hexToBytes(hex) {
|
|
|
259
259
|
if (hex.length % 2 !== 0) return Buffer.alloc(0);
|
|
260
260
|
var out = Buffer.alloc(hex.length / 2);
|
|
261
261
|
for (var i = 0; i < hex.length; i += 2) {
|
|
262
|
-
var byte = parseInt(hex.substr(i, 2), 16); //
|
|
262
|
+
var byte = parseInt(hex.substr(i, 2), 16); // radix=16 for hex parse, not byte count
|
|
263
263
|
if (!isFinite(byte)) return Buffer.alloc(0);
|
|
264
264
|
out[i / 2] = byte;
|
|
265
265
|
}
|
|
@@ -348,7 +348,7 @@ function _spanToProto(span) {
|
|
|
348
348
|
pb.string(5, span.name || ""),
|
|
349
349
|
pb.uint32(6, KIND_TEXT_TO_ENUM[span.kind] != null ? KIND_TEXT_TO_ENUM[span.kind] : KIND_TEXT_TO_ENUM.internal),
|
|
350
350
|
pb.fixed64(7, span.startTimeUnixNano || 0),
|
|
351
|
-
pb.fixed64(8, span.endTimeUnixNano || span.startTimeUnixNano || 0), //
|
|
351
|
+
pb.fixed64(8, span.endTimeUnixNano || span.startTimeUnixNano || 0), // proto field number 8, not bytes
|
|
352
352
|
pb.repeatedMessage(9, _attrsToProto(span.attributes), _keyValueToProto),
|
|
353
353
|
pb.uint32(10, span.droppedAttributesCount || 0),
|
|
354
354
|
eventsRepeated,
|
|
@@ -518,7 +518,7 @@ function create(opts) {
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
function _backoffMs(attempt) {
|
|
521
|
-
var ms = backoffInitial * Math.pow(2, Math.max(0, attempt - 1)); //
|
|
521
|
+
var ms = backoffInitial * Math.pow(2, Math.max(0, attempt - 1)); // exponential factor
|
|
522
522
|
return Math.min(ms, backoffMax);
|
|
523
523
|
}
|
|
524
524
|
|
|
@@ -544,7 +544,7 @@ function create(opts) {
|
|
|
544
544
|
if (res && res.ok) return { ok: true, status: res.status };
|
|
545
545
|
var status = res && res.status;
|
|
546
546
|
// 5xx + 408/429 → retryable; everything else permanent
|
|
547
|
-
var retryable = (status >= 500 && status < 600) || status === 408 || status === 429; //
|
|
547
|
+
var retryable = (status >= 500 && status < 600) || status === 408 || status === 429; // HTTP status ranges
|
|
548
548
|
if (retryable && attempt < maxAttempts) {
|
|
549
549
|
await _sleep(_backoffMs(attempt));
|
|
550
550
|
return await _post(payload, attempt + 1);
|
|
@@ -86,9 +86,9 @@ var TracerError = defineClass("TracerError", { alwaysPermanent: true });
|
|
|
86
86
|
|
|
87
87
|
var observability = lazyRequire(function () { return require("./observability"); });
|
|
88
88
|
|
|
89
|
-
var DEFAULT_MAX_ATTRIBUTES = 128; //
|
|
90
|
-
var DEFAULT_MAX_EVENTS = 128; //
|
|
91
|
-
var DEFAULT_MAX_ATTR_VALUE_LEN = 1024; //
|
|
89
|
+
var DEFAULT_MAX_ATTRIBUTES = 128; // OTLP default span attribute cap
|
|
90
|
+
var DEFAULT_MAX_EVENTS = 128; // OTLP default span event cap
|
|
91
|
+
var DEFAULT_MAX_ATTR_VALUE_LEN = 1024; // OTLP attribute value char cap
|
|
92
92
|
|
|
93
93
|
var VALID_KINDS = ["internal", "server", "client", "producer", "consumer"];
|
|
94
94
|
var VALID_STATUS_CODES = ["unset", "ok", "error"];
|
|
@@ -99,7 +99,7 @@ function _msToUnixNano(ms) {
|
|
|
99
99
|
// OTLP timestamps are uint64 nanoseconds since Unix epoch. JS Date.now()
|
|
100
100
|
// gives ms; multiply by 1e6 and stringify (OTLP/JSON uses string for
|
|
101
101
|
// uint64 values per https://protobuf.dev/programming-guides/proto3/#json).
|
|
102
|
-
return String(BigInt(ms) * 1000000n); //
|
|
102
|
+
return String(BigInt(ms) * 1000000n); // ms→ns conversion factor (1e6)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
function _truncateAttrValue(v, maxLen) {
|
|
@@ -123,7 +123,7 @@ function _validateAttrKey(key) {
|
|
|
123
123
|
if (typeof key !== "string" || key.length === 0) return false;
|
|
124
124
|
// OTel attribute keys: ASCII printable, dot-separated, no spaces
|
|
125
125
|
// beyond what the SEMCONV vocabulary uses.
|
|
126
|
-
if (key.length > 255) return false; //
|
|
126
|
+
if (key.length > 255) return false; // OTLP attribute key cap
|
|
127
127
|
return true;
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -295,7 +295,7 @@ function create(opts) {
|
|
|
295
295
|
kind: kind,
|
|
296
296
|
startTimeUnixNano: _msToUnixNano(startMs),
|
|
297
297
|
endTimeUnixNano: endNano,
|
|
298
|
-
durationNs: endNano !== null ? String(BigInt(durationMs) * 1000000n) : null, //
|
|
298
|
+
durationNs: endNano !== null ? String(BigInt(durationMs) * 1000000n) : null, // ms→ns conversion factor (1e6)
|
|
299
299
|
durationMs: durationMs,
|
|
300
300
|
attributes: Object.assign({}, attributes),
|
|
301
301
|
events: events.slice(),
|
package/lib/observability.js
CHANGED
|
@@ -429,11 +429,11 @@ var _TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2}
|
|
|
429
429
|
var _ALL_ZERO_TRACE = "00000000000000000000000000000000";
|
|
430
430
|
var _ALL_ZERO_PARENT = "0000000000000000";
|
|
431
431
|
|
|
432
|
-
var _HEX_RADIX = 16; //
|
|
432
|
+
var _HEX_RADIX = 16; // Number.parseInt radix
|
|
433
433
|
var _TRACE_FLAG_SAMPLED = 0x01; // W3C Trace Context §3.2.2.5 sampled bit
|
|
434
|
-
var _TRACE_ID_BYTES = 16; //
|
|
435
|
-
var _PARENT_ID_BYTES = 8; //
|
|
436
|
-
var _FLAGS_HEX_LEN = 2; //
|
|
434
|
+
var _TRACE_ID_BYTES = 16; // W3C Trace Context §3.2.2.3 (16 bytes)
|
|
435
|
+
var _PARENT_ID_BYTES = 8; // W3C Trace Context §3.2.2.4 (8 bytes)
|
|
436
|
+
var _FLAGS_HEX_LEN = 2; // W3C Trace Context flags are 1 byte = 2 hex chars
|
|
437
437
|
|
|
438
438
|
function _parseTraceparent(headerValue) {
|
|
439
439
|
if (typeof headerValue !== "string" || headerValue.length === 0) return null;
|
|
@@ -497,8 +497,8 @@ function _newParentId() {
|
|
|
497
497
|
// - duplicate keys: keep first, drop rest
|
|
498
498
|
var _TRACESTATE_KEY_RE = /^[a-z0-9][a-z0-9_\-*/]{0,255}(@[a-z0-9][a-z0-9_\-*/]{0,255})?$/;
|
|
499
499
|
var _TRACESTATE_VALUE_RE = /^[\x20-\x2B\x2D-\x3C\x3E-\x7E]{1,256}$/; // printable, no "," or "="
|
|
500
|
-
var _TRACESTATE_MAX_ENTRIES = 32; //
|
|
501
|
-
var _TRACESTATE_MAX_CHARS = 512; //
|
|
500
|
+
var _TRACESTATE_MAX_ENTRIES = 32; // W3C spec hard cap (§3.3.1.3)
|
|
501
|
+
var _TRACESTATE_MAX_CHARS = 512; // W3C spec hard cap (§3.3.1.3)
|
|
502
502
|
|
|
503
503
|
function _parseTracestate(headerValue) {
|
|
504
504
|
if (typeof headerValue !== "string") return null;
|
|
@@ -583,7 +583,7 @@ var traceContext = {
|
|
|
583
583
|
// - max 8192 chars total (W3C recommended cap)
|
|
584
584
|
// Resolved at first call; lazyRequire returns a function.
|
|
585
585
|
function _baggageTokenRe() { return safeBuffer().RFC7230_TCHAR_RE; }
|
|
586
|
-
var _BAGGAGE_MAX_ENTRIES = 64; //
|
|
586
|
+
var _BAGGAGE_MAX_ENTRIES = 64; // W3C Baggage recommended cap
|
|
587
587
|
var _BAGGAGE_MAX_CHARS = C.BYTES.kib(8); // W3C Baggage recommended 8192-char cap
|
|
588
588
|
|
|
589
589
|
function _parseBaggage(headerValue) {
|
|
@@ -603,7 +603,7 @@ function _parseBaggage(headerValue) {
|
|
|
603
603
|
var key = head.slice(0, eqIdx).trim();
|
|
604
604
|
var rawValue = head.slice(eqIdx + 1).trim();
|
|
605
605
|
if (!_baggageTokenRe().test(key)) return null; // allow:regex-no-length-cap — RFC 7230 tchar; bound by header-cap
|
|
606
|
-
if (key.length > 255) return null; //
|
|
606
|
+
if (key.length > 255) return null; // W3C key length cap
|
|
607
607
|
var value;
|
|
608
608
|
try { value = decodeURIComponent(rawValue); }
|
|
609
609
|
catch (_e) { return null; }
|
package/lib/openapi-yaml.js
CHANGED
|
@@ -47,7 +47,7 @@ function _quoteString(str) {
|
|
|
47
47
|
else if (code === 0x0a) out += "\\n";
|
|
48
48
|
else if (code === 0x0d) out += "\\r";
|
|
49
49
|
else if (code === 0x09) out += "\\t";
|
|
50
|
-
else if (code < 0x20) out += "\\u" + code.toString(16).padStart(4, "0"); //
|
|
50
|
+
else if (code < 0x20) out += "\\u" + code.toString(16).padStart(4, "0"); // codepoint hex padding
|
|
51
51
|
else out += ch;
|
|
52
52
|
}
|
|
53
53
|
out += '"';
|
package/lib/openapi.js
CHANGED
|
@@ -332,7 +332,7 @@ function create(opts) {
|
|
|
332
332
|
var mw = function (req, res, next) {
|
|
333
333
|
if (typeof res.writeHead !== "function") return next();
|
|
334
334
|
var body = cachedString;
|
|
335
|
-
res.writeHead(200, { //
|
|
335
|
+
res.writeHead(200, { // HTTP 200 status
|
|
336
336
|
"Content-Type": "application/json; charset=utf-8",
|
|
337
337
|
"Content-Length": Buffer.byteLength(body),
|
|
338
338
|
"Cache-Control": cacheControl,
|
package/lib/outbox.js
CHANGED
|
@@ -79,11 +79,11 @@ var audit = lazyRequire(function () { return require("./audit"); });
|
|
|
79
79
|
var observability = lazyRequire(function () { return require("./observability"); });
|
|
80
80
|
|
|
81
81
|
var DEFAULT_POLL_MS = C.TIME.seconds(1);
|
|
82
|
-
var DEFAULT_BATCH_SIZE = 100; //
|
|
83
|
-
var DEFAULT_MAX_ATTEMPTS = 10; //
|
|
82
|
+
var DEFAULT_BATCH_SIZE = 100; // row count, not bytes
|
|
83
|
+
var DEFAULT_MAX_ATTEMPTS = 10; // attempt count, not bytes
|
|
84
84
|
var DEFAULT_BACKOFF_INITIAL = C.TIME.seconds(1);
|
|
85
85
|
var DEFAULT_BACKOFF_MAX = C.TIME.minutes(5);
|
|
86
|
-
var DEFAULT_BACKOFF_FACTOR = 2; //
|
|
86
|
+
var DEFAULT_BACKOFF_FACTOR = 2; // multiplier, not bytes
|
|
87
87
|
var TOPIC_MAX_LEN = C.BYTES.bytes(255);
|
|
88
88
|
var KEY_MAX_LEN = C.BYTES.bytes(255);
|
|
89
89
|
|
|
@@ -115,7 +115,7 @@ function _utcNowExpr(externalDb) {
|
|
|
115
115
|
// "operator-supplied JSON object" by default. Operators integrating
|
|
116
116
|
// with Confluent Schema Registry attach `event.debezium.schema` to
|
|
117
117
|
// override per-event.
|
|
118
|
-
var DEFAULT_DEBEZIUM_CONNECTOR_VERSION = "1.0.0"; //
|
|
118
|
+
var DEFAULT_DEBEZIUM_CONNECTOR_VERSION = "1.0.0"; // version string
|
|
119
119
|
|
|
120
120
|
function _debeziumSchemaFor(payloadObj) {
|
|
121
121
|
// Best-effort schema synthesis. Debezium consumers expect a JSON
|
|
@@ -439,7 +439,7 @@ function create(opts) {
|
|
|
439
439
|
"UPDATE " + quotedTable +
|
|
440
440
|
" SET status = 'pending', attempts = $1, last_error = $2, next_attempt_at = $3" +
|
|
441
441
|
" WHERE id = $4",
|
|
442
|
-
[attempts + 1, String(errMsg).slice(0, 1024), nextAt, id] //
|
|
442
|
+
[attempts + 1, String(errMsg).slice(0, 1024), nextAt, id] // error-message char cap
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
|
|
@@ -447,7 +447,7 @@ function create(opts) {
|
|
|
447
447
|
await externalDb.query(
|
|
448
448
|
"UPDATE " + quotedTable +
|
|
449
449
|
" SET status = 'dead', attempts = $1, last_error = $2 WHERE id = $3",
|
|
450
|
-
[attempts + 1, String(errMsg).slice(0, 1024), id] //
|
|
450
|
+
[attempts + 1, String(errMsg).slice(0, 1024), id] // error-message char cap
|
|
451
451
|
);
|
|
452
452
|
_emitAudit("system.outbox.deadletter", "failure", { id: id, attempts: attempts + 1 });
|
|
453
453
|
_emitMetric("dead-letter", 1);
|
package/lib/pqc-agent.js
CHANGED
|
@@ -52,9 +52,9 @@ var KNOWN_TLS_GROUPS = Object.freeze([
|
|
|
52
52
|
"SecP256r1MLKEM768", // RFC 9794 0x11EB
|
|
53
53
|
// Classical groups (operator opt-in only)
|
|
54
54
|
"X25519",
|
|
55
|
-
"secp256r1", //
|
|
56
|
-
"secp384r1", //
|
|
57
|
-
"secp521r1", //
|
|
55
|
+
"secp256r1", // IANA TLS group name (P-256), not bytes
|
|
56
|
+
"secp384r1", // IANA TLS group name (P-384), not bytes
|
|
57
|
+
"secp521r1", // IANA TLS group name (P-521), not bytes
|
|
58
58
|
"X448",
|
|
59
59
|
]);
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ function _validateGroupName(name) {
|
|
|
62
62
|
// Same shape as network-tls._validateKeyShare: alphanumeric +
|
|
63
63
|
// underscore, bounded length. Refuses `:` so an operator can't
|
|
64
64
|
// smuggle a second group through one slot.
|
|
65
|
-
if (typeof name !== "string" || name.length === 0 || name.length > 64) { //
|
|
65
|
+
if (typeof name !== "string" || name.length === 0 || name.length > 64) { // string-length cap, not bytes
|
|
66
66
|
throw new TypeError(
|
|
67
67
|
"pqc-agent: ecdhCurve group entries must be non-empty strings up to 64 chars"
|
|
68
68
|
);
|
package/lib/pqc-software.js
CHANGED
|
@@ -251,7 +251,7 @@ function runKnownAnswerTest() {
|
|
|
251
251
|
if (!ssAlice || !ssBob) {
|
|
252
252
|
return { ok: false, reason: "keygen/encapsulate/decapsulate returned falsy" };
|
|
253
253
|
}
|
|
254
|
-
if (ssAlice.length !== 32 || ssBob.length !== 32) { //
|
|
254
|
+
if (ssAlice.length !== 32 || ssBob.length !== 32) { // FIPS 203 §1 K_size = 32 bytes
|
|
255
255
|
return { ok: false, reason: "shared-secret length mismatch (expected 32 bytes)" };
|
|
256
256
|
}
|
|
257
257
|
// Constant-time compare via the framework wrapper. The KAT runs
|
package/lib/privacy-pass.js
CHANGED
|
@@ -44,17 +44,17 @@ var PrivacyPassError = defineClass("PrivacyPassError", { alwaysPermanent: true }
|
|
|
44
44
|
var TOKEN_TYPE_BLIND_RSA = 0x0002;
|
|
45
45
|
// RFC 9578 §5.3 token type 0x0002: RSABSSA-SHA384-PSS, salt length 48.
|
|
46
46
|
var PSS_HASH = "sha384";
|
|
47
|
-
var PSS_SALT_LEN = 48; //
|
|
47
|
+
var PSS_SALT_LEN = 48; // RFC 9578 §5.3 PSS salt length (= SHA-384 digest size)
|
|
48
48
|
// Fixed-size token fields (RFC 9577 §2.2): type(2) nonce(32)
|
|
49
49
|
// challenge_digest(32) token_key_id(32), then the authenticator.
|
|
50
|
-
var TOKEN_PREFIX_LEN = 98; //
|
|
50
|
+
var TOKEN_PREFIX_LEN = 98; // 2 + 32 + 32 + 32 (token_input length)
|
|
51
51
|
|
|
52
52
|
// RFC 9577 §2.1 sends the challenge / token-key auth-params as base64url
|
|
53
53
|
// WITH padding; Node's "base64url" output is unpadded, so pad to a
|
|
54
54
|
// multiple of 4 so strict clients / proxies accept the header.
|
|
55
55
|
function _b64urlPadded(buf) {
|
|
56
56
|
var s = Buffer.from(buf).toString("base64url");
|
|
57
|
-
while (s.length % 4 !== 0) s += "="; //
|
|
57
|
+
while (s.length % 4 !== 0) s += "="; // base64 quantum is 4 chars
|
|
58
58
|
return s;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -164,7 +164,7 @@ function verifyToken(opts) {
|
|
|
164
164
|
|
|
165
165
|
var parsed = parseToken(opts.token);
|
|
166
166
|
if (parsed.tokenType !== TOKEN_TYPE_BLIND_RSA) {
|
|
167
|
-
throw new PrivacyPassError("privacy-pass/unsupported-token-type", "privacyPass.verifyToken: only token type 0x0002 (Blind RSA) is verifiable by the origin; got 0x" + parsed.tokenType.toString(16).padStart(4, "0")); //
|
|
167
|
+
throw new PrivacyPassError("privacy-pass/unsupported-token-type", "privacyPass.verifyToken: only token type 0x0002 (Blind RSA) is verifiable by the origin; got 0x" + parsed.tokenType.toString(16).padStart(4, "0")); // base-16 radix + 4-hex-digit pad, not a size
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
var imported = _importIssuerKey(opts.issuerPublicKey);
|
|
@@ -240,7 +240,7 @@ function buildChallenge(opts) {
|
|
|
240
240
|
if (origin.length > 0xffff) throw new PrivacyPassError("privacy-pass/bad-arg", "privacyPass.buildChallenge: originInfo too long");
|
|
241
241
|
}
|
|
242
242
|
var rc = opts.redemptionContext !== undefined && opts.redemptionContext !== null ? _bytes(opts.redemptionContext, "redemptionContext") : Buffer.alloc(0);
|
|
243
|
-
if (rc.length !== 0 && rc.length !== 32) throw new PrivacyPassError("privacy-pass/bad-arg", "privacyPass.buildChallenge: redemptionContext must be empty or 32 bytes"); //
|
|
243
|
+
if (rc.length !== 0 && rc.length !== 32) throw new PrivacyPassError("privacy-pass/bad-arg", "privacyPass.buildChallenge: redemptionContext must be empty or 32 bytes"); // RFC 9577 redemption_context is 0 or 32 bytes
|
|
244
244
|
|
|
245
245
|
var u16 = function (n) { return Buffer.from([(n >> 8) & 0xff, n & 0xff]); };
|
|
246
246
|
var challenge = Buffer.concat([
|
package/lib/problem-details.js
CHANGED
|
@@ -188,7 +188,7 @@ function create(opts) {
|
|
|
188
188
|
// status (§3.1.3 — integer 100..599)
|
|
189
189
|
if (opts.status !== undefined) {
|
|
190
190
|
if (typeof opts.status !== "number" || !Number.isInteger(opts.status) ||
|
|
191
|
-
opts.status < 100 || opts.status > 599) { //
|
|
191
|
+
opts.status < 100 || opts.status > 599) { // HTTP status range bounds
|
|
192
192
|
throw new ProblemDetailsError("problem-details/bad-status",
|
|
193
193
|
"create: status must be an integer 100..599 when provided", true);
|
|
194
194
|
}
|
|
@@ -293,10 +293,10 @@ function fromError(err, opts2) {
|
|
|
293
293
|
if (opts2.status !== undefined) {
|
|
294
294
|
status = opts2.status;
|
|
295
295
|
} else if (typeof err.statusCode === "number" && Number.isInteger(err.statusCode) &&
|
|
296
|
-
err.statusCode >= 100 && err.statusCode <= 599) { //
|
|
296
|
+
err.statusCode >= 100 && err.statusCode <= 599) { // HTTP status range
|
|
297
297
|
status = err.statusCode;
|
|
298
298
|
} else {
|
|
299
|
-
status = 500; //
|
|
299
|
+
status = 500; // default HTTP status 500 (Internal Server Error)
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
var built = {
|
|
@@ -350,7 +350,7 @@ function respond(res, problem) {
|
|
|
350
350
|
"respond: problem must be a non-null object", true);
|
|
351
351
|
}
|
|
352
352
|
var status = (typeof problem.status === "number" && Number.isInteger(problem.status) &&
|
|
353
|
-
problem.status >= 100 && problem.status <= 599) ? problem.status : 500; //
|
|
353
|
+
problem.status >= 100 && problem.status <= 599) ? problem.status : 500; // HTTP status range + default 500
|
|
354
354
|
var body = JSON.stringify(problem);
|
|
355
355
|
res.statusCode = status;
|
|
356
356
|
res.setHeader("Content-Type", "application/problem+json");
|
|
@@ -440,7 +440,7 @@ function validate(doc) {
|
|
|
440
440
|
}
|
|
441
441
|
if (doc.status !== undefined) {
|
|
442
442
|
if (typeof doc.status !== "number" || !Number.isInteger(doc.status) ||
|
|
443
|
-
doc.status < 100 || doc.status > 599) { //
|
|
443
|
+
doc.status < 100 || doc.status > 599) { // HTTP status range
|
|
444
444
|
throw new ProblemDetailsError("problem-details/bad-inbound",
|
|
445
445
|
"validate: status must be an integer 100..599 when present", true);
|
|
446
446
|
}
|
package/lib/promise-pool.js
CHANGED
|
@@ -45,7 +45,7 @@ var { defineClass } = require("./framework-error");
|
|
|
45
45
|
|
|
46
46
|
var PromisePoolError = defineClass("PromisePoolError", { alwaysPermanent: true });
|
|
47
47
|
|
|
48
|
-
var MAX_CONCURRENCY = 65536; //
|
|
48
|
+
var MAX_CONCURRENCY = 65536; // uint16 ceiling on parallel I/O fan-out
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @primitive b.promisePool.create
|
package/lib/protobuf-encoder.js
CHANGED
|
@@ -82,6 +82,14 @@ function _writeVarint(value) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function _tag(fieldNumber, wireType) {
|
|
85
|
+
// `fieldNumber << 3` uses JS's 32-bit signed shift, which overflows and
|
|
86
|
+
// emits a wrong tag once fieldNumber reaches 2^28. Reject anything outside
|
|
87
|
+
// the safe single-shift range rather than encode silently wrong — the OTLP
|
|
88
|
+
// schema this serves uses small field numbers well within it.
|
|
89
|
+
if (fieldNumber < 1 || fieldNumber > 268435455) { // 2^28 - 1
|
|
90
|
+
throw new RangeError("protobuf: field number " + fieldNumber +
|
|
91
|
+
" out of range (1..2^28-1)");
|
|
92
|
+
}
|
|
85
93
|
return _writeVarint((fieldNumber << 3) | wireType);
|
|
86
94
|
}
|
|
87
95
|
|
|
@@ -168,7 +176,7 @@ function fixed64(fieldNumber, value) {
|
|
|
168
176
|
}
|
|
169
177
|
for (var ci = 0; ci < value.length; ci += 1) {
|
|
170
178
|
var cc = value.charCodeAt(ci);
|
|
171
|
-
if (cc < 0x30 || cc > 0x39) { //
|
|
179
|
+
if (cc < 0x30 || cc > 0x39) { // ASCII '0' (0x30) .. '9' (0x39)
|
|
172
180
|
throw new Error("protobuf-encoder: fixed64 string must be unsigned digit-only (got " + JSON.stringify(value) + ")");
|
|
173
181
|
}
|
|
174
182
|
}
|
package/lib/queue.js
CHANGED
|
@@ -417,8 +417,10 @@ function consume(queueName, handler, opts) {
|
|
|
417
417
|
}
|
|
418
418
|
var jobs;
|
|
419
419
|
try { jobs = await b.lease(queueName, leaseDurationMs, slots); }
|
|
420
|
-
catch {
|
|
421
|
-
// Backend down (breaker open, etc.) — back off
|
|
420
|
+
catch (e) {
|
|
421
|
+
// Backend down (breaker open, etc.) — log + back off so a flapping
|
|
422
|
+
// backend that hasn't yet tripped the breaker is still visible.
|
|
423
|
+
log.debug("lease-failed", { op: "b.lease", queue: queueName, error: e.message });
|
|
422
424
|
await _pollSleep(pollIntervalMs);
|
|
423
425
|
continue;
|
|
424
426
|
}
|