@blamejs/core 0.14.1 → 0.14.3
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 +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 +5 -5
- 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 +9 -9
- 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
|
@@ -104,7 +104,7 @@ function tokenize(name) {
|
|
|
104
104
|
return n.split(" ").filter(function (t) { return t.length > 0; });
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
var MAX_INPUT_LEN = 512; //
|
|
107
|
+
var MAX_INPUT_LEN = 512; // name length sanity cap (operators can override fuzzy.create)
|
|
108
108
|
|
|
109
109
|
// ---- Levenshtein with cap + early-exit ----
|
|
110
110
|
|
|
@@ -155,7 +155,7 @@ function jaro(a, b) {
|
|
|
155
155
|
if (typeof a !== "string" || typeof b !== "string") return 0;
|
|
156
156
|
if (a === b) return a.length === 0 ? 0 : 1;
|
|
157
157
|
if (a.length === 0 || b.length === 0) return 0;
|
|
158
|
-
var matchWindow = Math.max(0, Math.floor(Math.max(a.length, b.length) / 2) - 1); //
|
|
158
|
+
var matchWindow = Math.max(0, Math.floor(Math.max(a.length, b.length) / 2) - 1); // Jaro match-window formula
|
|
159
159
|
var aMatched = new Array(a.length).fill(false);
|
|
160
160
|
var bMatched = new Array(b.length).fill(false);
|
|
161
161
|
var matches = 0;
|
|
@@ -183,7 +183,7 @@ function jaro(a, b) {
|
|
|
183
183
|
}
|
|
184
184
|
var transpositions = t / 2;
|
|
185
185
|
return (matches / a.length + matches / b.length +
|
|
186
|
-
(matches - transpositions) / matches) / 3; //
|
|
186
|
+
(matches - transpositions) / matches) / 3; // Jaro 3-term formula
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
function jaroWinkler(a, b, prefixWeight) {
|
|
@@ -198,7 +198,7 @@ function jaroWinkler(a, b, prefixWeight) {
|
|
|
198
198
|
var j = jaro(a, b);
|
|
199
199
|
if (j === 0) return 0;
|
|
200
200
|
// Common prefix up to 4 chars (Winkler's cap)
|
|
201
|
-
var maxPrefix = 4; //
|
|
201
|
+
var maxPrefix = 4; // Jaro-Winkler prefix cap (Winkler 1990)
|
|
202
202
|
var prefixLen = 0;
|
|
203
203
|
var max = Math.min(a.length, b.length, maxPrefix);
|
|
204
204
|
for (var i = 0; i < max; i++) {
|
|
@@ -274,7 +274,7 @@ function create(opts) {
|
|
|
274
274
|
VALID_STRATEGIES.join(", "));
|
|
275
275
|
}
|
|
276
276
|
var maxLevenshtein = (typeof fuzzyOpts.maxLevenshtein === "number" && isFinite(fuzzyOpts.maxLevenshtein))
|
|
277
|
-
? fuzzyOpts.maxLevenshtein : 3; //
|
|
277
|
+
? fuzzyOpts.maxLevenshtein : 3; // default edit-distance cap (operator-tunable)
|
|
278
278
|
var auditOn = opts.audit !== false;
|
|
279
279
|
var ruleVersion = opts.ruleVersion || ("entries:" + opts.entries.length);
|
|
280
280
|
|
|
@@ -327,10 +327,10 @@ function create(opts) {
|
|
|
327
327
|
}
|
|
328
328
|
// Substring containment scores 0.92 (high but below exact)
|
|
329
329
|
if (fuzzy.substringContains(name, qNorm)) {
|
|
330
|
-
if (0.92 > bestScore) { bestScore = 0.92; bestName = name; } //
|
|
330
|
+
if (0.92 > bestScore) { bestScore = 0.92; bestName = name; } // substring-match score weight
|
|
331
331
|
}
|
|
332
332
|
if (fuzzy.substringContains(qNorm, name)) {
|
|
333
|
-
if (0.92 > bestScore) { bestScore = 0.92; bestName = name; } //
|
|
333
|
+
if (0.92 > bestScore) { bestScore = 0.92; bestName = name; } // substring-match score weight
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
return { score: bestScore, name: bestName };
|
|
@@ -491,7 +491,7 @@ function create(opts) {
|
|
|
491
491
|
algorithm: algorithm,
|
|
492
492
|
ruleVersion: ruleVersion,
|
|
493
493
|
entryCount: index.length,
|
|
494
|
-
digest: hash.digest("hex").slice(0, 32), //
|
|
494
|
+
digest: hash.digest("hex").slice(0, 32), // first 32 hex chars (128 bits) of SHA-3 digest, sufficient for snapshot identity
|
|
495
495
|
digestAlg: "sha3-512-trunc128",
|
|
496
496
|
capturedAt: Date.now(),
|
|
497
497
|
};
|
package/lib/compliance.js
CHANGED
|
@@ -93,14 +93,14 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
93
93
|
"tcpa-10dlc", // TCPA 10DLC carrier-shaped consent + FCC 1:1 disclosure
|
|
94
94
|
"fda-21cfr11", // FDA 21 CFR Part 11 — audit-trail + electronic signatures (general-purpose subset)
|
|
95
95
|
"fda-annex-11", // EU GMP Annex 11 — computerized systems (Part-11 equivalent)
|
|
96
|
-
"sec-1.05", // SEC Cybersecurity Disclosure Item 1.05 — material-incident 8-K filing //
|
|
96
|
+
"sec-1.05", // SEC Cybersecurity Disclosure Item 1.05 — material-incident 8-K filing // regulatory identifier, not bytes
|
|
97
97
|
// ---- US state student-data privacy (F5.1 posture group) ----
|
|
98
98
|
"ny-2-d", // NY Education Law §2-d
|
|
99
99
|
"il-soppa", // Illinois Student Online Personal Protection Act
|
|
100
100
|
"ca-sopipa", // California Student Online Personal Information Protection Act
|
|
101
101
|
"ct-pa-5-2", // Connecticut Public Act 5-2
|
|
102
|
-
"tx-hb-4504", // Texas HB 4504 //
|
|
103
|
-
"va-sb-1376", // Virginia SB 1376 //
|
|
102
|
+
"tx-hb-4504", // Texas HB 4504 // statute identifier, not bytes
|
|
103
|
+
"va-sb-1376", // Virginia SB 1376 // statute identifier, not bytes
|
|
104
104
|
// ---- EU government / cloud-region ----
|
|
105
105
|
"staterramp", // StateRAMP / TX-RAMP / AZ-RAMP / GovRAMP family (FedRAMP-Moderate cross-walks)
|
|
106
106
|
"irap", // Australia IRAP / Essential Eight / ISM
|
|
@@ -149,7 +149,7 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
149
149
|
"il-hb3773", // Illinois HB 3773 — IHRA AI amendment (effective 2026-01-01)
|
|
150
150
|
"tx-traiga", // Texas Responsible AI Governance Act HB 149 (effective 2026-01-01)
|
|
151
151
|
"ut-aipa", // Utah AI Disclosure Act (UAIPA + 2025 amendments; sunset 2027-07-01)
|
|
152
|
-
"nyc-ll144", // NYC Local Law 144 — Automated Employment Decision Tools (in force) //
|
|
152
|
+
"nyc-ll144", // NYC Local Law 144 — Automated Employment Decision Tools (in force) // regulatory identifier, not bytes
|
|
153
153
|
"ca-tfaia", // California SB 53 — Transparency in Frontier AI Act (effective 2026-01-01)
|
|
154
154
|
"kr-ai-basic", // South Korea AI Basic Act (effective 2026-01-22)
|
|
155
155
|
"cn-ai-label", // China Measures for Labelling of AI-Generated Content (effective 2025-09-01)
|
|
@@ -157,8 +157,8 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
157
157
|
"iso-42001", // ISO/IEC 42001:2023 — AI Management System
|
|
158
158
|
"iso-23894", // ISO/IEC 23894:2023 — AI Risk Management Guidance
|
|
159
159
|
// ---- v0.8.81 expansion — content-credentials posture flags ----
|
|
160
|
-
"ca-sb942", // California SB-942 (Cal. Bus. & Prof. Code §22757) gen-AI disclosure (effective 2026-08-02) //
|
|
161
|
-
"ca-ab853", // California AB-853 platform-side gen-AI detection (effective 2026-08-02) //
|
|
160
|
+
"ca-sb942", // California SB-942 (Cal. Bus. & Prof. Code §22757) gen-AI disclosure (effective 2026-08-02) // regulatory identifier + date, not bytes
|
|
161
|
+
"ca-ab853", // California AB-853 platform-side gen-AI detection (effective 2026-08-02) // regulatory identifier + date, not bytes
|
|
162
162
|
// ---- v0.8.81 expansion — substrate-to-posture cleanup ----
|
|
163
163
|
"eaa", // EU Accessibility Act / Directive (EU) 2019/882 (effective 2025-06-28)
|
|
164
164
|
"wcag-2-2", // W3C Web Content Accessibility Guidelines 2.2 (Oct 2023 Recommendation)
|
|
@@ -170,7 +170,7 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
170
170
|
// US federal child / financial privacy
|
|
171
171
|
"coppa", // Children's Online Privacy Protection Act (15 U.S.C. §6501)
|
|
172
172
|
"coppa-2025", // COPPA 2025 Amendment (FTC final 2025-04-22; effective 2026-06-23 — biometric expansion + knowing-collection disclosure)
|
|
173
|
-
"glba-safeguards", // GLBA Safeguards Rule 2024 Amendment (16 CFR Part 314 — effective 2024-05-13) //
|
|
173
|
+
"glba-safeguards", // GLBA Safeguards Rule 2024 Amendment (16 CFR Part 314 — effective 2024-05-13) // CFR title number, not bytes
|
|
174
174
|
// UK
|
|
175
175
|
"uk-duaa", // UK Data (Use and Access) Act 2025 (Royal Assent 2025-06-19; replaces DPDI Bill)
|
|
176
176
|
// Latin America
|
|
@@ -199,7 +199,7 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
199
199
|
"nist-pf-1.1", // NIST Privacy Framework 1.1 (final 2025-04-14)
|
|
200
200
|
// EU non-personal-data + adjacent
|
|
201
201
|
"dsa", // EU Digital Services Act (Regulation 2022/2065; fully applicable 2024-02-17)
|
|
202
|
-
"dga", // EU Data Governance Act (Regulation 2022/868; applicable 2023-09-24) //
|
|
202
|
+
"dga", // EU Data Governance Act (Regulation 2022/868; applicable 2023-09-24) // calendar day, not bytes
|
|
203
203
|
"eu-cer", // EU Critical Entities Resilience Directive (2022/2557; transposition 2024-10-17)
|
|
204
204
|
"eu-cyber-sol", // EU Cyber Solidarity Act (Regulation 2025/38; effective 2025-02-04)
|
|
205
205
|
"eidas-2", // eIDAS 2 / EUDI Wallet (Regulation 2024/1183; rollout 2026-2027)
|
|
@@ -211,7 +211,7 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
211
211
|
"iso-27017", // ISO/IEC 27017 — Cloud-services security controls
|
|
212
212
|
"iso-27018", // ISO/IEC 27018 — PII protection in public-cloud processors
|
|
213
213
|
"iso-27701", // ISO/IEC 27701 — Privacy Information Management System
|
|
214
|
-
"nist-800-66-r2", // NIST SP 800-66 Rev 2 — HIPAA Security Rule implementation guidance //
|
|
214
|
+
"nist-800-66-r2", // NIST SP 800-66 Rev 2 — HIPAA Security Rule implementation guidance // NIST publication number, not bytes
|
|
215
215
|
"ehds", // EU European Health Data Space (Regulation 2025/327; phased 2027-2029)
|
|
216
216
|
"circia", // US Cyber Incident Reporting for Critical Infrastructure Act (final rule pending)
|
|
217
217
|
// ---- v0.9.6 expansion — exceptd framework-control-gap closure ----
|
|
@@ -224,16 +224,16 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
224
224
|
// the named regime's evidence expectations.
|
|
225
225
|
"nist-800-53", // NIST SP 800-53 Rev 5 — full Moderate / High baseline
|
|
226
226
|
"nist-ai-rmf-1.0", // NIST AI Risk Management Framework 1.0
|
|
227
|
-
"iso-42001-2023", // ISO/IEC 42001:2023 — AI management system (alias for v0.8.81 iso-42001 entry, kept for posture-vocabulary stability) //
|
|
227
|
+
"iso-42001-2023", // ISO/IEC 42001:2023 — AI management system (alias for v0.8.81 iso-42001 entry, kept for posture-vocabulary stability) // standard publication year, not bytes
|
|
228
228
|
"iso-23894-2023", // ISO/IEC 23894:2023 — AI risk management guidance (alias)
|
|
229
229
|
"owasp-llm-top-10-2025", // OWASP Top 10 for LLM Applications 2025
|
|
230
230
|
"owasp-asvs-v5.0", // OWASP Application Security Verification Standard v5.0
|
|
231
|
-
"nist-800-218-ssdf", // NIST SP 800-218 Secure Software Development Framework v1.1 //
|
|
232
|
-
"nist-800-82-r3", // NIST SP 800-82 Rev 3 — OT security guide //
|
|
231
|
+
"nist-800-218-ssdf", // NIST SP 800-218 Secure Software Development Framework v1.1 // NIST pub number, not bytes
|
|
232
|
+
"nist-800-82-r3", // NIST SP 800-82 Rev 3 — OT security guide // NIST pub number, not bytes
|
|
233
233
|
"nist-800-63b-rev4", // NIST SP 800-63B Rev 4 — Digital Identity (AAL/IAL/FAL)
|
|
234
234
|
"iec-62443-3-3", // IEC 62443-3-3 — IACS system security
|
|
235
235
|
"fedramp-rev5-moderate", // FedRAMP Rev 5 Moderate baseline
|
|
236
|
-
"hipaa-security-rule", // HIPAA Security Rule 45 CFR §164.312 (technical safeguards) //
|
|
236
|
+
"hipaa-security-rule", // HIPAA Security Rule 45 CFR §164.312 (technical safeguards) // CFR section, not bytes
|
|
237
237
|
"hitrust-csf-v11.4", // HITRUST CSF v11.4
|
|
238
238
|
"nerc-cip-007-6", // NERC CIP-007-6 — BES Cyber System Security Management
|
|
239
239
|
"psd2-rts-sca", // EU PSD2 RTS on Strong Customer Authentication (Commission Delegated Regulation 2018/389)
|
|
@@ -244,10 +244,10 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
244
244
|
"spdx-v3.0", // SPDX v3.0 SBOM — framework ships sbom.spdx.json (v0.9.6+)
|
|
245
245
|
"owasp-wstg-v5", // OWASP Web Security Testing Guide v5
|
|
246
246
|
"ptes", // Penetration Testing Execution Standard
|
|
247
|
-
"nist-800-115", // NIST SP 800-115 Technical Guide to Information Security Testing //
|
|
247
|
+
"nist-800-115", // NIST SP 800-115 Technical Guide to Information Security Testing // NIST pub number, not bytes
|
|
248
248
|
"cwe-top-25-2024", // CWE Top 25 Most Dangerous Software Weaknesses (2024)
|
|
249
249
|
"cis-controls-v8", // CIS Controls v8
|
|
250
|
-
"cmmc-2.0-level-2", // CMMC 2.0 Level 2 (Advanced) — 110 NIST 800-171 Rev 2 controls //
|
|
250
|
+
"cmmc-2.0-level-2", // CMMC 2.0 Level 2 (Advanced) — 110 NIST 800-171 Rev 2 controls // NIST pub number / level, not bytes
|
|
251
251
|
// ---- v0.9.57 — granular CMMC level distinction ----
|
|
252
252
|
// CMMC 2.0 maturity levels carry distinct control-mapping
|
|
253
253
|
// expectations: Level 1 = 15 controls (FAR 52.204-21), Level 2 =
|
|
@@ -255,29 +255,29 @@ var KNOWN_POSTURES = Object.freeze([
|
|
|
255
255
|
// 800-172 enhanced controls. The umbrella "cmmc-2.0" posture
|
|
256
256
|
// remains for back-compat with existing operators; the explicit
|
|
257
257
|
// L1/L2/L3 postures are the recommended pin for new deployments.
|
|
258
|
-
"cmmc-2.0-level-1", // CMMC 2.0 Level 1 (Foundational) — 15 FAR controls; FCI-only data //
|
|
259
|
-
"cmmc-2.0-level-3", // CMMC 2.0 Level 3 (Expert) — NIST 800-172 enhanced controls atop L2 //
|
|
258
|
+
"cmmc-2.0-level-1", // CMMC 2.0 Level 1 (Foundational) — 15 FAR controls; FCI-only data // regulatory identifier, not bytes
|
|
259
|
+
"cmmc-2.0-level-3", // CMMC 2.0 Level 3 (Expert) — NIST 800-172 enhanced controls atop L2 // regulatory identifier, not bytes
|
|
260
260
|
// ---- v0.12.1 — promote POSTURE_DEFAULTS-only entries into the
|
|
261
261
|
// canonical KNOWN_POSTURES surface so operators can actually
|
|
262
262
|
// `b.compliance.set(...)` them. Each entry had cascade
|
|
263
263
|
// configuration wired but couldn't be pinned because set()'s
|
|
264
264
|
// KNOWN_POSTURES check refused unknown strings.
|
|
265
|
-
"42-cfr-part-2", // 42 CFR Part 2 — Confidentiality of Substance Use Disorder Patient Records (HHS final rule 2024-02-08) //
|
|
265
|
+
"42-cfr-part-2", // 42 CFR Part 2 — Confidentiality of Substance Use Disorder Patient Records (HHS final rule 2024-02-08) // CFR section identifier, not bytes
|
|
266
266
|
"hti-1", // ONC HTI-1 — Health IT certification + algorithm transparency (45 CFR Part 170; effective 2024-12-31)
|
|
267
|
-
"uscdi-v4", // USCDI v4 — US Core Data for Interoperability v4 (ONC; 2024-01) //
|
|
268
|
-
"irs-1075", // IRS Publication 1075 — Tax Information Security Guidelines (Rev. 11-2023) //
|
|
269
|
-
"nist-800-172-r3", // NIST SP 800-172 Rev 3 — Enhanced Security Requirements for CUI //
|
|
267
|
+
"uscdi-v4", // USCDI v4 — US Core Data for Interoperability v4 (ONC; 2024-01) // version identifier, not bytes
|
|
268
|
+
"irs-1075", // IRS Publication 1075 — Tax Information Security Guidelines (Rev. 11-2023) // publication number, not bytes
|
|
269
|
+
"nist-800-172-r3", // NIST SP 800-172 Rev 3 — Enhanced Security Requirements for CUI // publication number, not bytes
|
|
270
270
|
"tlp-2.0", // FIRST Traffic Light Protocol 2.0 — information-sharing classifications (TLP:CLEAR / GREEN / AMBER / AMBER+STRICT / RED)
|
|
271
271
|
"soci-au", // Australia Security of Critical Infrastructure Act (SOCI 2018) + 2022 amendments
|
|
272
|
-
"ffiec-cat-2", // FFIEC Cybersecurity Assessment Tool 2.0 (federal financial institution exam) //
|
|
273
|
-
"cri-profile-v2.0", // Cyber Risk Institute Profile v2.0 — financial-services framework mapping (NIST CSF cross-walk) //
|
|
272
|
+
"ffiec-cat-2", // FFIEC Cybersecurity Assessment Tool 2.0 (federal financial institution exam) // tool version, not bytes
|
|
273
|
+
"cri-profile-v2.0", // Cyber Risk Institute Profile v2.0 — financial-services framework mapping (NIST CSF cross-walk) // version identifier, not bytes
|
|
274
274
|
"m-22-09", // OMB M-22-09 — Federal Zero Trust Architecture Strategy
|
|
275
275
|
"m-22-18", // OMB M-22-18 — Enhancing Software Supply Chain Security (SSDF attestation)
|
|
276
|
-
"nist-800-53-r5-privacy", // NIST SP 800-53 Rev 5 — Privacy Control Family overlay //
|
|
277
|
-
"nist-ai-600-1-genai", // NIST AI 600-1 — Generative AI Profile (companion to AI RMF 1.0) //
|
|
278
|
-
"nist-csf-2.0", // NIST Cybersecurity Framework 2.0 (Feb 2024) //
|
|
279
|
-
"sb-53", // California SB-53 — Transparency in Frontier AI Act (effective 2025-09-29) //
|
|
280
|
-
"nyc-ll144-2024", // NYC Local Law 144 — Automated Employment Decision Tool bias audits (2024 enforcement update) //
|
|
276
|
+
"nist-800-53-r5-privacy", // NIST SP 800-53 Rev 5 — Privacy Control Family overlay // publication number, not bytes
|
|
277
|
+
"nist-ai-600-1-genai", // NIST AI 600-1 — Generative AI Profile (companion to AI RMF 1.0) // publication number, not bytes
|
|
278
|
+
"nist-csf-2.0", // NIST Cybersecurity Framework 2.0 (Feb 2024) // framework version, not bytes
|
|
279
|
+
"sb-53", // California SB-53 — Transparency in Frontier AI Act (effective 2025-09-29) // statute identifier, not bytes
|
|
280
|
+
"nyc-ll144-2024", // NYC Local Law 144 — Automated Employment Decision Tool bias audits (2024 enforcement update) // statute identifier, not bytes
|
|
281
281
|
]);
|
|
282
282
|
|
|
283
283
|
// SUPPLY-34 — Artifact standards (SBOM / VEX format families) are NOT
|
|
@@ -965,7 +965,7 @@ var POSTURE_DEFAULTS = Object.freeze({
|
|
|
965
965
|
requireVacuumAfterErase: false,
|
|
966
966
|
}),
|
|
967
967
|
"gdpr": Object.freeze({
|
|
968
|
-
backupEncryptionRequired: false, // GDPR Art. 32 says "appropriate" — not mandatory floor
|
|
968
|
+
backupEncryptionRequired: false, // GDPR Art. 32 says "appropriate" — not mandatory floor
|
|
969
969
|
auditChainSignedRequired: true,
|
|
970
970
|
tlsMinVersion: "TLSv1.3",
|
|
971
971
|
// GDPR Art. 17 — "right to erasure" includes residual indexes; B-tree
|
|
@@ -36,11 +36,11 @@ var audit = require("./audit");
|
|
|
36
36
|
var { defineClass } = require("./framework-error");
|
|
37
37
|
var ContentCredentialsError = defineClass("ContentCredentialsError", { alwaysPermanent: true });
|
|
38
38
|
|
|
39
|
-
var STR_LEN_MAX = 256; //
|
|
40
|
-
var ID_LEN_MAX = 128; //
|
|
39
|
+
var STR_LEN_MAX = 256; // string-length cap, not bytes
|
|
40
|
+
var ID_LEN_MAX = 128; // string-length cap, not bytes
|
|
41
41
|
var SEMVER_RE = /^[0-9]+\.[0-9]+(?:\.[0-9]+)?(?:[-+][A-Za-z0-9.-]+)?$/;
|
|
42
42
|
var ID_RE = /^[a-zA-Z0-9._:/-]{1,128}$/;
|
|
43
|
-
var SHA3_HEX_LEN = 128; //
|
|
43
|
+
var SHA3_HEX_LEN = 128; // SHA3-512 hex length, not bytes
|
|
44
44
|
|
|
45
45
|
// Required fields per SB-942 §22757(a) — every AI-generated asset
|
|
46
46
|
// must disclose provider + system + timestamp + contentId.
|
|
@@ -64,7 +64,7 @@ function _validateBuildOpts(opts) {
|
|
|
64
64
|
throw ContentCredentialsError.factory("content-credentials/bad-system",
|
|
65
65
|
"system must match " + ID_RE);
|
|
66
66
|
}
|
|
67
|
-
if (opts.systemVersion.length > 64 || !SEMVER_RE.test(opts.systemVersion)) { //
|
|
67
|
+
if (opts.systemVersion.length > 64 || !SEMVER_RE.test(opts.systemVersion)) { // semver length cap, not bytes
|
|
68
68
|
throw ContentCredentialsError.factory("content-credentials/bad-version",
|
|
69
69
|
"systemVersion must be semver");
|
|
70
70
|
}
|
|
@@ -347,35 +347,35 @@ function verify(envelope, publicKeyPem, opts) {
|
|
|
347
347
|
// libraries (jose-py / c2pa-rs / etc.).
|
|
348
348
|
|
|
349
349
|
// COSE algorithm registry codepoints (RFC 9053 §2.1 + draft-ietf-cose-* for PQ).
|
|
350
|
-
//
|
|
350
|
+
// IANA registry IDs, not byte counts.
|
|
351
351
|
var COSE_ALGS = {
|
|
352
|
-
"ed25519": -8, //
|
|
353
|
-
"es256": -7, //
|
|
354
|
-
"es384": -35, //
|
|
355
|
-
"es512": -36, //
|
|
356
|
-
"ml-dsa-44": -48, //
|
|
357
|
-
"ml-dsa-65": -49, //
|
|
358
|
-
"ml-dsa-87": -50, //
|
|
359
|
-
"slh-dsa-sha2-128s": -51, //
|
|
360
|
-
"slh-dsa-shake-256f": -56, //
|
|
352
|
+
"ed25519": -8, // COSE alg id
|
|
353
|
+
"es256": -7, // COSE alg id
|
|
354
|
+
"es384": -35, // COSE alg id
|
|
355
|
+
"es512": -36, // COSE alg id
|
|
356
|
+
"ml-dsa-44": -48, // COSE alg id (draft)
|
|
357
|
+
"ml-dsa-65": -49, // COSE alg id (draft)
|
|
358
|
+
"ml-dsa-87": -50, // COSE alg id (draft)
|
|
359
|
+
"slh-dsa-sha2-128s": -51, // COSE alg id (draft)
|
|
360
|
+
"slh-dsa-shake-256f": -56, // COSE alg id (draft)
|
|
361
361
|
};
|
|
362
362
|
|
|
363
363
|
// CBOR encoder (RFC 8949 §3). The integer thresholds 24/256/65536/4294967296
|
|
364
364
|
// are CBOR-spec length-encoding boundaries — not byte counts.
|
|
365
|
-
//
|
|
365
|
+
// CBOR encoding thresholds, not byte counts.
|
|
366
366
|
function _cborUint(n) {
|
|
367
|
-
if (n < 24) return Buffer.from([n]); //
|
|
368
|
-
if (n < 256) return Buffer.from([0x18, n]); //
|
|
369
|
-
if (n < 65536) return Buffer.from([0x19, (n >> 8) & 0xFF, n & 0xFF]); //
|
|
370
|
-
if (n < 4294967296) return Buffer.from([0x1A, (n >> 24) & 0xFF, (n >> 16) & 0xFF, (n >> 8) & 0xFF, n & 0xFF]); //
|
|
367
|
+
if (n < 24) return Buffer.from([n]); // CBOR threshold
|
|
368
|
+
if (n < 256) return Buffer.from([0x18, n]); // CBOR threshold
|
|
369
|
+
if (n < 65536) return Buffer.from([0x19, (n >> 8) & 0xFF, n & 0xFF]); // CBOR threshold
|
|
370
|
+
if (n < 4294967296) return Buffer.from([0x1A, (n >> 24) & 0xFF, (n >> 16) & 0xFF, (n >> 8) & 0xFF, n & 0xFF]); // CBOR threshold
|
|
371
371
|
throw ContentCredentialsError.factory("content-credentials/cbor-overflow", "cbor uint too large: " + n);
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
function _cborNint(n) {
|
|
375
375
|
var v = -1 - n;
|
|
376
|
-
if (v < 24) return Buffer.from([0x20 | v]); //
|
|
377
|
-
if (v < 256) return Buffer.from([0x38, v]); //
|
|
378
|
-
if (v < 65536) return Buffer.from([0x39, (v >> 8) & 0xFF, v & 0xFF]); //
|
|
376
|
+
if (v < 24) return Buffer.from([0x20 | v]); // CBOR threshold
|
|
377
|
+
if (v < 256) return Buffer.from([0x38, v]); // CBOR threshold
|
|
378
|
+
if (v < 65536) return Buffer.from([0x39, (v >> 8) & 0xFF, v & 0xFF]); // CBOR threshold
|
|
379
379
|
return Buffer.from([0x3A, (v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]);
|
|
380
380
|
}
|
|
381
381
|
|
|
@@ -386,30 +386,30 @@ function _cborInt(n) {
|
|
|
386
386
|
function _cborBytes(buf) {
|
|
387
387
|
var n = buf.length;
|
|
388
388
|
var head;
|
|
389
|
-
if (n < 24) head = Buffer.from([0x40 | n]); //
|
|
390
|
-
else if (n < 256) head = Buffer.from([0x58, n]); //
|
|
391
|
-
else if (n < 65536) head = Buffer.from([0x59, (n >> 8) & 0xFF, n & 0xFF]); //
|
|
389
|
+
if (n < 24) head = Buffer.from([0x40 | n]); // CBOR threshold
|
|
390
|
+
else if (n < 256) head = Buffer.from([0x58, n]); // CBOR threshold
|
|
391
|
+
else if (n < 65536) head = Buffer.from([0x59, (n >> 8) & 0xFF, n & 0xFF]); // CBOR threshold
|
|
392
392
|
else head = Buffer.from([0x5A, (n >>> 24) & 0xFF, (n >> 16) & 0xFF, (n >> 8) & 0xFF, n & 0xFF]);
|
|
393
393
|
return Buffer.concat([head, buf]);
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
function _cborArrayHeader(n) {
|
|
397
|
-
if (n < 24) return Buffer.from([0x80 | n]); //
|
|
398
|
-
if (n < 256) return Buffer.from([0x98, n]); //
|
|
399
|
-
if (n < 65536) return Buffer.from([0x99, (n >> 8) & 0xFF, n & 0xFF]); //
|
|
397
|
+
if (n < 24) return Buffer.from([0x80 | n]); // CBOR threshold
|
|
398
|
+
if (n < 256) return Buffer.from([0x98, n]); // CBOR threshold
|
|
399
|
+
if (n < 65536) return Buffer.from([0x99, (n >> 8) & 0xFF, n & 0xFF]); // CBOR threshold
|
|
400
400
|
throw ContentCredentialsError.factory("content-credentials/cbor-overflow", "cbor array too large: " + n);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
function _cborMapHeader(n) {
|
|
404
|
-
if (n < 24) return Buffer.from([0xA0 | n]); //
|
|
405
|
-
if (n < 256) return Buffer.from([0xB8, n]); //
|
|
404
|
+
if (n < 24) return Buffer.from([0xA0 | n]); // CBOR threshold
|
|
405
|
+
if (n < 256) return Buffer.from([0xB8, n]); // CBOR threshold
|
|
406
406
|
throw ContentCredentialsError.factory("content-credentials/cbor-overflow", "cbor map too large: " + n);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
function _cborTag(tag) {
|
|
410
|
-
if (tag < 24) return Buffer.from([0xC0 | tag]); //
|
|
411
|
-
if (tag < 256) return Buffer.from([0xD8, tag]); //
|
|
412
|
-
if (tag < 65536) return Buffer.from([0xD9, (tag >> 8) & 0xFF, tag & 0xFF]); //
|
|
410
|
+
if (tag < 24) return Buffer.from([0xC0 | tag]); // CBOR threshold
|
|
411
|
+
if (tag < 256) return Buffer.from([0xD8, tag]); // CBOR threshold
|
|
412
|
+
if (tag < 65536) return Buffer.from([0xD9, (tag >> 8) & 0xFF, tag & 0xFF]); // CBOR threshold
|
|
413
413
|
return Buffer.from([0xDA, (tag >> 24) & 0xFF, (tag >> 16) & 0xFF, (tag >> 8) & 0xFF, tag & 0xFF]);
|
|
414
414
|
}
|
|
415
415
|
|
|
@@ -492,7 +492,7 @@ function signCose(manifest, opts) {
|
|
|
492
492
|
}
|
|
493
493
|
unprotectedHdr = Buffer.concat([
|
|
494
494
|
_cborMapHeader(1),
|
|
495
|
-
_cborInt(33), // allow:raw-
|
|
495
|
+
_cborInt(33), // allow:raw-time-literal — RFC 9360 x5chain header label, not a duration
|
|
496
496
|
chainArray,
|
|
497
497
|
]);
|
|
498
498
|
} else {
|
|
@@ -514,7 +514,7 @@ function signCose(manifest, opts) {
|
|
|
514
514
|
// First entry is the text string "Signature1" — major-type 3
|
|
515
515
|
var sigText = Buffer.from("Signature1", "utf8");
|
|
516
516
|
var sigTextBstr;
|
|
517
|
-
if (sigText.length < 24) sigTextBstr = Buffer.concat([Buffer.from([0x60 | sigText.length]), sigText]); //
|
|
517
|
+
if (sigText.length < 24) sigTextBstr = Buffer.concat([Buffer.from([0x60 | sigText.length]), sigText]); // CBOR text-string threshold
|
|
518
518
|
else sigTextBstr = Buffer.concat([Buffer.from([0x78, sigText.length]), sigText]);
|
|
519
519
|
sigStructureBufs[1] = sigTextBstr;
|
|
520
520
|
var toBeSigned = Buffer.concat(sigStructureBufs);
|
|
@@ -612,7 +612,7 @@ function cacImplicitLabel(opts) {
|
|
|
612
612
|
"(统一社会信用代码 per GB 32100-2015 / GB 45438-2025)");
|
|
613
613
|
}
|
|
614
614
|
if (typeof opts.contentId !== "string" || opts.contentId.length === 0 ||
|
|
615
|
-
opts.contentId.length > 128) { //
|
|
615
|
+
opts.contentId.length > 128) { // contentId char cap, not bytes
|
|
616
616
|
throw new ContentCredentialsError("cac-implicit-label/bad-content-id",
|
|
617
617
|
"cacImplicitLabel: contentId must be 1-128 chars");
|
|
618
618
|
}
|
package/lib/cookies.js
CHANGED
|
@@ -485,7 +485,7 @@ function parseSafe(cookieHeader, opts) {
|
|
|
485
485
|
}
|
|
486
486
|
for (var hi = 0; hi < cookieHeader.length; hi += 1) {
|
|
487
487
|
var ch = cookieHeader.charCodeAt(hi);
|
|
488
|
-
if (ch === 0x0D || ch === 0x0A || ch === 0x00) { //
|
|
488
|
+
if (ch === 0x0D || ch === 0x0A || ch === 0x00) { // CR / LF / NUL forbidden in cookie header
|
|
489
489
|
issues.push({
|
|
490
490
|
kind: "header-control-byte", severity: "high",
|
|
491
491
|
snippet: "Cookie header contains CR / LF / NUL — proxy-side " +
|
package/lib/cose.js
CHANGED
|
@@ -60,12 +60,12 @@ var { defineClass } = require("./framework-error");
|
|
|
60
60
|
|
|
61
61
|
var CoseError = defineClass("CoseError", { alwaysPermanent: true });
|
|
62
62
|
|
|
63
|
-
var COSE_SIGN1_TAG = 18; //
|
|
63
|
+
var COSE_SIGN1_TAG = 18; // RFC 9052 COSE_Sign1 CBOR tag
|
|
64
64
|
var HDR_ALG = 1; // RFC 9052 §3.1 header label: alg
|
|
65
65
|
var HDR_CRIT = 2; // header label: crit
|
|
66
66
|
var HDR_CONTENT_TYPE = 3; // header label: content type
|
|
67
67
|
var HDR_KID = 4; // header label: kid
|
|
68
|
-
var HDR_CWT_CLAIMS = 15; //
|
|
68
|
+
var HDR_CWT_CLAIMS = 15; // RFC 9597 CWT Claims header label (carries SCITT iss/sub)
|
|
69
69
|
|
|
70
70
|
// COSE algorithm identifiers. ML-DSA-87 is a NON-FINAL requested
|
|
71
71
|
// assignment (draft-ietf-cose-dilithium) — pinned deliberately, re-open
|
|
@@ -73,7 +73,7 @@ var HDR_CWT_CLAIMS = 15;
|
|
|
73
73
|
// (RFC 9053). SLH-DSA is intentionally absent (no registered COSE id).
|
|
74
74
|
var ALG_NAME_TO_ID = {
|
|
75
75
|
"ML-DSA-87": -50,
|
|
76
|
-
"ES256": -7, "ES384": -35, "ES512": -36, "EdDSA": -8, //
|
|
76
|
+
"ES256": -7, "ES384": -35, "ES512": -36, "EdDSA": -8, // COSE algorithm identifiers (RFC 9053), not byte sizes
|
|
77
77
|
};
|
|
78
78
|
var ALG_ID_TO_NAME = {};
|
|
79
79
|
Object.keys(ALG_NAME_TO_ID).forEach(function (k) { ALG_ID_TO_NAME[ALG_NAME_TO_ID[k]] = k; });
|
|
@@ -100,7 +100,7 @@ function _toKeyObject(key, kind) {
|
|
|
100
100
|
function _algParamsFor(algId) {
|
|
101
101
|
switch (algId) {
|
|
102
102
|
case -50: return { nodeAlg: null }; // ML-DSA-87 (KeyObject specifies the hash)
|
|
103
|
-
case -8: return { nodeAlg: null }; //
|
|
103
|
+
case -8: return { nodeAlg: null }; // EdDSA COSE alg id (RFC 9053), not a size
|
|
104
104
|
case -7: return { nodeAlg: "sha256", dsaEncoding: "ieee-p1363" }; // ES256
|
|
105
105
|
case -35: return { nodeAlg: "sha384", dsaEncoding: "ieee-p1363" }; // ES384
|
|
106
106
|
case -36: return { nodeAlg: "sha512", dsaEncoding: "ieee-p1363" }; // ES512
|
|
@@ -374,22 +374,22 @@ async function verify(coseSign1, opts) {
|
|
|
374
374
|
|
|
375
375
|
// ---- COSE_Encrypt0 (RFC 9052 §5.2) — single-recipient AEAD ----
|
|
376
376
|
|
|
377
|
-
var COSE_ENCRYPT0_TAG = 16; //
|
|
377
|
+
var COSE_ENCRYPT0_TAG = 16; // RFC 9052 COSE_Encrypt0 CBOR tag
|
|
378
378
|
var HDR_IV = 5; // RFC 9052 §3.1 unprotected header label: IV
|
|
379
|
-
var AEAD_TAG_LEN = 16; //
|
|
379
|
+
var AEAD_TAG_LEN = 16; // AEAD authentication tag length (bytes)
|
|
380
380
|
|
|
381
381
|
// AEAD algorithm: COSE id → node cipher + key / IV sizes. ChaCha20/
|
|
382
382
|
// Poly1305 (24) is the default; AES-GCM is opt-in (project hard-rule
|
|
383
383
|
// #2 forbids AES-GCM as a default).
|
|
384
|
-
var AEAD_NAME_TO_ID = { "ChaCha20-Poly1305": 24, "A256GCM": 3, "A128GCM": 1 }; //
|
|
384
|
+
var AEAD_NAME_TO_ID = { "ChaCha20-Poly1305": 24, "A256GCM": 3, "A128GCM": 1 }; // COSE AEAD algorithm identifiers (RFC 9053), not sizes
|
|
385
385
|
var AEAD_ID_TO_NAME = {};
|
|
386
386
|
Object.keys(AEAD_NAME_TO_ID).forEach(function (k) { AEAD_ID_TO_NAME[AEAD_NAME_TO_ID[k]] = k; });
|
|
387
387
|
|
|
388
388
|
function _aeadParams(algId) {
|
|
389
389
|
switch (algId) {
|
|
390
|
-
case 24: return { cipher: "chacha20-poly1305", keyLen: 32, ivLen: 12 }; //
|
|
391
|
-
case 3: return { cipher: "aes-256-gcm", keyLen: 32, ivLen: 12 }; //
|
|
392
|
-
case 1: return { cipher: "aes-128-gcm", keyLen: 16, ivLen: 12 }; //
|
|
390
|
+
case 24: return { cipher: "chacha20-poly1305", keyLen: 32, ivLen: 12 }; // ChaCha20/Poly1305 key+IV sizes
|
|
391
|
+
case 3: return { cipher: "aes-256-gcm", keyLen: 32, ivLen: 12 }; // AES-256-GCM key+IV sizes
|
|
392
|
+
case 1: return { cipher: "aes-128-gcm", keyLen: 16, ivLen: 12 }; // AES-128-GCM key+IV sizes
|
|
393
393
|
default:
|
|
394
394
|
throw new CoseError("cose/unknown-alg", "cose: unrecognized AEAD COSE alg id " + algId);
|
|
395
395
|
}
|
|
@@ -552,11 +552,11 @@ function decrypt0(coseEncrypt0, opts) {
|
|
|
552
552
|
|
|
553
553
|
// ---- COSE_Mac0 (RFC 9052 §6.2) — single shared-key MAC ----
|
|
554
554
|
|
|
555
|
-
var COSE_MAC0_TAG = 17; //
|
|
555
|
+
var COSE_MAC0_TAG = 17; // RFC 9052 COSE_Mac0 CBOR tag
|
|
556
556
|
// HMAC algorithms (RFC 9053 §3.1). Only the full-length tags are offered —
|
|
557
557
|
// the truncated HMAC 256/64 (id 4) is omitted. HMAC is symmetric, so its
|
|
558
558
|
// post-quantum strength is fine; these are the COSE-standard MAC algs.
|
|
559
|
-
var HMAC_NAME_TO_ID = { "HMAC-256/256": 5, "HMAC-384/384": 6, "HMAC-512/512": 7 }; //
|
|
559
|
+
var HMAC_NAME_TO_ID = { "HMAC-256/256": 5, "HMAC-384/384": 6, "HMAC-512/512": 7 }; // COSE HMAC algorithm ids (RFC 9053)
|
|
560
560
|
var HMAC_ID_TO_NAME = {};
|
|
561
561
|
Object.keys(HMAC_NAME_TO_ID).forEach(function (k) { HMAC_ID_TO_NAME[HMAC_NAME_TO_ID[k]] = k; });
|
|
562
562
|
function _hmacHash(algId) {
|
|
@@ -747,7 +747,7 @@ var COSE_EC2_CRV = { 1: "P-256", 2: "P-384", 3: "P-521" };
|
|
|
747
747
|
var COSE_EC2_CRV_ID = { "P-256": 1, "P-384": 2, "P-521": 3 };
|
|
748
748
|
var COSE_KTY_OKP = 1;
|
|
749
749
|
var COSE_KTY_EC2 = 2;
|
|
750
|
-
var COSE_OKP_ED25519 = 6; //
|
|
750
|
+
var COSE_OKP_ED25519 = 6; // COSE OKP Ed25519 crv id (RFC 9053)
|
|
751
751
|
// COSE_Key common-parameter labels (RFC 9052 §7.1): 1=kty, 2=kid, 3=alg.
|
|
752
752
|
var COSE_KEY_LABEL_KTY = 1;
|
|
753
753
|
var COSE_KEY_LABEL_KID = 2;
|
package/lib/cra-report.js
CHANGED
|
@@ -113,7 +113,7 @@ function create(opts) {
|
|
|
113
113
|
body: Buffer.from(JSON.stringify(payload), "utf8"),
|
|
114
114
|
responseMode: "always-resolve",
|
|
115
115
|
});
|
|
116
|
-
var ok = res.statusCode >= 200 && res.statusCode < 300; //
|
|
116
|
+
var ok = res.statusCode >= 200 && res.statusCode < 300; // HTTP status range
|
|
117
117
|
_emitAudit("submitted", ok ? "success" : "failure", {
|
|
118
118
|
statusCode: res.statusCode, productId: productId,
|
|
119
119
|
});
|
package/lib/crdt.js
CHANGED
|
@@ -47,7 +47,7 @@ var CrdtError = defineClass("CrdtError", { alwaysPermanent: true });
|
|
|
47
47
|
|
|
48
48
|
function _replicaId(opts) {
|
|
49
49
|
var id = opts && opts.replicaId;
|
|
50
|
-
if (id == null) return bCrypto.generateToken(8); //
|
|
50
|
+
if (id == null) return bCrypto.generateToken(8); // random replica-id token length
|
|
51
51
|
if (typeof id !== "string" || id.length === 0) throw new CrdtError("crdt/bad-replica-id", "crdt: replicaId must be a non-empty string");
|
|
52
52
|
return id;
|
|
53
53
|
}
|
package/lib/crypto-field.js
CHANGED
|
@@ -841,9 +841,9 @@ function declarePerRowKey(table, opts) {
|
|
|
841
841
|
throw new Error("declarePerRowKey: table must be a non-empty string");
|
|
842
842
|
}
|
|
843
843
|
opts = opts || {};
|
|
844
|
-
var keySize = opts.keySize === undefined ? 32 : opts.keySize; //
|
|
844
|
+
var keySize = opts.keySize === undefined ? 32 : opts.keySize; // XChaCha20-Poly1305 key length in bytes
|
|
845
845
|
if (typeof keySize !== "number" || !isFinite(keySize) ||
|
|
846
|
-
keySize < 16 || Math.floor(keySize) !== keySize) { //
|
|
846
|
+
keySize < 16 || Math.floor(keySize) !== keySize) { // minimum AES-128 key length in bytes
|
|
847
847
|
throw new Error("declarePerRowKey: opts.keySize must be an integer >= 16 (bytes)");
|
|
848
848
|
}
|
|
849
849
|
var info = opts.info || ("blamejs-per-row-key:" + table);
|
package/lib/crypto-xwing.js
CHANGED
|
@@ -47,15 +47,15 @@ var XWING_LABEL = Buffer.from("5c2e2f2f5e5c", "hex");
|
|
|
47
47
|
|
|
48
48
|
// Component + composite sizes (bytes), fixed by the draft — protocol wire
|
|
49
49
|
// widths, not buffer-capacity tunables.
|
|
50
|
-
var ML_KEM_PK = 1184; //
|
|
51
|
-
var ML_KEM_CT = 1088; //
|
|
52
|
-
var X25519_LEN = 32; //
|
|
53
|
-
var SEED_LEN = 32; //
|
|
54
|
-
var SS_LEN = 32; //
|
|
50
|
+
var ML_KEM_PK = 1184; // ML-KEM-768 public key
|
|
51
|
+
var ML_KEM_CT = 1088; // ML-KEM-768 ciphertext
|
|
52
|
+
var X25519_LEN = 32; // X25519 key/share length
|
|
53
|
+
var SEED_LEN = 32; // X-Wing seed length
|
|
54
|
+
var SS_LEN = 32; // shared-secret length
|
|
55
55
|
var PK_LEN = ML_KEM_PK + X25519_LEN; // 1216
|
|
56
56
|
var CT_LEN = ML_KEM_CT + X25519_LEN; // 1120
|
|
57
|
-
var MLKEM_SEED = 64; //
|
|
58
|
-
var EXPAND_LEN = 96; //
|
|
57
|
+
var MLKEM_SEED = 64; // d ‖ z for ML-KEM KeyGen_internal
|
|
58
|
+
var EXPAND_LEN = 96; // SHAKE256(seed) → d ‖ z ‖ sk_X
|
|
59
59
|
|
|
60
60
|
// X25519 raw-scalar helpers via fixed PKCS8 / SPKI DER prefixes (OID
|
|
61
61
|
// 1.3.101.110). Node clamps the scalar per RFC 7748 on use, matching X-Wing.
|
package/lib/crypto.js
CHANGED
|
@@ -319,9 +319,9 @@ function hashFilesParallel(filePaths, opts) {
|
|
|
319
319
|
}
|
|
320
320
|
var concurrency = opts.concurrency !== undefined
|
|
321
321
|
? opts.concurrency
|
|
322
|
-
: Math.min(8, Math.max(1, filePaths.length)); //
|
|
322
|
+
: Math.min(8, Math.max(1, filePaths.length)); // worker fan-out cap, not bytes
|
|
323
323
|
if (typeof concurrency !== "number" || !isFinite(concurrency) ||
|
|
324
|
-
concurrency < 1 || concurrency > 256 || //
|
|
324
|
+
concurrency < 1 || concurrency > 256 || // concurrency upper cap
|
|
325
325
|
Math.floor(concurrency) !== concurrency) {
|
|
326
326
|
return Promise.reject(new TypeError(
|
|
327
327
|
"crypto.hashFilesParallel: opts.concurrency must be an integer in [1, 256], got " + concurrency
|
|
@@ -830,7 +830,7 @@ function fromBase64Url(s, opts) {
|
|
|
830
830
|
// `/=+$/` CodeQL flags, where `=+` can backtrack on long input
|
|
831
831
|
// ending in many `=`. Walking from end is O(n) worst-case.
|
|
832
832
|
var trimEnd = s.length;
|
|
833
|
-
while (trimEnd > 0 && s.charCodeAt(trimEnd - 1) === 0x3D) trimEnd -= 1; //
|
|
833
|
+
while (trimEnd > 0 && s.charCodeAt(trimEnd - 1) === 0x3D) trimEnd -= 1; // '=' codepoint
|
|
834
834
|
var unpadded = s.slice(0, trimEnd);
|
|
835
835
|
if (!_BASE64URL_STRICT_RE.test(s)) {
|
|
836
836
|
throw new TypeError(
|
|
@@ -838,7 +838,7 @@ function fromBase64Url(s, opts) {
|
|
|
838
838
|
"base64url alphabet (A-Z a-z 0-9 - _ =) — pass {strict:false} to allow non-canonical input"
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
|
-
if (unpadded.length % 4 === 1) { //
|
|
841
|
+
if (unpadded.length % 4 === 1) { // base64 group length, not bytes
|
|
842
842
|
throw new TypeError(
|
|
843
843
|
"crypto.fromBase64Url: input length %% 4 === 1 is not a valid base64url encoding " +
|
|
844
844
|
"(every conforming encoder produces 0 / 2 / 3 remainder; got " + unpadded.length + " chars)"
|
|
@@ -1194,7 +1194,7 @@ function encryptMlkemOnly(plaintext, publicKeyPem) {
|
|
|
1194
1194
|
*/
|
|
1195
1195
|
function decrypt(ciphertext, privateKeys, opts) {
|
|
1196
1196
|
var packed = Buffer.from(ciphertext, "base64");
|
|
1197
|
-
if (packed[0] === 0xE1) { //
|
|
1197
|
+
if (packed[0] === 0xE1) { // legacy envelope magic
|
|
1198
1198
|
if (!opts || !opts.allowLegacy) {
|
|
1199
1199
|
throw new Error("Invalid envelope: legacy 0xE1 format predates the FixedInfo " +
|
|
1200
1200
|
"KDF binding (NIST SP 800-56C r2 §4.1) — re-seal data under the current envelope, " +
|
|
@@ -1303,7 +1303,7 @@ function decryptEnvelope(packed, privateKeys, internalOpts) {
|
|
|
1303
1303
|
// Re-derive the 4-byte envelope-header AAD from the bytes we just
|
|
1304
1304
|
// dispatched on. A tampered header (algorithm-substitution attack)
|
|
1305
1305
|
// surfaces here as a Poly1305 tag verification failure.
|
|
1306
|
-
var headerAad = packed.subarray(0, 4); //
|
|
1306
|
+
var headerAad = packed.subarray(0, 4); // envelope-header byte slice
|
|
1307
1307
|
var plainBuf = Buffer.from(
|
|
1308
1308
|
xchacha20poly1305(symmetricKey, nonce, headerAad).decrypt(packed.subarray(pos))
|
|
1309
1309
|
);
|
package/lib/csp.js
CHANGED
|
@@ -222,8 +222,8 @@ function build(directives, opts) {
|
|
|
222
222
|
* b.csp.build({ "script-src": ["'self'", "'nonce-" + req.cspNonce + "'"] }));
|
|
223
223
|
*/
|
|
224
224
|
function nonce(byteLen) {
|
|
225
|
-
var n = typeof byteLen === "number" ? byteLen : 32; //
|
|
226
|
-
if (!isFinite(n) || n < 16 || n > 64) { //
|
|
225
|
+
var n = typeof byteLen === "number" ? byteLen : 32; // 256-bit nonce default
|
|
226
|
+
if (!isFinite(n) || n < 16 || n > 64) { // CSP3 §6.2.x nonce bounds
|
|
227
227
|
throw new CspError("csp/bad-nonce-len",
|
|
228
228
|
"csp.nonce: byteLen must be 16-64 (CSP3 §6.2 recommends ≥16 bytes)");
|
|
229
229
|
}
|