@blamejs/blamejs-shop 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/lib/asset-manifest.json +1 -1
- package/lib/vendor/MANIFEST.json +632 -416
- package/lib/vendor/blamejs/.clusterfuzzlite/Dockerfile +21 -10
- package/lib/vendor/blamejs/.clusterfuzzlite/build.sh +30 -9
- package/lib/vendor/blamejs/.github/dependabot.yml +8 -0
- package/lib/vendor/blamejs/.github/workflows/actions-lint.yml +3 -3
- package/lib/vendor/blamejs/.github/workflows/cflite_batch.yml +7 -2
- package/lib/vendor/blamejs/.github/workflows/cflite_pr.yml +7 -2
- package/lib/vendor/blamejs/.github/workflows/ci.yml +21 -21
- package/lib/vendor/blamejs/.github/workflows/codeql.yml +3 -3
- package/lib/vendor/blamejs/.github/workflows/npm-publish.yml +4 -4
- package/lib/vendor/blamejs/.github/workflows/release-container.yml +7 -7
- package/lib/vendor/blamejs/.github/workflows/scorecard.yml +3 -3
- package/lib/vendor/blamejs/.github/workflows/sha-to-tag-verify.yml +1 -1
- package/lib/vendor/blamejs/.gitignore +2 -0
- package/lib/vendor/blamejs/CHANGELOG.md +122 -0
- package/lib/vendor/blamejs/NOTICE +26 -1
- package/lib/vendor/blamejs/SECURITY.md +1 -1
- package/lib/vendor/blamejs/api-snapshot.json +207 -5
- package/lib/vendor/blamejs/docker/keycloak/realm-blamejs-test.json +29 -0
- package/lib/vendor/blamejs/examples/wiki/DEPLOY.md +1 -0
- package/lib/vendor/blamejs/examples/wiki/lib/build-app.js +31 -0
- package/lib/vendor/blamejs/examples/wiki/lib/source-comment-block-validator.js +109 -0
- package/lib/vendor/blamejs/examples/wiki/nginx.conf +106 -0
- package/lib/vendor/blamejs/examples/wiki/package-lock.json +1 -1
- package/lib/vendor/blamejs/examples/wiki/test/e2e.js +92 -0
- package/lib/vendor/blamejs/fuzz/asn1-der.fuzz.js +28 -0
- package/lib/vendor/blamejs/fuzz/cms-codec.fuzz.js +17 -0
- package/lib/vendor/blamejs/fuzz/link-header.fuzz.js +18 -0
- package/lib/vendor/blamejs/index.js +6 -0
- package/lib/vendor/blamejs/lib/a2a.js +4 -4
- package/lib/vendor/blamejs/lib/agent-idempotency.js +18 -2
- package/lib/vendor/blamejs/lib/agent-saga.js +36 -8
- package/lib/vendor/blamejs/lib/agent-snapshot.js +63 -6
- package/lib/vendor/blamejs/lib/app-shutdown.js +23 -20
- package/lib/vendor/blamejs/lib/archive-read.js +8 -0
- package/lib/vendor/blamejs/lib/archive-tar.js +12 -2
- package/lib/vendor/blamejs/lib/arg-parser.js +49 -5
- package/lib/vendor/blamejs/lib/asn1-der.js +12 -0
- package/lib/vendor/blamejs/lib/audit-sign.js +47 -1
- package/lib/vendor/blamejs/lib/audit.js +71 -8
- package/lib/vendor/blamejs/lib/auth/ciba.js +14 -2
- package/lib/vendor/blamejs/lib/auth/fido-mds3.js +58 -47
- package/lib/vendor/blamejs/lib/auth/jwt.js +34 -0
- package/lib/vendor/blamejs/lib/auth/oauth.js +90 -13
- package/lib/vendor/blamejs/lib/auth/oid4vci.js +20 -17
- package/lib/vendor/blamejs/lib/auth/openid-federation.js +214 -23
- package/lib/vendor/blamejs/lib/auth/saml.js +38 -20
- package/lib/vendor/blamejs/lib/auth/sd-jwt-vc.js +10 -4
- package/lib/vendor/blamejs/lib/backup/bundle.js +13 -3
- package/lib/vendor/blamejs/lib/backup/index.js +16 -5
- package/lib/vendor/blamejs/lib/backup/manifest.js +18 -5
- package/lib/vendor/blamejs/lib/base32.js +21 -0
- package/lib/vendor/blamejs/lib/break-glass.js +19 -10
- package/lib/vendor/blamejs/lib/bundler.js +5 -1
- package/lib/vendor/blamejs/lib/cache-status.js +3 -7
- package/lib/vendor/blamejs/lib/calendar.js +21 -1
- package/lib/vendor/blamejs/lib/cbor.js +12 -1
- package/lib/vendor/blamejs/lib/cert.js +29 -11
- package/lib/vendor/blamejs/lib/cli.js +94 -24
- package/lib/vendor/blamejs/lib/cloud-events.js +2 -2
- package/lib/vendor/blamejs/lib/cluster-provider-db.js +13 -3
- package/lib/vendor/blamejs/lib/codepoint-class.js +85 -0
- package/lib/vendor/blamejs/lib/compliance-ai-act-prohibited.js +8 -4
- package/lib/vendor/blamejs/lib/compliance-ai-act-transparency.js +19 -4
- package/lib/vendor/blamejs/lib/compliance-ai-act.js +6 -8
- package/lib/vendor/blamejs/lib/content-credentials.js +1 -1
- package/lib/vendor/blamejs/lib/content-digest.js +2 -1
- package/lib/vendor/blamejs/lib/cookies.js +13 -3
- package/lib/vendor/blamejs/lib/cose.js +31 -16
- package/lib/vendor/blamejs/lib/crypto-field.js +32 -0
- package/lib/vendor/blamejs/lib/crypto-oprf.js +11 -2
- package/lib/vendor/blamejs/lib/crypto-xwing.js +22 -4
- package/lib/vendor/blamejs/lib/crypto.js +314 -19
- package/lib/vendor/blamejs/lib/csp.js +11 -3
- package/lib/vendor/blamejs/lib/daemon.js +270 -24
- package/lib/vendor/blamejs/lib/dark-patterns.js +5 -2
- package/lib/vendor/blamejs/lib/db-declare-view.js +2 -2
- package/lib/vendor/blamejs/lib/db-query.js +34 -7
- package/lib/vendor/blamejs/lib/db.js +18 -6
- package/lib/vendor/blamejs/lib/dbsc.js +17 -0
- package/lib/vendor/blamejs/lib/dev.js +21 -2
- package/lib/vendor/blamejs/lib/dsr.js +157 -102
- package/lib/vendor/blamejs/lib/external-db.js +41 -2
- package/lib/vendor/blamejs/lib/file-upload.js +25 -7
- package/lib/vendor/blamejs/lib/flag-providers.js +27 -15
- package/lib/vendor/blamejs/lib/forms.js +113 -27
- package/lib/vendor/blamejs/lib/gate-contract.js +23 -10
- package/lib/vendor/blamejs/lib/gdpr-ropa.js +8 -1
- package/lib/vendor/blamejs/lib/guard-agent-registry.js +1 -1
- package/lib/vendor/blamejs/lib/guard-archive.js +2 -2
- package/lib/vendor/blamejs/lib/guard-cidr.js +27 -1
- package/lib/vendor/blamejs/lib/guard-graphql.js +30 -11
- package/lib/vendor/blamejs/lib/guard-html.js +26 -53
- package/lib/vendor/blamejs/lib/guard-image.js +24 -5
- package/lib/vendor/blamejs/lib/guard-imap-command.js +10 -2
- package/lib/vendor/blamejs/lib/guard-jmap.js +19 -3
- package/lib/vendor/blamejs/lib/guard-jwt.js +18 -2
- package/lib/vendor/blamejs/lib/guard-list-unsubscribe.js +2 -2
- package/lib/vendor/blamejs/lib/guard-managesieve-command.js +10 -2
- package/lib/vendor/blamejs/lib/guard-markdown.js +11 -24
- package/lib/vendor/blamejs/lib/guard-pdf.js +18 -2
- package/lib/vendor/blamejs/lib/guard-pop3-command.js +10 -2
- package/lib/vendor/blamejs/lib/guard-regex.js +8 -5
- package/lib/vendor/blamejs/lib/guard-svg.js +31 -32
- package/lib/vendor/blamejs/lib/guard-time.js +1 -1
- package/lib/vendor/blamejs/lib/guard-uuid.js +2 -2
- package/lib/vendor/blamejs/lib/html-balance.js +3 -3
- package/lib/vendor/blamejs/lib/http-client-cache.js +82 -4
- package/lib/vendor/blamejs/lib/http-client-cookie-jar.js +16 -1
- package/lib/vendor/blamejs/lib/http-client.js +39 -7
- package/lib/vendor/blamejs/lib/http-message-signature.js +35 -1
- package/lib/vendor/blamejs/lib/i18n-messageformat.js +31 -6
- package/lib/vendor/blamejs/lib/i18n.js +35 -21
- package/lib/vendor/blamejs/lib/incident-report.js +8 -1
- package/lib/vendor/blamejs/lib/ip-utils.js +11 -1
- package/lib/vendor/blamejs/lib/json-path.js +23 -1
- package/lib/vendor/blamejs/lib/jwk.js +20 -3
- package/lib/vendor/blamejs/lib/link-header.js +2 -1
- package/lib/vendor/blamejs/lib/log-stream-otlp-grpc.js +5 -1
- package/lib/vendor/blamejs/lib/log-stream-otlp.js +5 -1
- package/lib/vendor/blamejs/lib/log-stream.js +8 -3
- package/lib/vendor/blamejs/lib/mail-auth.js +123 -22
- package/lib/vendor/blamejs/lib/mail-bimi.js +1 -1
- package/lib/vendor/blamejs/lib/mail-bounce.js +8 -0
- package/lib/vendor/blamejs/lib/mail-crypto-pgp.js +46 -10
- package/lib/vendor/blamejs/lib/mail-dav.js +22 -3
- package/lib/vendor/blamejs/lib/mail-dkim.js +96 -30
- package/lib/vendor/blamejs/lib/mail-helo.js +6 -1
- package/lib/vendor/blamejs/lib/mail-scan.js +23 -16
- package/lib/vendor/blamejs/lib/mail-send-deliver.js +34 -8
- package/lib/vendor/blamejs/lib/mail-server-imap.js +3 -4
- package/lib/vendor/blamejs/lib/mail-server-managesieve.js +7 -11
- package/lib/vendor/blamejs/lib/mail-server-mx.js +93 -7
- package/lib/vendor/blamejs/lib/mail-server-registry.js +8 -2
- package/lib/vendor/blamejs/lib/mail.js +15 -5
- package/lib/vendor/blamejs/lib/metrics.js +268 -63
- package/lib/vendor/blamejs/lib/middleware/age-gate.js +7 -1
- package/lib/vendor/blamejs/lib/middleware/asyncapi-serve.js +1 -1
- package/lib/vendor/blamejs/lib/middleware/body-parser.js +19 -4
- package/lib/vendor/blamejs/lib/middleware/bot-guard.js +5 -9
- package/lib/vendor/blamejs/lib/middleware/csp-report.js +40 -8
- package/lib/vendor/blamejs/lib/middleware/csrf-protect.js +24 -10
- package/lib/vendor/blamejs/lib/middleware/dpop.js +10 -5
- package/lib/vendor/blamejs/lib/middleware/index.js +6 -1
- package/lib/vendor/blamejs/lib/middleware/nel.js +1 -1
- package/lib/vendor/blamejs/lib/middleware/openapi-serve.js +1 -1
- package/lib/vendor/blamejs/lib/middleware/rate-limit.js +12 -1
- package/lib/vendor/blamejs/lib/middleware/require-bound-key.js +1 -1
- package/lib/vendor/blamejs/lib/middleware/scim-server.js +1 -1
- package/lib/vendor/blamejs/lib/middleware/tus-upload.js +6 -2
- package/lib/vendor/blamejs/lib/mtls-ca.js +18 -2
- package/lib/vendor/blamejs/lib/network-dns-resolver.js +11 -1
- package/lib/vendor/blamejs/lib/network-dns.js +21 -2
- package/lib/vendor/blamejs/lib/network-tls.js +69 -7
- package/lib/vendor/blamejs/lib/nonce-store.js +9 -1
- package/lib/vendor/blamejs/lib/object-store/gcs.js +7 -0
- package/lib/vendor/blamejs/lib/object-store/sigv4.js +31 -0
- package/lib/vendor/blamejs/lib/observability-otlp-exporter.js +1 -1
- package/lib/vendor/blamejs/lib/outbox.js +1 -1
- package/lib/vendor/blamejs/lib/parsers/safe-ini.js +9 -1
- package/lib/vendor/blamejs/lib/parsers/safe-toml.js +10 -1
- package/lib/vendor/blamejs/lib/permissions.js +6 -3
- package/lib/vendor/blamejs/lib/pid-probe.js +55 -0
- package/lib/vendor/blamejs/lib/pqc-agent.js +8 -1
- package/lib/vendor/blamejs/lib/pqc-software.js +3 -3
- package/lib/vendor/blamejs/lib/pubsub.js +20 -9
- package/lib/vendor/blamejs/lib/queue-local.js +8 -1
- package/lib/vendor/blamejs/lib/queue-redis.js +5 -0
- package/lib/vendor/blamejs/lib/redact.js +54 -0
- package/lib/vendor/blamejs/lib/restore-bundle.js +10 -2
- package/lib/vendor/blamejs/lib/restore.js +19 -0
- package/lib/vendor/blamejs/lib/retention.js +12 -4
- package/lib/vendor/blamejs/lib/router.js +60 -6
- package/lib/vendor/blamejs/lib/safe-buffer.js +69 -0
- package/lib/vendor/blamejs/lib/safe-decompress.js +8 -2
- package/lib/vendor/blamejs/lib/safe-dns.js +25 -20
- package/lib/vendor/blamejs/lib/safe-ical.js +7 -3
- package/lib/vendor/blamejs/lib/safe-mime.js +12 -1
- package/lib/vendor/blamejs/lib/safe-object.js +80 -0
- package/lib/vendor/blamejs/lib/safe-path.js +52 -4
- package/lib/vendor/blamejs/lib/safe-redirect.js +10 -2
- package/lib/vendor/blamejs/lib/safe-schema.js +4 -1
- package/lib/vendor/blamejs/lib/safe-sieve.js +33 -1
- package/lib/vendor/blamejs/lib/safe-sql.js +88 -0
- package/lib/vendor/blamejs/lib/safe-vcard.js +7 -3
- package/lib/vendor/blamejs/lib/scheduler.js +8 -1
- package/lib/vendor/blamejs/lib/security-assert.js +6 -6
- package/lib/vendor/blamejs/lib/self-update-standalone-verifier.js +74 -27
- package/lib/vendor/blamejs/lib/self-update.js +517 -87
- package/lib/vendor/blamejs/lib/server-timing.js +2 -4
- package/lib/vendor/blamejs/lib/session.js +34 -12
- package/lib/vendor/blamejs/lib/sql.js +15 -1
- package/lib/vendor/blamejs/lib/ssrf-guard.js +52 -0
- package/lib/vendor/blamejs/lib/static.js +55 -13
- package/lib/vendor/blamejs/lib/storage.js +8 -2
- package/lib/vendor/blamejs/lib/subject.js +6 -1
- package/lib/vendor/blamejs/lib/tenant-quota.js +52 -13
- package/lib/vendor/blamejs/lib/tls-exporter.js +3 -3
- package/lib/vendor/blamejs/lib/tsa.js +34 -13
- package/lib/vendor/blamejs/lib/uri-template.js +8 -1
- package/lib/vendor/blamejs/lib/vault/index.js +13 -0
- package/lib/vendor/blamejs/lib/vc.js +44 -5
- package/lib/vendor/blamejs/lib/vendor/MANIFEST.json +26 -26
- package/lib/vendor/blamejs/lib/vendor/noble-ciphers.cjs +792 -1
- package/lib/vendor/blamejs/lib/vendor/noble-curves.cjs +3443 -1
- package/lib/vendor/blamejs/lib/vendor/noble-post-quantum.cjs +2737 -1
- package/lib/vendor/blamejs/lib/vendor/pki.cjs +39550 -13
- package/lib/vendor/blamejs/lib/vendor/public-suffix-list.dat +55 -53
- package/lib/vendor/blamejs/lib/vendor/public-suffix-list.data.js +5551 -5554
- package/lib/vendor/blamejs/lib/vendor/simplewebauthn-server.cjs +22459 -32
- package/lib/vendor/blamejs/lib/watcher.js +89 -17
- package/lib/vendor/blamejs/lib/webhook-dispatcher.js +25 -3
- package/lib/vendor/blamejs/lib/webhook.js +12 -2
- package/lib/vendor/blamejs/lib/ws-client.js +32 -1
- package/lib/vendor/blamejs/lib/xml-c14n.js +29 -1
- package/lib/vendor/blamejs/oss-fuzz/projects/blamejs/Dockerfile +1 -1
- package/lib/vendor/blamejs/package-lock.json +2 -2
- package/lib/vendor/blamejs/package.json +1 -1
- package/lib/vendor/blamejs/release-notes/v0.16.x.json +1462 -0
- package/lib/vendor/blamejs/release-notes/v0.17.0.json +31 -0
- package/lib/vendor/blamejs/release-notes/v0.17.1.json +31 -0
- package/lib/vendor/blamejs/release-notes/v0.17.10.json +30 -0
- package/lib/vendor/blamejs/release-notes/v0.17.11.json +22 -0
- package/lib/vendor/blamejs/release-notes/v0.17.12.json +18 -0
- package/lib/vendor/blamejs/release-notes/v0.17.13.json +77 -0
- package/lib/vendor/blamejs/release-notes/v0.17.14.json +40 -0
- package/lib/vendor/blamejs/release-notes/v0.17.15.json +18 -0
- package/lib/vendor/blamejs/release-notes/v0.17.16.json +27 -0
- package/lib/vendor/blamejs/release-notes/v0.17.17.json +31 -0
- package/lib/vendor/blamejs/release-notes/v0.17.18.json +18 -0
- package/lib/vendor/blamejs/release-notes/v0.17.19.json +18 -0
- package/lib/vendor/blamejs/release-notes/v0.17.2.json +26 -0
- package/lib/vendor/blamejs/release-notes/v0.17.20.json +43 -0
- package/lib/vendor/blamejs/release-notes/v0.17.21.json +26 -0
- package/lib/vendor/blamejs/release-notes/v0.17.22.json +18 -0
- package/lib/vendor/blamejs/release-notes/v0.17.3.json +43 -0
- package/lib/vendor/blamejs/release-notes/v0.17.4.json +35 -0
- package/lib/vendor/blamejs/release-notes/v0.17.5.json +26 -0
- package/lib/vendor/blamejs/release-notes/v0.17.6.json +26 -0
- package/lib/vendor/blamejs/release-notes/v0.17.7.json +35 -0
- package/lib/vendor/blamejs/release-notes/v0.17.8.json +22 -0
- package/lib/vendor/blamejs/release-notes/v0.17.9.json +26 -0
- package/lib/vendor/blamejs/scripts/validate-source-comment-blocks.js +4 -0
- package/lib/vendor/blamejs/scripts/vendor-update.sh +293 -9
- package/lib/vendor/blamejs/socket.yml +94 -0
- package/lib/vendor/blamejs/test/00-primitives.js +605 -0
- package/lib/vendor/blamejs/test/helpers/drivers.js +12 -9
- package/lib/vendor/blamejs/test/integration/audit-stack-mysql.test.js +90 -1
- package/lib/vendor/blamejs/test/integration/audit-stack-postgres.test.js +122 -1
- package/lib/vendor/blamejs/test/integration/data-layer-mysql.test.js +30 -0
- package/lib/vendor/blamejs/test/integration/data-layer-pg.test.js +29 -0
- package/lib/vendor/blamejs/test/integration/dsr-cluster-mysql.test.js +479 -0
- package/lib/vendor/blamejs/test/integration/dsr-cluster-pg.test.js +487 -0
- package/lib/vendor/blamejs/test/integration/federation-auth.test.js +313 -5
- package/lib/vendor/blamejs/test/integration/mail-dkim.test.js +80 -0
- package/lib/vendor/blamejs/test/integration/openid-federation-chain.test.js +275 -0
- package/lib/vendor/blamejs/test/integration/webhook-dispatcher-pg.test.js +96 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/a2a-tasks.test.js +401 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/acme.test.js +1649 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/age-gate.test.js +33 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/agent-idempotency.test.js +0 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/agent-saga.test.js +60 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/agent-snapshot.test.js +524 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/api-encrypt.test.js +891 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/app-shutdown.test.js +128 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/archive-adapters.test.js +271 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/archive-read.test.js +628 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/archive-tar-read.test.js +0 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/archive-wrap.test.js +227 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/arg-parser.test.js +15 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/asn1-der.test.js +73 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/atomic-file.test.js +114 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/audit-sign-anchor.test.js +141 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/audit-tools.test.js +624 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/audit.test.js +769 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-jwt-defenses.test.js +436 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-oauth.test.js +1697 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-oid4vp.test.js +495 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-password.test.js +500 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-saml.test.js +1809 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-status-list.test.js +243 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/backup-index.test.js +2226 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/backup-manifest-signature.test.js +183 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/base32.test.js +105 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/break-glass.test.js +693 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cache.test.js +603 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/calendar.test.js +557 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/case-insensitive-security-token-guard.test.js +214 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cbor.test.js +25 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cert.test.js +843 -6
- package/lib/vendor/blamejs/test/layer-0-primitives/ciba-authreqid-binding.test.js +77 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/ciba.test.js +866 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/clear-site-data.test.js +18 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cli-erase.test.js +19 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cli.test.js +2790 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cluster-lease-renewal-ttl.test.js +114 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cluster.test.js +1032 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cms-codec.test.js +575 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/codebase-patterns.test.js +739 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/codepoint-class.test.js +8 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/compliance-ai-act.test.js +194 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/compliance-lifecycle-proto-key.test.js +104 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/compliance-sanctions.test.js +254 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/content-credentials.test.js +613 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/cookies.test.js +140 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/cose.test.js +407 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-adversarial.test.js +352 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-field-derived-hash.test.js +32 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-field.test.js +575 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-hash-files-parallel.test.js +10 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-hash-stream.test.js +24 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-oprf.test.js +17 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-spki-pin.test.js +183 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto-xwing.test.js +48 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/crypto.test.js +345 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/csp-report.test.js +58 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/csv.test.js +48 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/daemon.test.js +459 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/dark-patterns.test.js +19 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/db-query.test.js +1019 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/db-raw-residency-gate.test.js +77 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/db.test.js +1621 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/ddl-change-control.test.js +462 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/dnssec.test.js +323 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/dpop-middleware-verify.test.js +562 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/dsr.test.js +901 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/dual-control.test.js +249 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/external-db-migrate.test.js +561 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/external-db.test.js +1214 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/fal.test.js +21 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/fedcm-dbsc.test.js +46 -20
- package/lib/vendor/blamejs/test/layer-0-primitives/federation-vc-suite.test.js +147 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/fido-mds3.test.js +907 -38
- package/lib/vendor/blamejs/test/layer-0-primitives/file-upload-content-safety-skip-audit.test.js +29 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/file-upload.test.js +1135 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/flag.test.js +30 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/forms.test.js +747 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/gate-contract.test.js +1855 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/gdpr-ropa.test.js +30 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-archive.test.js +86 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-auth.test.js +117 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-cidr.test.js +151 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-domain.test.js +422 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-filename.test.js +424 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/{guard-gate-disposition-coverage.test.js → guard-gate-disposition.test.js} +1 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-graphql.test.js +340 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-html.test.js +29 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-idempotency-key.test.js +28 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-image.test.js +519 -45
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-imap-command.test.js +0 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-jmap.test.js +51 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-jsonpath.test.js +66 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-jwt.test.js +436 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-managesieve-command.test.js +25 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-markdown.test.js +16 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-mime.test.js +86 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-oauth.test.js +140 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-pdf.test.js +80 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-pop3-command.test.js +27 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-regex.test.js +99 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-shell.test.js +76 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/{guard-sql-coverage.test.js → guard-sql.test.js} +3 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-svg.test.js +524 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-template.test.js +71 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-time.test.js +92 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/guard-uuid.test.js +86 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/html-balance.test.js +38 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/http-client-cache-authorization.test.js +347 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/http-client-cache.test.js +908 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/http-client.test.js +2874 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/http-message-signature.test.js +643 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/i18n-messageformat.test.js +38 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/i18n.test.js +1153 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/idempotency-key.test.js +494 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/ip-utils.test.js +30 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/jsdoc-example-execution.test.js +177 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/json-path.test.js +103 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/json-schema.test.js +214 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/jwk.test.js +41 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/jwt-external.test.js +276 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/keychain.test.js +0 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/log-stream.test.js +241 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/log.test.js +106 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-agent.test.js +441 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-auth.test.js +2136 -4
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-bimi.test.js +759 -12
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-bounce.test.js +811 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-crypto-pgp-experimental.test.js +401 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-crypto-pgp.test.js +751 -8
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-crypto-smime.test.js +864 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-crypto.test.js +110 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-dav.test.js +830 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-deploy.test.js +635 -86
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-dkim.test.js +818 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-helo.test.js +27 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-scan.test.js +199 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-send-deliver.test.js +686 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-imap.test.js +778 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-jmap.test.js +1438 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-managesieve.test.js +449 -6
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-mx.test.js +773 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-pop3.test.js +623 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-rate-limit.test.js +55 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-registry.test.js +13 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-server-submission.test.js +877 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-sieve.test.js +326 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-store-fts.test.js +55 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-store.test.js +242 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail.test.js +1596 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/mcp.test.js +440 -4
- package/lib/vendor/blamejs/test/layer-0-primitives/metrics-snapshot.test.js +89 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/metrics.test.js +1230 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-assetlinks.test.js +113 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-body-parser.test.js +1169 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-bot-disclose.test.js +123 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-cookies.test.js +108 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-gpc.test.js +121 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-headers.test.js +163 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-host-allowlist.test.js +154 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-require-content-type.test.js +127 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/{middleware-tus-upload-coverage.test.js → middleware-tus-upload.test.js} +45 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/middleware-web-app-manifest.test.js +132 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mtls-ca-crl-fingerprint-only.test.js +92 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/network-dns-resolver.test.js +65 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/network-dns.test.js +1727 -1
- package/lib/vendor/blamejs/test/layer-0-primitives/network-nts.test.js +699 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/network-smtp-policy.test.js +1181 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/network-tls.test.js +1876 -3
- package/lib/vendor/blamejs/test/layer-0-primitives/network.test.js +32 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/nonce-store-enforce-replay-nonboolean.test.js +81 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/ntp-check.test.js +122 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/observability-tracing.test.js +378 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/observability.test.js +77 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/oid4vci.test.js +1016 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/openid-federation.test.js +946 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/outbox.test.js +818 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/own-property-membership-guards.test.js +109 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/parsers-safe-toml.test.js +543 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/{parsers-safe-yaml-coverage.test.js → parsers-safe-yaml.test.js} +2 -2
- package/lib/vendor/blamejs/test/layer-0-primitives/parsers-standalone.test.js +73 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/passkey.test.js +649 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/permissions.test.js +524 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/pqc-agent-curve.test.js +22 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/pubsub.test.js +295 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/queue-flow-repeat.test.js +36 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/queue.test.js +83 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/rate-limit-xff-spoofing.test.js +34 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/redact.test.js +1031 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/request-helpers.test.js +94 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/require-bound-key.test.js +401 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/restore-empty-manifest-wipe.test.js +154 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/retention.test.js +600 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/router-host-path-injection.test.js +231 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/router-tls0rtt.test.js +21 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/router.test.js +1277 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-async.test.js +133 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-buffer-linear-scans.test.js +14 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-buffer.test.js +80 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-decompress.test.js +28 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-dns.test.js +245 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-ical.test.js +32 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-ini.test.js +376 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-json.test.js +175 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-mime.test.js +518 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-object.test.js +62 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-path.test.js +30 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-schema.test.js +104 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-sql.test.js +142 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-url.test.js +112 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/safe-vcard.test.js +26 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/scheduler.test.js +157 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/scim-server.test.js +396 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/sd-jwt-vc.test.js +930 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/security-assert.test.js +755 -82
- package/lib/vendor/blamejs/test/layer-0-primitives/self-update.test.js +1053 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/session-device-binding.test.js +200 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/session-strict-binding-missing-failclosed.test.js +110 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/sigv4-bucket-ops.test.js +636 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/sql-offset-without-limit.test.js +94 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/sql.test.js +1190 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/ssrf-guard.test.js +21 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/static.test.js +850 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/storage-presigned-url.test.js +146 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/storage.test.js +621 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/subject.test.js +47 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/template.test.js +582 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/tenant-quota.test.js +587 -25
- package/lib/vendor/blamejs/test/layer-0-primitives/time.test.js +11 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/tsa.test.js +524 -63
- package/lib/vendor/blamejs/test/layer-0-primitives/uri-template.test.js +27 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/vault-rotate.test.js +866 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/vault.test.js +74 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/vc.test.js +215 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/watcher.test.js +550 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/webhook-dispatcher.test.js +388 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/webhook.test.js +262 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/websocket.test.js +1294 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/ws-client.test.js +629 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/xml-c14n-attr-normalization.test.js +164 -0
- package/lib/vendor/blamejs/test/smoke.js +2 -0
- package/package.json +1 -1
- package/lib/vendor/blamejs/release-notes/v0.16.0.json +0 -44
- package/lib/vendor/blamejs/release-notes/v0.16.1.json +0 -36
- package/lib/vendor/blamejs/release-notes/v0.16.2.json +0 -71
- package/lib/vendor/blamejs/release-notes/v0.16.3.json +0 -71
- package/lib/vendor/blamejs/test/layer-0-primitives/acme-coverage.test.js +0 -441
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-oauth-coverage.test.js +0 -482
- package/lib/vendor/blamejs/test/layer-0-primitives/auth-saml-coverage.test.js +0 -671
- package/lib/vendor/blamejs/test/layer-0-primitives/backup-index-coverage.test.js +0 -690
- package/lib/vendor/blamejs/test/layer-0-primitives/cli-coverage.test.js +0 -238
- package/lib/vendor/blamejs/test/layer-0-primitives/content-credentials-coverage.test.js +0 -319
- package/lib/vendor/blamejs/test/layer-0-primitives/keychain-coverage.test.js +0 -0
- package/lib/vendor/blamejs/test/layer-0-primitives/mail-auth-coverage.test.js +0 -437
- package/lib/vendor/blamejs/test/layer-0-primitives/mcp-coverage.test.js +0 -443
- package/lib/vendor/blamejs/test/layer-0-primitives/metrics-coverage.test.js +0 -395
- package/lib/vendor/blamejs/test/layer-0-primitives/network-smtp-policy-coverage.test.js +0 -565
- package/lib/vendor/blamejs/test/layer-0-primitives/router-coverage.test.js +0 -592
- package/lib/vendor/blamejs/test/layer-0-primitives/sql-coverage.test.js +0 -422
- package/lib/vendor/blamejs/test/layer-0-primitives/test-coverage.test.js +0 -573
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) blamejs contributors
|
|
3
|
+
"use strict";
|
|
4
|
+
/**
|
|
5
|
+
* b.parsers.ini — error-path, adversarial-input, and defensive-branch
|
|
6
|
+
* coverage.
|
|
7
|
+
*
|
|
8
|
+
* Drives the INI parser (lib/parsers/safe-ini.js) through every branch a
|
|
9
|
+
* happy-path smoke leaves untouched: opt-shape refusals, the resource
|
|
10
|
+
* caps (maxBytes / maxSections / maxKeysPerSection / maxValueBytes),
|
|
11
|
+
* wrong-input-type rejection, the comment-stripping quote-state machine,
|
|
12
|
+
* section-header parsing (plain, dotted, git-style quoted subsection) and
|
|
13
|
+
* its error family, the key/value separator resolution (`=` vs `:`), the
|
|
14
|
+
* value-coercion surface (booleans, decimal / hex integers with range
|
|
15
|
+
* guards, floats, quoted strings with the escape family), the
|
|
16
|
+
* duplicate-key policy matrix, and the prototype-pollution key guard
|
|
17
|
+
* across bare keys, dotted + quoted section segments.
|
|
18
|
+
*
|
|
19
|
+
* Every assertion runs offline through the public b.parsers.ini.parse
|
|
20
|
+
* consumer path — no private internals, no live backend.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var helpers = require("../helpers");
|
|
24
|
+
var b = helpers.b;
|
|
25
|
+
var check = helpers.check;
|
|
26
|
+
|
|
27
|
+
var ini = b.parsers.ini;
|
|
28
|
+
|
|
29
|
+
// Capture the IniSafeError code from a synchronous parse throw. Returns
|
|
30
|
+
// the literal string "NO-THROW" when parse returns a value, so a missing
|
|
31
|
+
// rejection fails the check loudly rather than silently matching.
|
|
32
|
+
function _code(src, opts) {
|
|
33
|
+
try {
|
|
34
|
+
ini.parse(src, opts);
|
|
35
|
+
return "NO-THROW";
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return (e && e.code) || ("PLAIN:" + (e && e.message));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ---- opt-shape refusals (config-time throw: ini/bad-opt) ----
|
|
42
|
+
|
|
43
|
+
function testBadNumericOpts() {
|
|
44
|
+
// maxBytes / maxSections / maxKeysPerSection / maxValueBytes must each be
|
|
45
|
+
// a positive finite integer. Infinity / NaN / negative / zero / non-integer
|
|
46
|
+
// all silently lift the DoS cap they enforce (Infinity is truthy and
|
|
47
|
+
// bypasses `|| DEFAULT_*`), so each is rejected at the entry point.
|
|
48
|
+
check("maxBytes=Infinity → bad-opt", _code("a = 1", { maxBytes: Infinity }) === "ini/bad-opt");
|
|
49
|
+
check("maxBytes=NaN → bad-opt", _code("a = 1", { maxBytes: NaN }) === "ini/bad-opt");
|
|
50
|
+
check("maxBytes=-1 → bad-opt", _code("a = 1", { maxBytes: -1 }) === "ini/bad-opt");
|
|
51
|
+
check("maxBytes=1.5 → bad-opt", _code("a = 1", { maxBytes: 1.5 }) === "ini/bad-opt");
|
|
52
|
+
check("maxBytes=0 → bad-opt", _code("a = 1", { maxBytes: 0 }) === "ini/bad-opt");
|
|
53
|
+
check("maxSections=Infinity → bad-opt", _code("a = 1", { maxSections: Infinity }) === "ini/bad-opt");
|
|
54
|
+
check("maxSections=0 → bad-opt", _code("a = 1", { maxSections: 0 }) === "ini/bad-opt");
|
|
55
|
+
check("maxSections=-3 → bad-opt", _code("a = 1", { maxSections: -3 }) === "ini/bad-opt");
|
|
56
|
+
check("maxKeysPerSection=NaN → bad-opt", _code("a = 1", { maxKeysPerSection: NaN }) === "ini/bad-opt");
|
|
57
|
+
check("maxKeysPerSection=0 → bad-opt", _code("a = 1", { maxKeysPerSection: 0 }) === "ini/bad-opt");
|
|
58
|
+
check("maxValueBytes=-5 → bad-opt", _code("a = 1", { maxValueBytes: -5 }) === "ini/bad-opt");
|
|
59
|
+
check("maxValueBytes=2.5 → bad-opt", _code("a = 1", { maxValueBytes: 2.5 }) === "ini/bad-opt");
|
|
60
|
+
// A large-but-finite opt is accepted (the `!== undefined` branch applies
|
|
61
|
+
// the override rather than rejecting it).
|
|
62
|
+
var r = ini.parse("a = 1", {
|
|
63
|
+
maxBytes: b.constants.BYTES.mib(128),
|
|
64
|
+
maxSections: 5000,
|
|
65
|
+
maxKeysPerSection: 5_000_000,
|
|
66
|
+
maxValueBytes: b.constants.BYTES.mib(1),
|
|
67
|
+
});
|
|
68
|
+
check("oversize-but-finite opts accepted", r.a === 1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function testBadOnDuplicate() {
|
|
72
|
+
check("onDuplicate='merge' → bad-opt", _code("a = 1", { onDuplicate: "merge" }) === "ini/bad-opt");
|
|
73
|
+
check("onDuplicate=42 → bad-opt", _code("a = 1", { onDuplicate: 42 }) === "ini/bad-opt");
|
|
74
|
+
// The three accepted values do not throw at the opt-check.
|
|
75
|
+
check("onDuplicate='throw' accepted", ini.parse("a = 1", { onDuplicate: "throw" }).a === 1);
|
|
76
|
+
check("onDuplicate='first' accepted", ini.parse("a = 1", { onDuplicate: "first" }).a === 1);
|
|
77
|
+
check("onDuplicate='last' accepted", ini.parse("a = 1", { onDuplicate: "last" }).a === 1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ---- wrong input type / oversize ----
|
|
81
|
+
|
|
82
|
+
function testWrongInputType() {
|
|
83
|
+
check("number input rejected", _code(42) === "ini/bad-input");
|
|
84
|
+
check("object input rejected", _code({ a: 1 }) === "ini/bad-input");
|
|
85
|
+
check("null input rejected", _code(null) === "ini/bad-input");
|
|
86
|
+
check("undefined input rejected", _code(undefined) === "ini/bad-input");
|
|
87
|
+
check("array input rejected", _code([1, 2]) === "ini/bad-input");
|
|
88
|
+
check("boolean input rejected", _code(true) === "ini/bad-input");
|
|
89
|
+
check("Buffer input rejected", _code(Buffer.from("a = 1")) === "ini/bad-input");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function testTooLarge() {
|
|
93
|
+
// maxBytes cap on the whole input, measured in UTF-8 bytes.
|
|
94
|
+
check("oversize input → too-large",
|
|
95
|
+
_code("a = " + "x".repeat(4000), { maxBytes: b.constants.BYTES.kib(1) }) === "ini/too-large");
|
|
96
|
+
// A multibyte value counts its encoded byte length, not char count.
|
|
97
|
+
check("multibyte counts bytes → too-large",
|
|
98
|
+
_code("a = " + "é".repeat(10), { maxBytes: 15 }) === "ini/too-large");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ---- resource caps: sections, per-section keys, value bytes ----
|
|
102
|
+
|
|
103
|
+
function testCaps() {
|
|
104
|
+
check("too-many-sections → too-many-sections",
|
|
105
|
+
_code("[a]\n[b]\n[c]", { maxSections: 2 }) === "ini/too-many-sections");
|
|
106
|
+
// Reopening the SAME section still counts each header toward maxSections
|
|
107
|
+
// (so the cap can't be defeated by re-declaring the same block).
|
|
108
|
+
check("reopened section counts toward cap",
|
|
109
|
+
_code("[s]\n[s]\n[s]", { maxSections: 2 }) === "ini/too-many-sections");
|
|
110
|
+
check("too-many-keys → too-many-keys",
|
|
111
|
+
_code("a = 1\nb = 2\nc = 3", { maxKeysPerSection: 2 }) === "ini/too-many-keys");
|
|
112
|
+
check("value-too-large → value-too-large",
|
|
113
|
+
_code("a = " + "x".repeat(50), { maxValueBytes: 10 }) === "ini/value-too-large");
|
|
114
|
+
// value-bytes cap measures the trimmed raw value's UTF-8 length.
|
|
115
|
+
check("multibyte value → value-too-large",
|
|
116
|
+
_code("a = " + "\u{1F600}".repeat(4), { maxValueBytes: 10 }) === "ini/value-too-large");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ---- prototype-pollution key guard, every decode path ----
|
|
120
|
+
|
|
121
|
+
function testPoisonedKeys() {
|
|
122
|
+
check("bare '__proto__' key → forbidden-key", _code("__proto__ = 1") === "ini/forbidden-key");
|
|
123
|
+
check("bare 'constructor' key → forbidden-key", _code("constructor = 1") === "ini/forbidden-key");
|
|
124
|
+
check("bare 'prototype' key → forbidden-key", _code("prototype = 1") === "ini/forbidden-key");
|
|
125
|
+
// Poison as a plain section name.
|
|
126
|
+
check("section '[__proto__]' → forbidden-key", _code("[__proto__]\nx = 1") === "ini/forbidden-key");
|
|
127
|
+
// Poison as a NON-first dotted section segment.
|
|
128
|
+
check("section '[a.constructor]' → forbidden-key", _code("[a.constructor]\nx = 1") === "ini/forbidden-key");
|
|
129
|
+
check("section '[a.prototype]' → forbidden-key", _code("[a.prototype]\nx = 1") === "ini/forbidden-key");
|
|
130
|
+
// Poison as the plain section-part of a git-style quoted subsection.
|
|
131
|
+
check("section '[__proto__ \"x\"]' → forbidden-key", _code('[__proto__ "x"]\ny = 1') === "ini/forbidden-key");
|
|
132
|
+
// Poison as the QUOTED subsection name (the group-2 decode path).
|
|
133
|
+
check("quoted subsection '[a \"__proto__\"]' → forbidden-key", _code('[a "__proto__"]\ny = 1') === "ini/forbidden-key");
|
|
134
|
+
// None of the above may have mutated Object.prototype.
|
|
135
|
+
check("Object.prototype not polluted", typeof ({}).polluted === "undefined");
|
|
136
|
+
check("Object.prototype constructor intact", ({}).constructor === Object);
|
|
137
|
+
// A key that merely CONTAINS a poison substring (or wears quote chars) is
|
|
138
|
+
// a normal key — the guard matches the exact name, not a substring.
|
|
139
|
+
var okKey = ini.parse("my__proto__key = 1");
|
|
140
|
+
check("non-exact poison substring is a normal key", okKey.my__proto__key === 1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function testNullProtoOutput() {
|
|
144
|
+
// Every parsed node is a null-prototype object (defense-in-depth: a poison
|
|
145
|
+
// key could only ever land as an own property, never reach Object.prototype).
|
|
146
|
+
var r = ini.parse("a = 1\n[s]\nb = 2");
|
|
147
|
+
check("root is null-proto", Object.getPrototypeOf(r) === null);
|
|
148
|
+
check("section is null-proto", Object.getPrototypeOf(r.s) === null);
|
|
149
|
+
// Reads still work through direct property access on the null-proto tree.
|
|
150
|
+
check("null-proto value read", r.a === 1 && r.s.b === 2);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ---- comment stripping (the quote-state machine) ----
|
|
154
|
+
|
|
155
|
+
function testComments() {
|
|
156
|
+
// Leading ; and # comment lines are skipped entirely.
|
|
157
|
+
check("leading ';' comment skipped", Object.keys(ini.parse("; a comment\nk = 1")).length === 1);
|
|
158
|
+
check("leading '#' comment skipped", Object.keys(ini.parse("# a comment\nk = 1")).length === 1);
|
|
159
|
+
// Inline comment after whitespace is stripped from the value.
|
|
160
|
+
check("inline ';' comment stripped", ini.parse("k = val ; note").k === "val");
|
|
161
|
+
check("inline '#' comment stripped", ini.parse("k = val # note").k === "val");
|
|
162
|
+
// A ; or # NOT preceded by whitespace stays part of the value.
|
|
163
|
+
check("';' without leading space kept", ini.parse("k = a;b").k === "a;b");
|
|
164
|
+
check("'#' without leading space kept", ini.parse("k = a#b").k === "a#b");
|
|
165
|
+
// A comment char inside a quoted value is preserved (in-string state).
|
|
166
|
+
check("';' inside quotes preserved", ini.parse('k = "a ; b"').k === "a ; b");
|
|
167
|
+
check("'#' inside quotes preserved", ini.parse('k = "a # b"').k === "a # b");
|
|
168
|
+
// An escaped quote keeps the string open so a later ; is still in-string.
|
|
169
|
+
check("escaped quote keeps string open", ini.parse('k = "a\\" ; still in"').k === 'a" ; still in');
|
|
170
|
+
// A whole-document of only comments + blanks yields an empty object.
|
|
171
|
+
check("comment-only doc → empty", Object.keys(ini.parse("; x\n# y\n\n ")).length === 0);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ---- section headers: plain, dotted, quoted subsection ----
|
|
175
|
+
|
|
176
|
+
function testSectionHeaders() {
|
|
177
|
+
var s = ini.parse("[a]\nx = 1");
|
|
178
|
+
check("plain section", s.a.x === 1);
|
|
179
|
+
var nested = ini.parse("[a.b.c]\nz = 9");
|
|
180
|
+
check("dotted section nests", nested.a.b.c.z === 9);
|
|
181
|
+
// git-style quoted subsection → { parent: { child: {...} } }.
|
|
182
|
+
var q = ini.parse('[core "origin"]\nurl = x');
|
|
183
|
+
check("quoted subsection nests", q.core.origin.url === "x");
|
|
184
|
+
// Reopening a section accumulates keys into the same object.
|
|
185
|
+
var reopen = ini.parse("[s]\na = 1\n[s]\nb = 2");
|
|
186
|
+
check("reopened section accumulates", reopen.s.a === 1 && reopen.s.b === 2);
|
|
187
|
+
// Keys before any section header land at the root.
|
|
188
|
+
var rootKeys = ini.parse("top = 1\n[s]\nx = 2");
|
|
189
|
+
check("root-level keys", rootKeys.top === 1 && rootKeys.s.x === 2);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function testSectionHeaderErrors() {
|
|
193
|
+
check("empty header '[]' → empty-section", _code("[]\nx = 1") === "ini/empty-section");
|
|
194
|
+
check("missing ']' → bad-section", _code("[a\nx = 1") === "ini/bad-section");
|
|
195
|
+
check("empty dotted segment → bad-section", _code("[a..b]\nx = 1") === "ini/bad-section");
|
|
196
|
+
check("bad section char → bad-section", _code("[a b]\nx = 1") === "ini/bad-section");
|
|
197
|
+
check("trailing junk after ']' → bad-section", _code("[a] junk\nx = 1") === "ini/bad-section");
|
|
198
|
+
// A scalar already bound at a path cannot become a section.
|
|
199
|
+
check("scalar then section → section-conflict", _code("foo = 1\n[foo]\nbar = 2") === "ini/section-conflict");
|
|
200
|
+
// A scalar collision on a NON-leaf dotted segment.
|
|
201
|
+
check("scalar then deep section → section-conflict",
|
|
202
|
+
_code("[a]\nb = 1\n[a.b.c]\nx = 2") === "ini/section-conflict");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// ---- key / value separator resolution ----
|
|
206
|
+
|
|
207
|
+
function testKeyValueSeparators() {
|
|
208
|
+
check("'=' separator", ini.parse("a = 1").a === 1);
|
|
209
|
+
check("':' separator", ini.parse("a: 5").a === 5);
|
|
210
|
+
// When both appear, the earlier separator wins.
|
|
211
|
+
check("'=' earlier wins", ini.parse("a=b:c").a === "b:c");
|
|
212
|
+
check("':' earlier wins", ini.parse("a:b=c").a === "b=c");
|
|
213
|
+
// A colon inside a URL value is not a separator once '=' is seen first.
|
|
214
|
+
check("url value keeps colon", ini.parse("a = http://x.y/z").a === "http://x.y/z");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function testKeyValueErrors() {
|
|
218
|
+
check("no separator → bad-line", _code("justkey") === "ini/bad-line");
|
|
219
|
+
check("empty key '= 1' → empty-key", _code("= 1") === "ini/empty-key");
|
|
220
|
+
check("empty key ': 1' → empty-key", _code(": 1") === "ini/empty-key");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ---- duplicate-key policy matrix ----
|
|
224
|
+
|
|
225
|
+
function testDuplicateKeyPolicy() {
|
|
226
|
+
check("duplicate (default throw) → duplicate-key", _code("a = 1\na = 2") === "ini/duplicate-key");
|
|
227
|
+
check("onDuplicate 'first' keeps first", ini.parse("a = 1\na = 2", { onDuplicate: "first" }).a === 1);
|
|
228
|
+
check("onDuplicate 'last' keeps last", ini.parse("a = 1\na = 2", { onDuplicate: "last" }).a === 2);
|
|
229
|
+
// A duplicate across a reopened section is still caught by the default.
|
|
230
|
+
check("duplicate across reopen → duplicate-key",
|
|
231
|
+
_code("[s]\na = 1\n[s]\na = 2") === "ini/duplicate-key");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ---- value coercion: booleans, strings, escapes ----
|
|
235
|
+
|
|
236
|
+
function testBooleanCoercion() {
|
|
237
|
+
check("true", ini.parse("a = true").a === true);
|
|
238
|
+
check("false", ini.parse("a = false").a === false);
|
|
239
|
+
check("yes", ini.parse("a = yes").a === true);
|
|
240
|
+
check("no", ini.parse("a = no").a === false);
|
|
241
|
+
check("on", ini.parse("a = on").a === true);
|
|
242
|
+
check("off", ini.parse("a = off").a === false);
|
|
243
|
+
// Case-insensitive.
|
|
244
|
+
check("ON case-insensitive", ini.parse("a = ON").a === true);
|
|
245
|
+
check("Off case-insensitive", ini.parse("a = Off").a === false);
|
|
246
|
+
// Quoting preserves the literal string (does NOT coerce to boolean).
|
|
247
|
+
check("quoted 'true' stays string", ini.parse('a = "true"').a === "true");
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function testStringCoercion() {
|
|
251
|
+
check("double-quoted string", ini.parse('a = "hello"').a === "hello");
|
|
252
|
+
check("single-quoted string", ini.parse("a = 'hello'").a === "hello");
|
|
253
|
+
check("empty double-quoted string", ini.parse('a = ""').a === "");
|
|
254
|
+
check("bare (unquoted) string", ini.parse("a = plain text").a === "plain text");
|
|
255
|
+
check("empty value → empty string", ini.parse("a =").a === "");
|
|
256
|
+
// Escape family decodes.
|
|
257
|
+
check("newline + tab escapes decode", ini.parse('a = "x\\ny\\tz"').a === "x\ny\tz");
|
|
258
|
+
check("carriage-return escape decodes", ini.parse('a = "x\\rz"').a === "x\rz");
|
|
259
|
+
check("escaped double-quote decodes", ini.parse('k = "a\\"b"').k === 'a"b');
|
|
260
|
+
check("escaped single-quote decodes", ini.parse("k = 'a\\'b'").k === "a'b");
|
|
261
|
+
check("escaped backslash decodes", ini.parse('a = "x\\\\y"').a === "x\\y");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function testStringErrors() {
|
|
265
|
+
check("unknown escape → bad-escape", _code('a = "x\\q"') === "ini/bad-escape");
|
|
266
|
+
check("lone quote value → bad-quote", _code('a = "') === "ini/bad-quote");
|
|
267
|
+
check("lone single quote → bad-quote", _code("a = '") === "ini/bad-quote");
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ---- number coercion: decimal, hex, floats, and the range guards ----
|
|
271
|
+
|
|
272
|
+
function testNumberCoercion() {
|
|
273
|
+
check("decimal integer", ini.parse("a = 42").a === 42);
|
|
274
|
+
check("negative integer", ini.parse("a = -17").a === -17);
|
|
275
|
+
check("hex integer", ini.parse("a = 0xFF").a === 255);
|
|
276
|
+
check("hex uppercase prefix", ini.parse("a = 0XfF").a === 255);
|
|
277
|
+
check("float with dot", ini.parse("a = 3.14").a === 3.14);
|
|
278
|
+
check("float with exponent", ini.parse("a = 2e3").a === 2000);
|
|
279
|
+
check("float exp sign", ini.parse("a = 1.5E-2").a === 0.015);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function testNumberRangeGuards() {
|
|
283
|
+
// Decimal + hex integer overflow past MAX_SAFE_INTEGER is refused (a
|
|
284
|
+
// silent precision-loss coercion would ship a wrong config value).
|
|
285
|
+
check("decimal overflow → value-out-of-range",
|
|
286
|
+
_code("a = 99999999999999999999") === "ini/value-out-of-range");
|
|
287
|
+
check("hex overflow → value-out-of-range",
|
|
288
|
+
_code("a = 0xFFFFFFFFFFFFFFFFFF") === "ini/value-out-of-range");
|
|
289
|
+
// A float literal that overflows the double range MUST also be refused —
|
|
290
|
+
// silently coercing `1e999` to Infinity violates the parser's "never
|
|
291
|
+
// silently coerce to a usable shape" contract and is inconsistent with
|
|
292
|
+
// the integer guard above. (RED before the float-finiteness fix: the
|
|
293
|
+
// parser returned Infinity instead of throwing.)
|
|
294
|
+
check("float overflow +1e999 → value-out-of-range",
|
|
295
|
+
_code("a = 1e999") === "ini/value-out-of-range");
|
|
296
|
+
check("float overflow -1e999 → value-out-of-range",
|
|
297
|
+
_code("a = -1e999") === "ini/value-out-of-range");
|
|
298
|
+
check("float overflow 1.5e400 → value-out-of-range",
|
|
299
|
+
_code("a = 1.5e400") === "ini/value-out-of-range");
|
|
300
|
+
check("huge float mantissa → value-out-of-range",
|
|
301
|
+
_code("a = 1" + "0".repeat(400) + ".0") === "ini/value-out-of-range");
|
|
302
|
+
// A finite float near the range edge still parses (the guard rejects only
|
|
303
|
+
// the non-finite overflow, not every large-but-representable value).
|
|
304
|
+
check("large finite float parses", ini.parse("a = 1e308").a === 1e308);
|
|
305
|
+
// Float underflow → 0 is representable and stays a finite number.
|
|
306
|
+
check("float underflow → 0", ini.parse("a = 1e-999").a === 0);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ---- document structure: blanks, CRLF, whitespace ----
|
|
310
|
+
|
|
311
|
+
function testDocumentStructure() {
|
|
312
|
+
var t = ini.parse("# header\r\n\r\na = 1\r\nb = 2\r\n");
|
|
313
|
+
check("comments + blanks + CRLF", t.a === 1 && t.b === 2);
|
|
314
|
+
check("empty input → empty object", Object.keys(ini.parse("")).length === 0);
|
|
315
|
+
check("whitespace-only input → empty object", Object.keys(ini.parse(" \n\t\n")).length === 0);
|
|
316
|
+
// Surrounding whitespace on keys and values is trimmed.
|
|
317
|
+
var trimmed = ini.parse(" spaced = value ");
|
|
318
|
+
check("key + value trimmed", trimmed.spaced === "value");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ---- error object surface ----
|
|
322
|
+
|
|
323
|
+
function testErrorSurface() {
|
|
324
|
+
try {
|
|
325
|
+
ini.parse("= 1");
|
|
326
|
+
check("error path threw", false);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
check("error is IniSafeError", e instanceof ini.IniSafeError);
|
|
329
|
+
check("error marks isIniSafeError", e.isIniSafeError === true);
|
|
330
|
+
check("error name", e.name === "IniSafeError");
|
|
331
|
+
check("error code shape", e.code === "ini/empty-key");
|
|
332
|
+
check("error is permanent (alwaysPermanent)", e.permanent === true);
|
|
333
|
+
}
|
|
334
|
+
// The public error class is constructed code-first (code, message).
|
|
335
|
+
var bare = new ini.IniSafeError("ini/custom", "a plain message");
|
|
336
|
+
check("bare IniSafeError code", bare.code === "ini/custom");
|
|
337
|
+
check("bare IniSafeError message verbatim", bare.message === "a plain message");
|
|
338
|
+
check("bare IniSafeError name", bare.name === "IniSafeError");
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function run() {
|
|
342
|
+
testBadNumericOpts();
|
|
343
|
+
testBadOnDuplicate();
|
|
344
|
+
testWrongInputType();
|
|
345
|
+
testTooLarge();
|
|
346
|
+
testCaps();
|
|
347
|
+
testPoisonedKeys();
|
|
348
|
+
testNullProtoOutput();
|
|
349
|
+
testComments();
|
|
350
|
+
testSectionHeaders();
|
|
351
|
+
testSectionHeaderErrors();
|
|
352
|
+
testKeyValueSeparators();
|
|
353
|
+
testKeyValueErrors();
|
|
354
|
+
testDuplicateKeyPolicy();
|
|
355
|
+
testBooleanCoercion();
|
|
356
|
+
testStringCoercion();
|
|
357
|
+
testStringErrors();
|
|
358
|
+
testNumberCoercion();
|
|
359
|
+
testNumberRangeGuards();
|
|
360
|
+
testDocumentStructure();
|
|
361
|
+
testErrorSurface();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
module.exports = { run: run };
|
|
365
|
+
|
|
366
|
+
// Allow direct execution: `node test/layer-0-primitives/safe-ini.test.js`
|
|
367
|
+
if (require.main === module) {
|
|
368
|
+
try {
|
|
369
|
+
run();
|
|
370
|
+
console.log("OK — safe-ini " + helpers.getChecks() + " checks passed");
|
|
371
|
+
process.exit(0);
|
|
372
|
+
} catch (e) {
|
|
373
|
+
console.error(helpers.formatErr(e));
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) blamejs contributors
|
|
3
|
+
"use strict";
|
|
4
|
+
/**
|
|
5
|
+
* b.safeJson parse caps — the six documented limit constants and the fact
|
|
6
|
+
* that b.safeJson.parse actually enforces them.
|
|
7
|
+
*
|
|
8
|
+
* These are not typeof assertions: each test drives the real parse consumer
|
|
9
|
+
* path so the constant's advertised value is proven to be the boundary the
|
|
10
|
+
* primitive honors. The DEFAULT_* trio is exercised end-to-end (a payload one
|
|
11
|
+
* step past the cap refuses with the documented .code; a payload at/under it
|
|
12
|
+
* parses). The ABSOLUTE_* trio is the ceiling opts.max* clamps down to — the
|
|
13
|
+
* depth ceiling is exercised via a real clamp (a huge maxDepth request is
|
|
14
|
+
* pinned back to 1000), and the byte / key ceilings are exercised as the higher
|
|
15
|
+
* working cap that changes a parse outcome the default refuses. Fixtures are
|
|
16
|
+
* sized from the constants themselves so a value drift breaks the test.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
var { check, b } = require("../helpers");
|
|
20
|
+
|
|
21
|
+
function _nest(n) {
|
|
22
|
+
return "[".repeat(n) + "1" + "]".repeat(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _objectWithKeys(n) {
|
|
26
|
+
var pairs = [];
|
|
27
|
+
for (var i = 0; i < n; i += 1) pairs.push('"k' + i + '":0');
|
|
28
|
+
return "{" + pairs.join(",") + "}";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _code(fn) {
|
|
32
|
+
try { fn(); return "OK"; }
|
|
33
|
+
catch (e) { return e && e.code; }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ---- DEFAULT_MAX_BYTES ----
|
|
37
|
+
|
|
38
|
+
function testDefaultMaxBytes() {
|
|
39
|
+
check("b.safeJson.DEFAULT_MAX_BYTES is the advertised 1 MiB",
|
|
40
|
+
b.safeJson.DEFAULT_MAX_BYTES === 1048576);
|
|
41
|
+
|
|
42
|
+
// A JSON string body just past the default cap refuses BEFORE the parser
|
|
43
|
+
// sees it — the whole point of the byte cap is DoS-avoidance on the parse
|
|
44
|
+
// thread. Sizing the payload off the constant means a value drift flips it.
|
|
45
|
+
var overDefault = '"' + "x".repeat(b.safeJson.DEFAULT_MAX_BYTES + 100) + '"';
|
|
46
|
+
check("parse refuses a body larger than DEFAULT_MAX_BYTES with json/too-large",
|
|
47
|
+
_code(function () { b.safeJson.parse(overDefault); }) === "json/too-large");
|
|
48
|
+
|
|
49
|
+
// A small body sails through under the same default cap.
|
|
50
|
+
var underDefault = '"' + "x".repeat(64) + '"';
|
|
51
|
+
check("parse accepts a body well under DEFAULT_MAX_BYTES",
|
|
52
|
+
b.safeJson.parse(underDefault) === "x".repeat(64));
|
|
53
|
+
|
|
54
|
+
// Proof the DEFAULT is what applied above: raising maxBytes past the body
|
|
55
|
+
// size accepts the same over-default payload the default rejected.
|
|
56
|
+
check("raising opts.maxBytes above the body accepts what the default refused",
|
|
57
|
+
typeof b.safeJson.parse(overDefault, {
|
|
58
|
+
maxBytes: b.safeJson.DEFAULT_MAX_BYTES + 200,
|
|
59
|
+
}) === "string");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ---- DEFAULT_MAX_DEPTH ----
|
|
63
|
+
|
|
64
|
+
function testDefaultMaxDepth() {
|
|
65
|
+
check("b.safeJson.DEFAULT_MAX_DEPTH is the advertised 100",
|
|
66
|
+
b.safeJson.DEFAULT_MAX_DEPTH === 100);
|
|
67
|
+
|
|
68
|
+
// Nesting one level past the default bound refuses; nesting exactly at the
|
|
69
|
+
// bound parses. Bounds stack-overflow risk for downstream clone/merge walks.
|
|
70
|
+
var tooDeep = _nest(b.safeJson.DEFAULT_MAX_DEPTH + 1);
|
|
71
|
+
check("parse refuses nesting past DEFAULT_MAX_DEPTH with json/too-deep",
|
|
72
|
+
_code(function () { b.safeJson.parse(tooDeep); }) === "json/too-deep");
|
|
73
|
+
|
|
74
|
+
var atDepth = _nest(b.safeJson.DEFAULT_MAX_DEPTH);
|
|
75
|
+
check("parse accepts nesting at DEFAULT_MAX_DEPTH",
|
|
76
|
+
Array.isArray(b.safeJson.parse(atDepth)));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ---- DEFAULT_MAX_KEYS ----
|
|
80
|
+
|
|
81
|
+
function testDefaultMaxKeys() {
|
|
82
|
+
check("b.safeJson.DEFAULT_MAX_KEYS is the advertised 10 000",
|
|
83
|
+
b.safeJson.DEFAULT_MAX_KEYS === 10000);
|
|
84
|
+
|
|
85
|
+
// One key past the default per-object cap refuses (CVE-2026-21717 HashDoS
|
|
86
|
+
// guard); exactly at the cap parses.
|
|
87
|
+
var tooMany = _objectWithKeys(b.safeJson.DEFAULT_MAX_KEYS + 1);
|
|
88
|
+
check("parse refuses an object past DEFAULT_MAX_KEYS with json/too-many-keys",
|
|
89
|
+
_code(function () { b.safeJson.parse(tooMany); }) === "json/too-many-keys");
|
|
90
|
+
|
|
91
|
+
var atKeys = _objectWithKeys(b.safeJson.DEFAULT_MAX_KEYS);
|
|
92
|
+
check("parse accepts an object at DEFAULT_MAX_KEYS",
|
|
93
|
+
Object.keys(b.safeJson.parse(atKeys)).length === b.safeJson.DEFAULT_MAX_KEYS);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ---- ABSOLUTE_MAX_BYTES ----
|
|
97
|
+
|
|
98
|
+
function testAbsoluteMaxBytes() {
|
|
99
|
+
check("b.safeJson.ABSOLUTE_MAX_BYTES is the advertised 64 MiB",
|
|
100
|
+
b.safeJson.ABSOLUTE_MAX_BYTES === 67108864);
|
|
101
|
+
check("ABSOLUTE_MAX_BYTES sits above the default (real headroom ceiling)",
|
|
102
|
+
b.safeJson.ABSOLUTE_MAX_BYTES > b.safeJson.DEFAULT_MAX_BYTES);
|
|
103
|
+
|
|
104
|
+
// Exercised as the higher working cap: a body the default refuses is
|
|
105
|
+
// accepted when maxBytes is raised to the absolute ceiling. The full clamp
|
|
106
|
+
// at 64 MiB is asserted by value only — allocating a 64 MiB body per process
|
|
107
|
+
// is unsuitable for the parallel smoke harness.
|
|
108
|
+
var overDefault = '"' + "x".repeat(b.safeJson.DEFAULT_MAX_BYTES + 100) + '"';
|
|
109
|
+
check("default cap refuses the over-default body",
|
|
110
|
+
_code(function () { b.safeJson.parse(overDefault); }) === "json/too-large");
|
|
111
|
+
check("maxBytes = ABSOLUTE_MAX_BYTES accepts the over-default body",
|
|
112
|
+
typeof b.safeJson.parse(overDefault, {
|
|
113
|
+
maxBytes: b.safeJson.ABSOLUTE_MAX_BYTES,
|
|
114
|
+
}) === "string");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ---- ABSOLUTE_MAX_DEPTH ----
|
|
118
|
+
|
|
119
|
+
function testAbsoluteMaxDepth() {
|
|
120
|
+
check("b.safeJson.ABSOLUTE_MAX_DEPTH is the advertised 1000",
|
|
121
|
+
b.safeJson.ABSOLUTE_MAX_DEPTH === 1000);
|
|
122
|
+
check("ABSOLUTE_MAX_DEPTH sits above the default",
|
|
123
|
+
b.safeJson.ABSOLUTE_MAX_DEPTH > b.safeJson.DEFAULT_MAX_DEPTH);
|
|
124
|
+
|
|
125
|
+
// A caller asking for a maxDepth far above the ceiling is silently clamped
|
|
126
|
+
// to ABSOLUTE_MAX_DEPTH — so nesting one past the ceiling still refuses even
|
|
127
|
+
// with the inflated request, and nesting at the ceiling still parses.
|
|
128
|
+
var hugeRequest = b.safeJson.ABSOLUTE_MAX_DEPTH * 100;
|
|
129
|
+
var pastCeiling = _nest(b.safeJson.ABSOLUTE_MAX_DEPTH + 1);
|
|
130
|
+
check("an inflated maxDepth is clamped to ABSOLUTE_MAX_DEPTH (refuses past it)",
|
|
131
|
+
_code(function () {
|
|
132
|
+
b.safeJson.parse(pastCeiling, { maxDepth: hugeRequest });
|
|
133
|
+
}) === "json/too-deep");
|
|
134
|
+
|
|
135
|
+
var atCeiling = _nest(b.safeJson.ABSOLUTE_MAX_DEPTH);
|
|
136
|
+
check("nesting at ABSOLUTE_MAX_DEPTH parses under the clamped cap",
|
|
137
|
+
Array.isArray(b.safeJson.parse(atCeiling, { maxDepth: hugeRequest })));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---- ABSOLUTE_MAX_KEYS ----
|
|
141
|
+
|
|
142
|
+
function testAbsoluteMaxKeys() {
|
|
143
|
+
check("b.safeJson.ABSOLUTE_MAX_KEYS is the advertised 1 000 000",
|
|
144
|
+
b.safeJson.ABSOLUTE_MAX_KEYS === 1000000);
|
|
145
|
+
check("ABSOLUTE_MAX_KEYS sits above the default (real headroom ceiling)",
|
|
146
|
+
b.safeJson.ABSOLUTE_MAX_KEYS > b.safeJson.DEFAULT_MAX_KEYS);
|
|
147
|
+
|
|
148
|
+
// Exercised as the higher working cap: an object the default refuses is
|
|
149
|
+
// accepted when maxKeys is raised to the absolute ceiling. The full clamp at
|
|
150
|
+
// 1 000 000 keys is asserted by value only — allocating a million-key object
|
|
151
|
+
// per process is unsuitable for the parallel smoke harness.
|
|
152
|
+
var overDefault = _objectWithKeys(b.safeJson.DEFAULT_MAX_KEYS + 1);
|
|
153
|
+
check("default cap refuses the over-default object",
|
|
154
|
+
_code(function () { b.safeJson.parse(overDefault); }) === "json/too-many-keys");
|
|
155
|
+
check("maxKeys = ABSOLUTE_MAX_KEYS accepts the over-default object",
|
|
156
|
+
Object.keys(b.safeJson.parse(overDefault, {
|
|
157
|
+
maxKeys: b.safeJson.ABSOLUTE_MAX_KEYS,
|
|
158
|
+
})).length === b.safeJson.DEFAULT_MAX_KEYS + 1);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function run() {
|
|
162
|
+
testDefaultMaxBytes();
|
|
163
|
+
testDefaultMaxDepth();
|
|
164
|
+
testDefaultMaxKeys();
|
|
165
|
+
testAbsoluteMaxBytes();
|
|
166
|
+
testAbsoluteMaxDepth();
|
|
167
|
+
testAbsoluteMaxKeys();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = { run: run };
|
|
171
|
+
|
|
172
|
+
if (require.main === module) {
|
|
173
|
+
run().then(function () { console.log("OK"); })
|
|
174
|
+
.catch(function (e) { console.error(e.stack || e); process.exit(1); });
|
|
175
|
+
}
|