@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,177 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) blamejs contributors
|
|
3
|
+
"use strict";
|
|
4
|
+
/**
|
|
5
|
+
* End-to-end @example validation (approach A-v1). The comment-block validator
|
|
6
|
+
* only PARSE-checks each @example (vm.Script — never runs it), so an example can
|
|
7
|
+
* compile yet be semantically dead: a renamed method, a removed API, a wrong
|
|
8
|
+
* argument shape. This walks the SAME parseTree the validator uses and actually
|
|
9
|
+
* EXECUTES the SELF-CONTAINED @examples, asserting they do not throw.
|
|
10
|
+
*
|
|
11
|
+
* Safety (naive execution is destructive — examples start daemons, open dbs,
|
|
12
|
+
* generate keypairs, touch the filesystem, hit the network):
|
|
13
|
+
* - Examples matching STATEFUL_OR_IO are NOT executed — skipped + counted.
|
|
14
|
+
* - Execution runs inside a SACRIFICIAL TEMP CWD so any stray write lands in
|
|
15
|
+
* temp, never the repo, and behind an unhandledRejection guard + a timeout.
|
|
16
|
+
* - A ReferenceError (undefined external identifier like req/res/client) or a
|
|
17
|
+
* require of a non-framework module = illustrative → skip + count.
|
|
18
|
+
* - Every OTHER throw (TypeError, a framework error, `b.x is not a function`)
|
|
19
|
+
* is a REAL defect → fails with file:primitive + the error.
|
|
20
|
+
* Output-checking the `// →` comments is the planned fast-follow; executing the
|
|
21
|
+
* 552 stateful/IO examples via child-process isolation is the planned A-v2.
|
|
22
|
+
*
|
|
23
|
+
* Run standalone: `node test/layer-0-primitives/jsdoc-example-execution.test.js`
|
|
24
|
+
* Or via smoke: `node test/smoke.js`
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var path = require("path");
|
|
28
|
+
var fs = require("node:fs");
|
|
29
|
+
var os = require("node:os");
|
|
30
|
+
var vm = require("node:vm");
|
|
31
|
+
var helpers = require("../helpers");
|
|
32
|
+
var check = helpers.check;
|
|
33
|
+
|
|
34
|
+
var ROOT = path.resolve(__dirname, "..", "..");
|
|
35
|
+
var b = require(ROOT);
|
|
36
|
+
var parser = require(path.join(ROOT, "examples", "wiki", "lib", "source-doc-parser"));
|
|
37
|
+
var { setupTestDb, teardownTestDb } = require("../helpers/db");
|
|
38
|
+
|
|
39
|
+
// Any example that could perform real I/O or long-lived / stateful work: never
|
|
40
|
+
// executed. Broad on purpose — a false skip is safe, a false run is not.
|
|
41
|
+
var STATEFUL_OR_IO = new RegExp([
|
|
42
|
+
"daemon", "vault", "\\bdb\\b", "\\.open\\(", "listen", "server", "\\bmail\\b",
|
|
43
|
+
"deliver", "network", "\\bhttp", "fetch", "\\bdns\\b", "audit", "queue", "cron",
|
|
44
|
+
"\\.watch\\(", "spawn", "exec\\(", "writeFile", "readFile", "mkdir", "unlink",
|
|
45
|
+
"upload", "\\.start\\(", "\\.stop\\(", "generateKey", "keypair", "getKeys",
|
|
46
|
+
"\\.sign\\(", "\\.send\\(", "fileUpload", "static\\(", "\\.pipe\\(",
|
|
47
|
+
"\\.subscribe\\(", "createServer", "\\.connect\\(", "\\.request\\(", "\\.bind\\(",
|
|
48
|
+
"process\\.", "require\\(\"node:", "require\\(\"fs", "require\\(\"net",
|
|
49
|
+
"require\\(\"child_process", "require\\(\"dns", "require\\(\"http",
|
|
50
|
+
"hashFile", "createReadStream", "createWriteStream", "etc/hosts",
|
|
51
|
+
"template", "\\brender\\b", "viewsDir", "listBackends",
|
|
52
|
+
"workerThread", "makeSkipMatcher",
|
|
53
|
+
].join("|"), "i");
|
|
54
|
+
|
|
55
|
+
var SAFE_BUILTINS = { crypto: 1, "node:crypto": 1, path: 1, "node:path": 1,
|
|
56
|
+
buffer: 1, "node:buffer": 1, util: 1, "node:util": 1, url: 1, "node:url": 1,
|
|
57
|
+
querystring: 1, "node:querystring": 1, assert: 1, "node:assert": 1, zlib: 1, "node:zlib": 1 };
|
|
58
|
+
|
|
59
|
+
// require() seen by an example: framework alias → a FRESH object (never `b`
|
|
60
|
+
// itself, so an example writing to the export can't mutate the real surface —
|
|
61
|
+
// and no extra members: an example calling a method the shipped export
|
|
62
|
+
// doesn't have must FAIL, that drift is exactly what this test catches);
|
|
63
|
+
// safe builtins pass through; anything else classifies as an external
|
|
64
|
+
// (illustrative) module.
|
|
65
|
+
function sandboxRequire(name) {
|
|
66
|
+
if (name === "blamejs" || name === "@blamejs/core") {
|
|
67
|
+
return Object.assign({}, b);
|
|
68
|
+
}
|
|
69
|
+
if (Object.prototype.hasOwnProperty.call(SAFE_BUILTINS, name)) return require(name);
|
|
70
|
+
var e = new Error("example references external module '" + name + "'");
|
|
71
|
+
e.code = "EXAMPLE_EXTERNAL_MODULE";
|
|
72
|
+
throw e;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function makeContext() {
|
|
76
|
+
var noop = function () {};
|
|
77
|
+
var sandbox = {
|
|
78
|
+
b: b,
|
|
79
|
+
require: sandboxRequire,
|
|
80
|
+
console: { log: noop, error: noop, warn: noop, info: noop, debug: noop },
|
|
81
|
+
Buffer: Buffer,
|
|
82
|
+
JSON: JSON, Math: Math, Date: Date, Promise: Promise, Object: Object, Array: Array,
|
|
83
|
+
Map: Map, Set: Set, Symbol: Symbol, RegExp: RegExp, Error: Error, TypeError: TypeError,
|
|
84
|
+
URL: URL, URLSearchParams: URLSearchParams, TextEncoder: TextEncoder, TextDecoder: TextDecoder,
|
|
85
|
+
structuredClone: (typeof structuredClone === "function" ? structuredClone : undefined),
|
|
86
|
+
};
|
|
87
|
+
return vm.createContext(sandbox);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function classify(e) {
|
|
91
|
+
// Errors thrown INSIDE the vm context are instances of the context's own
|
|
92
|
+
// constructors, so cross-realm `instanceof` fails — classify by name/flag.
|
|
93
|
+
var name = e && e.name;
|
|
94
|
+
if (name === "ReferenceError") return { outcome: "skip", reason: "external identifier" };
|
|
95
|
+
if (e && e.code === "EXAMPLE_EXTERNAL_MODULE") return { outcome: "skip", reason: "external module" };
|
|
96
|
+
if (e && /^test timed out:|Script execution timed out/.test(String(e.message || ""))) return { outcome: "skip", reason: "timeout" };
|
|
97
|
+
// A framework typed error means the API RESOLVED + ran + threw its own error
|
|
98
|
+
// (a precondition / needs-init / input-validation demo) — the API exists, so
|
|
99
|
+
// it is NOT the renamed/removed-API drift A-v1 targets. (Regressions where the
|
|
100
|
+
// framework WRONGLY throws are B's marker-convention job, not auto-classify.)
|
|
101
|
+
if (e && e.isFrameworkError) return { outcome: "skip", reason: "framework error (precondition/input demo)" };
|
|
102
|
+
// Node/fs errors from I/O the skip filter didn't catch.
|
|
103
|
+
if (e && /^E[A-Z]+$/.test(String(e.code || ""))) return { outcome: "skip", reason: "filesystem/OS error" };
|
|
104
|
+
// The example assumes an operator-declared table/column the isolated test db
|
|
105
|
+
// doesn't have (e.g. subject.rectify over a `users` table) — illustrative.
|
|
106
|
+
if (e && /no such (table|column)/i.test(String(e.message || ""))) return { outcome: "skip", reason: "needs operator-specific schema" };
|
|
107
|
+
return { outcome: "fail", error: (e && (e.stack || e.message)) || String(e) };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function runExample(body) {
|
|
111
|
+
if (STATEFUL_OR_IO.test(body)) return { outcome: "skip", reason: "stateful/IO (not executed)" };
|
|
112
|
+
var wrapped = "(async function () {\n" + body + "\n})();";
|
|
113
|
+
try {
|
|
114
|
+
// Bound each @example with a wall-clock ceiling via the shared primitive —
|
|
115
|
+
// the vm `timeout` caps only SYNCHRONOUS execution, so an awaiting example
|
|
116
|
+
// that never settles would otherwise wedge the suite.
|
|
117
|
+
await helpers.withTestTimeout("jsdoc @example execution", function () {
|
|
118
|
+
return new vm.Script(wrapped, { filename: "example.js" }).runInContext(makeContext(), { timeout: 1000 });
|
|
119
|
+
}, { timeoutMs: 1500 });
|
|
120
|
+
return { outcome: "ran" };
|
|
121
|
+
} catch (e) { return classify(e); }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function run() {
|
|
125
|
+
var docs = parser.parseTree(path.join(ROOT, "lib"));
|
|
126
|
+
// Contain any stray write: run inside a sacrificial temp cwd, restore after.
|
|
127
|
+
var origCwd = process.cwd();
|
|
128
|
+
var tmp = fs.mkdtempSync(path.join(os.tmpdir(), "blamejs-example-exec-"));
|
|
129
|
+
var onReject = function () {};
|
|
130
|
+
process.on("unhandledRejection", onReject);
|
|
131
|
+
process.chdir(tmp);
|
|
132
|
+
// Isolate the framework's default db/vault into this run's own temp dir, so
|
|
133
|
+
// examples that internally touch them (subject.export, retention, …) don't
|
|
134
|
+
// race concurrent smoke forks on the shared default data path.
|
|
135
|
+
await setupTestDb(tmp, [{ name: "widget", columns: { id: "TEXT PRIMARY KEY" } }]);
|
|
136
|
+
|
|
137
|
+
var ran = 0, skipped = 0, failures = [];
|
|
138
|
+
try {
|
|
139
|
+
var files = Object.keys(docs);
|
|
140
|
+
for (var fi = 0; fi < files.length; fi += 1) {
|
|
141
|
+
var prims = docs[files[fi]].primitives || [];
|
|
142
|
+
for (var pi = 0; pi < prims.length; pi += 1) {
|
|
143
|
+
var sig = (prims[pi].tags && prims[pi].tags.primitive) || files[fi];
|
|
144
|
+
var exs = (prims[pi].tags && prims[pi].tags.examples) || [];
|
|
145
|
+
for (var ei = 0; ei < exs.length; ei += 1) {
|
|
146
|
+
var res = await runExample(exs[ei]);
|
|
147
|
+
if (res.outcome === "ran") ran += 1;
|
|
148
|
+
else if (res.outcome === "skip") skipped += 1;
|
|
149
|
+
else failures.push({ sig: sig, error: String(res.error).split("\n").slice(0, 2).join(" ") });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
} finally {
|
|
154
|
+
try { await teardownTestDb(tmp); } catch (_e) { /* best-effort */ }
|
|
155
|
+
process.chdir(origCwd);
|
|
156
|
+
process.removeListener("unhandledRejection", onReject);
|
|
157
|
+
try { fs.rmSync(tmp, { recursive: true, force: true }); } catch (_e2) { /* best-effort */ }
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var summary = "[jsdoc-example-execution] executed " + ran + ", skipped " + skipped +
|
|
161
|
+
" (stateful/IO + illustrative), failed " + failures.length;
|
|
162
|
+
console.log(summary);
|
|
163
|
+
// Persist the detail: a failure under a forked smoke worker whose stdout the
|
|
164
|
+
// parent does NOT fold into .test-output/smoke.log would otherwise be lost.
|
|
165
|
+
var report = summary + "\n" +
|
|
166
|
+
failures.map(function (f) { return " FAIL " + f.sig + " :: " + f.error; }).join("\n") + "\n";
|
|
167
|
+
try { fs.writeFileSync(path.join(ROOT, ".test-output", "jsdoc-example-execution.log"), report); } catch (_e3) { /* best-effort */ }
|
|
168
|
+
if (failures.length) failures.slice(0, 50).forEach(function (f) { console.log(" FAIL " + f.sig + " :: " + f.error); });
|
|
169
|
+
check("every executed @example runs without throwing (renamed/removed API, wrong shape)", failures.length === 0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (require.main === module) {
|
|
173
|
+
run().then(function () { console.log("jsdoc-example-execution OK — " + helpers.getChecks() + " checks"); },
|
|
174
|
+
function (e) { console.error(e && e.stack || e); process.exit(1); });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
module.exports = { run: run };
|
|
@@ -98,11 +98,114 @@ function testSurface() {
|
|
|
98
98
|
check("b.jsonPath.JsonPathError is the typed error", typeof b.jsonPath.JsonPathError === "function");
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// Every malformed / adversarial path must be REFUSED with a typed error —
|
|
102
|
+
// never an uncaught crash and never a silent mis-evaluation.
|
|
103
|
+
function testMalformedRejected() {
|
|
104
|
+
var bad = [
|
|
105
|
+
// argument-type guard (not a parse error — a bad-arg refusal)
|
|
106
|
+
{ p: 123, doc: {}, want: "json-path/bad-arg", n: "non-string path" },
|
|
107
|
+
{ p: null, doc: {}, want: "json-path/bad-arg", n: "null path" },
|
|
108
|
+
// structural parse failures
|
|
109
|
+
{ p: "a.b", want: "json-path/invalid", n: "missing root $" },
|
|
110
|
+
{ p: "$.a extra", want: "json-path/invalid", n: "trailing characters" },
|
|
111
|
+
{ p: "$[a]", want: "json-path/invalid", n: "bare unquoted name in bracket" },
|
|
112
|
+
{ p: "$[?]", want: "json-path/invalid", n: "empty filter" },
|
|
113
|
+
{ p: "$.", want: "json-path/invalid", n: "dot with no member" },
|
|
114
|
+
{ p: "$..", want: "json-path/invalid", n: "bald descendant" },
|
|
115
|
+
{ p: "$[1", want: "json-path/invalid", n: "unclosed bracket" },
|
|
116
|
+
{ p: "$['a", want: "json-path/invalid", n: "unterminated string" },
|
|
117
|
+
// integer-token rules
|
|
118
|
+
{ p: "$[01]", want: "json-path/invalid", n: "leading zero index" },
|
|
119
|
+
{ p: "$[-0]", want: "json-path/invalid", n: "negative-zero index" },
|
|
120
|
+
{ p: "$[99999999999999999999]", want: "json-path/invalid", n: "index out of safe range" },
|
|
121
|
+
// string-escape rules
|
|
122
|
+
{ p: "$['\\u12']", want: "json-path/invalid", n: "short \\u escape" },
|
|
123
|
+
{ p: "$['\\uD83D']", want: "json-path/invalid", n: "lone high surrogate" },
|
|
124
|
+
{ p: "$['\\x']", want: "json-path/invalid", n: "unknown escape" },
|
|
125
|
+
{ p: "$['a" + String.fromCharCode(1) + "b']", want: "json-path/invalid", n: "raw control char in string" },
|
|
126
|
+
// number-literal rules inside filters
|
|
127
|
+
{ p: "$[?@.a==1.]", want: "json-path/invalid", n: "trailing dot in number" },
|
|
128
|
+
{ p: "$[?@.a==1e]", want: "json-path/invalid", n: "empty exponent" },
|
|
129
|
+
// function well-typedness
|
|
130
|
+
{ p: "$[?bogus(@.a)]", want: "json-path/invalid", n: "unknown function" },
|
|
131
|
+
{ p: "$[?match(@.a)]", want: "json-path/invalid", n: "match arity (needs 2)" },
|
|
132
|
+
{ p: "$[?count('x')]", want: "json-path/invalid", n: "count nodes-arg type mismatch" },
|
|
133
|
+
{ p: "$[?length(@.a)]", want: "json-path/invalid", n: "value-func not a valid test" },
|
|
134
|
+
{ p: "$[?count(@.a) < length(@)]", want: null, n: "value funcs ARE comparable" }, // sanity control
|
|
135
|
+
// non-singular query as a comparable
|
|
136
|
+
{ p: "$[?@.*==1]", want: "json-path/invalid", n: "wildcard (non-singular) in comparison" },
|
|
137
|
+
{ p: "$[?@..a==1]", want: "json-path/invalid", n: "descendant (non-singular) in comparison" },
|
|
138
|
+
];
|
|
139
|
+
bad.forEach(function (t) {
|
|
140
|
+
var got = code(function () { jp.query(t.doc || {}, t.p); });
|
|
141
|
+
if (t.want === null) check("adversarial accepted: " + t.n, got === "NO-THROW");
|
|
142
|
+
else check("adversarial refused (" + t.want + "): " + t.n, got === t.want);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Deeply-nested filter recursion must hit the typed DoS guard, not a raw
|
|
147
|
+
// V8 RangeError that escapes JsonPathError handling.
|
|
148
|
+
function testFilterDepthGuard() {
|
|
149
|
+
var deep = "$[?" + Array(220).join("!") + "@.a]";
|
|
150
|
+
check("over-deep filter → typed filter-too-deep", code(function () { jp.query({}, deep); }) === "json-path/filter-too-deep");
|
|
151
|
+
var ok = "$[?" + Array(50).join("!") + "@.a]";
|
|
152
|
+
check("moderately-nested filter still parses", Array.isArray(jp.query({ a: 1 }, ok)));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Type-mismatch / out-of-range selections evaluate to an EMPTY nodelist
|
|
156
|
+
// (a well-typed no-match), never an error or a wrong value.
|
|
157
|
+
function testTypeAndRangeEdges() {
|
|
158
|
+
check("name selector on array → empty", JSON.stringify(jp.query([1, 2, 3], "$.a")) === "[]");
|
|
159
|
+
check("index selector on object → empty", JSON.stringify(jp.query({ a: 1 }, "$[0]")) === "[]");
|
|
160
|
+
check("wildcard on scalar → empty", JSON.stringify(jp.query(5, "$.*")) === "[]");
|
|
161
|
+
check("slice on non-array → empty", JSON.stringify(jp.query({ a: 1 }, "$[0:2]")) === "[]");
|
|
162
|
+
check("descendant-wildcard on scalar → empty", JSON.stringify(jp.query(7, "$..*")) === "[]");
|
|
163
|
+
check("positive index past end → empty", JSON.stringify(jp.query([1, 2], "$[9]")) === "[]");
|
|
164
|
+
check("negative index past start → empty", JSON.stringify(jp.query([1, 2], "$[-9]")) === "[]");
|
|
165
|
+
check("slice step 0 → empty", JSON.stringify(jp.query([1, 2, 3], "$[::0]")) === "[]");
|
|
166
|
+
check("explicit-step slice", JSON.stringify(jp.query([0, 1, 2, 3, 4], "$[0:5:2]")) === "[0,2,4]");
|
|
167
|
+
check("negative-start slice", JSON.stringify(jp.query([0, 1, 2, 3], "$[-2:]")) === "[2,3]");
|
|
168
|
+
// Reading __proto__ as a name selector must not leak the prototype.
|
|
169
|
+
check("__proto__ name selector reads nothing", JSON.stringify(jp.query({ a: 1 }, "$['__proto__']")) === "[]");
|
|
170
|
+
// hostile match() pattern: invalid I-Regexp → no match, no crash.
|
|
171
|
+
check("invalid regex in match() → no match, no throw", JSON.stringify(jp.query([{ a: "x" }], "$[?match(@.a, '(')]")) === "[]");
|
|
172
|
+
check("match() anchors whole string", JSON.stringify(jp.query([{ a: "ab" }], "$[?match(@.a, 'a')]")) === "[]");
|
|
173
|
+
check("search() is substring", JSON.stringify(jp.query([{ a: "zab" }], "$[?search(@.a, 'a')]")) === JSON.stringify([{ a: "zab" }]));
|
|
174
|
+
check("match() on non-string field → no match", JSON.stringify(jp.query([{ a: 5 }], "$[?match(@.a, '5')]")) === "[]");
|
|
175
|
+
// filter over object members; Nothing (missing @.a on z) compares false.
|
|
176
|
+
check("filter over object members", JSON.stringify(jp.query({ x: { a: 1 }, y: { a: 1 }, z: { b: 2 } }, "$[?@.a == 1]")) === JSON.stringify([{ a: 1 }, { a: 1 }]));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// paths() must emit RFC-9535 normalized paths whose control characters are
|
|
180
|
+
// ESCAPED, so the location round-trips back through query().
|
|
181
|
+
function testNormalizedPathEscaping() {
|
|
182
|
+
var doc = {}; doc["a\nb"] = 1; // key containing a newline
|
|
183
|
+
var p = jp.paths(doc, "$.*");
|
|
184
|
+
check("newline key escaped (no raw \\n)", p[0].indexOf("\n") === -1);
|
|
185
|
+
check("newline key emits \\n escape", p[0] === "$['a\\nb']");
|
|
186
|
+
// The normalized path must round-trip: query at that location finds the node.
|
|
187
|
+
check("normalized path round-trips", JSON.stringify(jp.query(doc, p[0])) === "[1]");
|
|
188
|
+
|
|
189
|
+
var doc2 = {}; doc2["t\tq'x\\y"] = 2; // tab, apostrophe, backslash together
|
|
190
|
+
var p2 = jp.paths(doc2, "$.*");
|
|
191
|
+
check("tab/quote/backslash all escaped", p2[0] === "$['t\\tq\\'x\\\\y']");
|
|
192
|
+
check("mixed-escape path round-trips", JSON.stringify(jp.query(doc2, p2[0])) === "[2]");
|
|
193
|
+
|
|
194
|
+
var doc3 = {}; doc3[String.fromCharCode(1)] = 3; // generic control char -> XXXX
|
|
195
|
+
var p3 = jp.paths(doc3, "$.*");
|
|
196
|
+
check("control char emits \\u escape", p3[0] === "$['\\u0001']");
|
|
197
|
+
check("control-char path round-trips", JSON.stringify(jp.query(doc3, p3[0])) === "[3]");
|
|
198
|
+
}
|
|
199
|
+
|
|
101
200
|
async function run() {
|
|
102
201
|
testSurface();
|
|
103
202
|
testCts();
|
|
104
203
|
testFeatures();
|
|
105
204
|
testRegressionAndSafety();
|
|
205
|
+
testMalformedRejected();
|
|
206
|
+
testFilterDepthGuard();
|
|
207
|
+
testTypeAndRangeEdges();
|
|
208
|
+
testNormalizedPathEscaping();
|
|
106
209
|
}
|
|
107
210
|
|
|
108
211
|
module.exports = { run: run };
|
|
@@ -144,6 +144,204 @@ function testDepthCap() {
|
|
|
144
144
|
b.jsonSchema.validate(wide, obj).valid === true);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
function testInstanceTypes() {
|
|
148
|
+
// _typeOf across every JSON type + the "unknown" fallback (undefined).
|
|
149
|
+
check("null instance matches type:null", b.jsonSchema.isValid({ type: "null" }, null));
|
|
150
|
+
check("null rejected by type:string", !b.jsonSchema.isValid({ type: "string" }, null));
|
|
151
|
+
check("boolean instance matches type:boolean", b.jsonSchema.isValid({ type: "boolean" }, true));
|
|
152
|
+
check("array instance matches type:array", b.jsonSchema.isValid({ type: "array" }, [1, 2]));
|
|
153
|
+
check("object instance matches type:object", b.jsonSchema.isValid({ type: "object" }, { a: 1 }));
|
|
154
|
+
// undefined has no JSON type ("unknown"); an empty schema accepts it but a
|
|
155
|
+
// typed schema rejects it (the type never matches "unknown").
|
|
156
|
+
check("undefined accepted by empty schema", b.jsonSchema.isValid({}, undefined));
|
|
157
|
+
check("undefined rejected by type:string", !b.jsonSchema.isValid({ type: "string" }, undefined));
|
|
158
|
+
// type as an array — a match plus the joined mismatch message.
|
|
159
|
+
check("type array matches a member", b.jsonSchema.isValid({ type: ["string", "number"] }, 5));
|
|
160
|
+
var r = b.jsonSchema.validate({ type: ["string", "number"] }, true);
|
|
161
|
+
check("type array mismatch names both", !r.valid && r.errors[0].keyword === "type" && r.errors[0].message.indexOf("string/number") >= 0);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function testDeepEqualEdges() {
|
|
165
|
+
// const uses JSON deep-equality — exercise each early-out branch.
|
|
166
|
+
check("const type-mismatch fails", !b.jsonSchema.isValid({ const: 5 }, "5"));
|
|
167
|
+
check("const array length-mismatch fails", !b.jsonSchema.isValid({ const: [1, 2] }, [1, 2, 3]));
|
|
168
|
+
check("const object key-count mismatch fails", !b.jsonSchema.isValid({ const: { a: 1 } }, { a: 1, b: 2 }));
|
|
169
|
+
check("const object same-count different-keys fails", !b.jsonSchema.isValid({ const: { a: 1 } }, { b: 1 }));
|
|
170
|
+
check("const deep-equal object passes", b.jsonSchema.isValid({ const: { a: 1 } }, { a: 1 }));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function testNumericBounds() {
|
|
174
|
+
check("maximum rejects over", !b.jsonSchema.isValid({ maximum: 5 }, 6));
|
|
175
|
+
check("maximum accepts at bound", b.jsonSchema.isValid({ maximum: 5 }, 5));
|
|
176
|
+
check("exclusiveMaximum rejects at bound", !b.jsonSchema.isValid({ exclusiveMaximum: 5 }, 5));
|
|
177
|
+
check("exclusiveMaximum accepts under", b.jsonSchema.isValid({ exclusiveMaximum: 5 }, 4));
|
|
178
|
+
check("minimum rejects under", !b.jsonSchema.isValid({ minimum: 5 }, 4));
|
|
179
|
+
check("minimum accepts at bound", b.jsonSchema.isValid({ minimum: 5 }, 5));
|
|
180
|
+
check("exclusiveMinimum rejects at bound", !b.jsonSchema.isValid({ exclusiveMinimum: 5 }, 5));
|
|
181
|
+
check("exclusiveMinimum accepts over", b.jsonSchema.isValid({ exclusiveMinimum: 5 }, 6));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function testStringBounds() {
|
|
185
|
+
check("maxLength rejects longer", !b.jsonSchema.isValid({ maxLength: 2 }, "abc"));
|
|
186
|
+
check("maxLength accepts equal", b.jsonSchema.isValid({ maxLength: 3 }, "abc"));
|
|
187
|
+
// A surrogate-pair emoji counts as one code point, not two UTF-16 units.
|
|
188
|
+
check("maxLength counts astral code points once", b.jsonSchema.isValid({ maxLength: 1 }, String.fromCodePoint(0x1F600)));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function testRegexFallback() {
|
|
192
|
+
// A pattern valid without the /u flag but invalid with it — the compiler
|
|
193
|
+
// falls back to a non-unicode RegExp rather than dropping the constraint.
|
|
194
|
+
check("pattern retries without /u flag", b.jsonSchema.isValid({ pattern: "a\\-z" }, "a-z") && !b.jsonSchema.isValid({ pattern: "a\\-z" }, "qqq"));
|
|
195
|
+
// A pattern invalid under both flags compiles to null → constraint skipped.
|
|
196
|
+
check("uncompilable pattern is skipped", b.jsonSchema.isValid({ pattern: "[" }, "anything"));
|
|
197
|
+
check("uncompilable patternProperties key is skipped", b.jsonSchema.isValid({ patternProperties: { "[": { type: "number" } } }, { x: "str" }));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function testArrayApplicatorEdges() {
|
|
201
|
+
check("prefixItems mismatch fails", !b.jsonSchema.isValid({ prefixItems: [{ type: "string" }] }, [5]));
|
|
202
|
+
check("minContains not met fails", !b.jsonSchema.isValid({ contains: { type: "number" }, minContains: 2 }, [1, "a"]));
|
|
203
|
+
check("minContains met passes", b.jsonSchema.isValid({ contains: { type: "number" }, minContains: 2 }, [1, 2, "a"]));
|
|
204
|
+
check("maxContains exceeded fails", !b.jsonSchema.isValid({ contains: { type: "number" }, maxContains: 1 }, [1, 2, 3]));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function testObjectApplicatorEdges() {
|
|
208
|
+
check("maxProperties exceeded fails", !b.jsonSchema.isValid({ maxProperties: 1 }, { a: 1, b: 2 }));
|
|
209
|
+
check("minProperties not met fails", !b.jsonSchema.isValid({ minProperties: 2 }, { a: 1 }));
|
|
210
|
+
// additionalProperties skips keys owned by properties even when that
|
|
211
|
+
// property's own schema failed — no double-count as an additional prop.
|
|
212
|
+
var r1 = b.jsonSchema.validate({ properties: { a: { type: "string" } }, additionalProperties: false }, { a: 123 });
|
|
213
|
+
check("addlProps ignores properties-owned key", !r1.valid && r1.errors.length === 1 && r1.errors[0].keyword === "type");
|
|
214
|
+
// ...and keys matched by patternProperties, even when that pattern failed.
|
|
215
|
+
var r2 = b.jsonSchema.validate({ patternProperties: { "^x": { type: "string" } }, additionalProperties: false }, { xa: 123 });
|
|
216
|
+
check("addlProps ignores pattern-matched key", !r2.valid && r2.errors.length === 1 && r2.errors[0].keyword === "type");
|
|
217
|
+
// An additionalProperties schema that passes marks the key evaluated.
|
|
218
|
+
check("addlProps success accepts", b.jsonSchema.isValid({ additionalProperties: { type: "number" } }, { x: 5 }));
|
|
219
|
+
check("addlProps failure rejects", !b.jsonSchema.isValid({ additionalProperties: { type: "number" } }, { x: "no" }));
|
|
220
|
+
// A key matching NO patternProperties pattern falls through to
|
|
221
|
+
// additionalProperties (here false → rejected).
|
|
222
|
+
var r3 = b.jsonSchema.validate({ patternProperties: { "^x": { type: "number" } }, additionalProperties: false }, { y: 1 });
|
|
223
|
+
check("addlProps applies to non-pattern-matched key", !r3.valid && r3.errors[0].keyword === "false");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function testUnevaluatedSuccess() {
|
|
227
|
+
// An unevaluated property/item that VALIDATES against the unevaluated*
|
|
228
|
+
// schema is accepted (and recorded as evaluated).
|
|
229
|
+
var so = { properties: { a: true }, unevaluatedProperties: { type: "string" } };
|
|
230
|
+
check("unevaluatedProperties accepts matching extra", b.jsonSchema.isValid(so, { a: 1, b: "ok" }));
|
|
231
|
+
check("unevaluatedProperties rejects non-matching extra", !b.jsonSchema.isValid(so, { a: 1, b: 2 }));
|
|
232
|
+
var sa = { prefixItems: [{ type: "number" }], unevaluatedItems: { type: "number" } };
|
|
233
|
+
check("unevaluatedItems accepts matching tail", b.jsonSchema.isValid(sa, [1, 2]));
|
|
234
|
+
check("unevaluatedItems rejects non-matching tail", !b.jsonSchema.isValid(sa, [1, "x"]));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function testConditionalElse() {
|
|
238
|
+
var s = { if: { type: "string" }, else: { type: "number" } };
|
|
239
|
+
check("if-fails-else-fails rejects", !b.jsonSchema.isValid(s, true));
|
|
240
|
+
check("if-fails-else-passes accepts", b.jsonSchema.isValid(s, 5));
|
|
241
|
+
check("if-passes accepts", b.jsonSchema.isValid(s, "hi"));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function testRefResolution() {
|
|
245
|
+
// Empty $ref points at the current schema; a root that is only {$ref:""}
|
|
246
|
+
// is an infinite self-reference caught fail-closed by the depth cap —
|
|
247
|
+
// both with no base and with a resolved $id base.
|
|
248
|
+
check("empty self-$ref caught by depth cap", code(function () { b.jsonSchema.validate({ $ref: "" }, 1); }) === "json-schema/ref-loop");
|
|
249
|
+
check("empty $ref under a base still self-loops", code(function () { b.jsonSchema.validate({ $id: "https://ex/x", allOf: [{ $ref: "" }] }, 5); }) === "json-schema/ref-loop");
|
|
250
|
+
// A $id that is a bare name carrying a fragment: relative fragment refs
|
|
251
|
+
// resolve against the fragment-stripped base (an unusual, discouraged
|
|
252
|
+
// shape — child refs do not cleanly resolve, reported fail-closed).
|
|
253
|
+
var r125 = b.jsonSchema.validate({ $id: "mybase#sec", $defs: { foo: { type: "string" } }, $ref: "#/$defs/foo" }, "hi");
|
|
254
|
+
check("bare-name $id with fragment reports unresolved child ref", !r125.valid && r125.errors[0].keyword === "$ref");
|
|
255
|
+
// A boolean schema is registerable and referenceable by an external URI.
|
|
256
|
+
check("boolean schema addressable by URI", b.jsonSchema.isValid({ $ref: "https://ex/bool" }, 42, { schemas: { "https://ex/bool": true } }) && !b.jsonSchema.isValid({ $ref: "https://ex/bool" }, 42, { schemas: { "https://ex/bool": false } }));
|
|
257
|
+
// A $id that is a bare name (not a URL): a fragment $ref resolves by
|
|
258
|
+
// fragment-aware concatenation against that base.
|
|
259
|
+
var bare = { $id: "mybase", $defs: { foo: { type: "string" } }, $ref: "#/$defs/foo" };
|
|
260
|
+
check("bare-name base fragment $ref resolves", b.jsonSchema.isValid(bare, "hi") && !b.jsonSchema.isValid(bare, 5));
|
|
261
|
+
// A relative nested $id under a urn: base (URL resolution throws → falls
|
|
262
|
+
// back to keeping the relative name).
|
|
263
|
+
check("urn base + relative nested $id validates", b.jsonSchema.isValid({ $id: "urn:ex:root", $defs: { leaf: { $id: "leaf", type: "string" } }, $ref: "#/$defs/leaf" }, "hi"));
|
|
264
|
+
// A document is addressable by its retrieval URI even when its own $id is
|
|
265
|
+
// a different canonical URI.
|
|
266
|
+
var ext = { "https://retrieval.example/x": { $id: "https://canonical.example/y", type: "integer" } };
|
|
267
|
+
check("retrieval URI addressable", b.jsonSchema.isValid({ $ref: "https://retrieval.example/x" }, 3, { schemas: ext }) && !b.jsonSchema.isValid({ $ref: "https://retrieval.example/x" }, "no", { schemas: ext }));
|
|
268
|
+
check("canonical $id addressable", b.jsonSchema.isValid({ $ref: "https://canonical.example/y" }, 3, { schemas: ext }));
|
|
269
|
+
// A schema keyed by "base#" is reachable by a $ref written without the #.
|
|
270
|
+
var hk = { "https://ex/x#": { type: "string" } };
|
|
271
|
+
check("base#-keyed schema reachable without fragment", b.jsonSchema.isValid({ $ref: "https://ex/x" }, "hi", { schemas: hk }) && !b.jsonSchema.isValid({ $ref: "https://ex/x" }, 5, { schemas: hk }));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function testRefUnresolvable() {
|
|
275
|
+
function err(schema, inst, opts) {
|
|
276
|
+
var r = b.jsonSchema.validate(schema, inst, opts);
|
|
277
|
+
return !r.valid && r.errors.length === 1 && r.errors[0].keyword === "$ref";
|
|
278
|
+
}
|
|
279
|
+
check("fragment-less unknown $ref reports unresolved", err({ $ref: "https://nowhere.example/x" }, 1));
|
|
280
|
+
check("pointer past a primitive reports unresolved", err({ xdata: [10, 20, 30], $ref: "#/xdata/0/toodeep" }, "x"));
|
|
281
|
+
check("pointer array-index OOB reports unresolved", err({ xdata: [10, 20, 30], $ref: "#/xdata/9" }, "x"));
|
|
282
|
+
check("pointer missing object key reports unresolved", err({ xmap: { a: 1 }, $ref: "#/nope" }, "x"));
|
|
283
|
+
check("unknown plain-name anchor reports unresolved", err({ $defs: { p: { $anchor: "pos" } }, $ref: "#nonexistent" }, 1));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function testRefIntoNonSchema() {
|
|
287
|
+
// A JSON Pointer into non-schema data (arrays, maps, escaped tokens)
|
|
288
|
+
// resolves the raw value; a non-object value imposes no constraint.
|
|
289
|
+
check("$ref into a data array index imposes no constraint", b.jsonSchema.isValid({ xdata: [10, 20, 30], $ref: "#/xdata/1" }, "anything"));
|
|
290
|
+
check("$ref into a data map is an empty schema", b.jsonSchema.isValid({ xmap: { a: 1 }, $ref: "#/xmap" }, "anything"));
|
|
291
|
+
var esc = { xmap: { "a/b": { type: "string" } }, $ref: "#/xmap/a~1b" };
|
|
292
|
+
check("$ref pointer with ~1 escape resolves", b.jsonSchema.isValid(esc, "hi") && !b.jsonSchema.isValid(esc, 5));
|
|
293
|
+
// A pointed-to object carrying a $id exercises the base-resolution
|
|
294
|
+
// fallback for a node the registry did not index as a schema.
|
|
295
|
+
check("$ref into a data object carrying $id", b.jsonSchema.isValid({ xmap: { $id: "http://x/y", a: 1 }, $ref: "#/xmap" }, "anything"));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function testWalkNonSchemaValues() {
|
|
299
|
+
// A schema keyword whose value is not a schema (a bare number) imposes no
|
|
300
|
+
// constraint rather than crashing the walker/validator.
|
|
301
|
+
check("items:<number> imposes no constraint", b.jsonSchema.isValid({ items: 5 }, [1, 2, 3]));
|
|
302
|
+
// not:<non-schema> — the non-schema is treated as always-pass, so 'not'
|
|
303
|
+
// always fails.
|
|
304
|
+
check("not:<number> always fails (non-schema is always-pass)", !b.jsonSchema.isValid({ not: 5 }, "x"));
|
|
305
|
+
// A $id carrying a fragment still validates.
|
|
306
|
+
check("$id with fragment validates", b.jsonSchema.isValid({ $id: "https://ex.example/a#sec", type: "string" }, "hi"));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function testDynamicRefEdges() {
|
|
310
|
+
// Unresolvable $dynamicRef reports a located error (fail-closed).
|
|
311
|
+
var r = b.jsonSchema.validate({ $dynamicRef: "#nope" }, 1);
|
|
312
|
+
check("unresolvable $dynamicRef reports error", !r.valid && r.errors[0].keyword === "$dynamicRef");
|
|
313
|
+
// $dynamicRef to a plain $anchor (no $dynamicAnchor) behaves like $ref,
|
|
314
|
+
// resolving with an empty base.
|
|
315
|
+
var s = { $defs: { x: { $anchor: "a", type: "string" } }, properties: { p: { $dynamicRef: "#a" } } };
|
|
316
|
+
check("$dynamicRef to plain $anchor validates", b.jsonSchema.isValid(s, { p: "hi" }) && !b.jsonSchema.isValid(s, { p: 5 }));
|
|
317
|
+
// A resolved $dynamicRef target that rejects the instance propagates fail.
|
|
318
|
+
var tree = { $id: "https://ex/tree", $dynamicAnchor: "node", type: "object", properties: { children: { type: "array", items: { $dynamicRef: "#node" } } } };
|
|
319
|
+
check("$dynamicRef recursion rejects bad child", !b.jsonSchema.isValid(tree, { children: ["notobject"] }));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function testMaxErrorsOpt() {
|
|
323
|
+
// A valid maxErrors caps error collection; the option is honored.
|
|
324
|
+
var v = b.jsonSchema.compile({ type: "object", properties: {}, additionalProperties: false }, { maxErrors: 2 });
|
|
325
|
+
check("maxErrors caps collected errors", v.validate({ a: 1, b: 2, c: 3, d: 4 }).errors.length === 2);
|
|
326
|
+
// An out-of-range maxErrors falls back to the default (does not throw).
|
|
327
|
+
check("invalid maxErrors falls back to default", b.jsonSchema.validate({ type: "string" }, "x", { maxErrors: -1 }).valid === true);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function testFormatAssertions() {
|
|
331
|
+
var af = { assertFormat: true };
|
|
332
|
+
// format only asserts on strings — a non-string instance passes.
|
|
333
|
+
check("format assertion skips non-string", b.jsonSchema.isValid({ format: "email" }, 123, af));
|
|
334
|
+
check("uri rejects malformed percent-escape", !b.jsonSchema.isValid({ format: "uri" }, "http://x/%zz", af));
|
|
335
|
+
check("uri rejects scheme-valid-but-unparseable", !b.jsonSchema.isValid({ format: "uri" }, "http://[", af));
|
|
336
|
+
check("uuid accepts canonical", b.jsonSchema.isValid({ format: "uuid" }, "12345678-1234-1234-1234-123456789abc", af));
|
|
337
|
+
check("uuid rejects non-uuid", !b.jsonSchema.isValid({ format: "uuid" }, "not-a-uuid", af));
|
|
338
|
+
check("ipv4 accepts dotted-quad", b.jsonSchema.isValid({ format: "ipv4" }, "1.2.3.4", af));
|
|
339
|
+
check("ipv4 rejects out-of-range octet", !b.jsonSchema.isValid({ format: "ipv4" }, "999.1.1.1", af));
|
|
340
|
+
check("regex accepts valid pattern", b.jsonSchema.isValid({ format: "regex" }, "[a-z]+", af));
|
|
341
|
+
check("regex rejects invalid pattern", !b.jsonSchema.isValid({ format: "regex" }, "[", af));
|
|
342
|
+
check("unknown format is annotation-valid", b.jsonSchema.isValid({ format: "totally-unknown" }, "x", af));
|
|
343
|
+
}
|
|
344
|
+
|
|
147
345
|
async function run() {
|
|
148
346
|
testSurface();
|
|
149
347
|
testAssertions();
|
|
@@ -155,6 +353,22 @@ async function run() {
|
|
|
155
353
|
testErrorsShape();
|
|
156
354
|
testFormat();
|
|
157
355
|
testDepthCap();
|
|
356
|
+
testInstanceTypes();
|
|
357
|
+
testDeepEqualEdges();
|
|
358
|
+
testNumericBounds();
|
|
359
|
+
testStringBounds();
|
|
360
|
+
testRegexFallback();
|
|
361
|
+
testArrayApplicatorEdges();
|
|
362
|
+
testObjectApplicatorEdges();
|
|
363
|
+
testUnevaluatedSuccess();
|
|
364
|
+
testConditionalElse();
|
|
365
|
+
testRefResolution();
|
|
366
|
+
testRefUnresolvable();
|
|
367
|
+
testRefIntoNonSchema();
|
|
368
|
+
testWalkNonSchemaValues();
|
|
369
|
+
testDynamicRefEdges();
|
|
370
|
+
testMaxErrorsOpt();
|
|
371
|
+
testFormatAssertions();
|
|
158
372
|
}
|
|
159
373
|
module.exports = { run: run };
|
|
160
374
|
if (require.main === module) { run().then(function () { console.log("[json-schema] OK — " + helpers.getChecks() + " checks passed"); }, function (e) { console.error("FAIL:", e && e.stack || e); process.exit(1); }); }
|
|
@@ -55,6 +55,45 @@ function testErrors() {
|
|
|
55
55
|
check("non-object throws", code(function () { b.jwk.thumbprint("nope"); }) === "jwk/bad-jwk");
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function testUnsupportedKtyPrototypeNames() {
|
|
59
|
+
// An attacker-controlled `kty` that names an Object.prototype member
|
|
60
|
+
// (`__proto__`, `toString`, `valueOf`, `toLocaleString`, `constructor`,
|
|
61
|
+
// `hasOwnProperty`) must be refused as an unsupported key type — the
|
|
62
|
+
// required-member table is a plain-object lookup, so an inherited member
|
|
63
|
+
// name must NOT be treated as a supported kty. Left unguarded, the
|
|
64
|
+
// zero-`length`-prototype names (`__proto__` / `toString` / `valueOf` /
|
|
65
|
+
// `toLocaleString`) silently thumbprint the empty object, collapsing four
|
|
66
|
+
// distinct inputs onto base64url(SHA-256("{}")) — a shared, predictable
|
|
67
|
+
// thumbprint that breaks RFC 7638's "distinct keys → distinct identifiers"
|
|
68
|
+
// contract behind DPoP jkt / ACME account-key / DBSC session pins.
|
|
69
|
+
var protoNames = ["__proto__", "toString", "valueOf", "toLocaleString",
|
|
70
|
+
"constructor", "hasOwnProperty", "isPrototypeOf"];
|
|
71
|
+
var emptyObjThumb = b.jwk.thumbprint({ kty: "oct", k: "AA" });
|
|
72
|
+
void emptyObjThumb;
|
|
73
|
+
for (var i = 0; i < protoNames.length; i++) {
|
|
74
|
+
var kty = protoNames[i];
|
|
75
|
+
check("canonicalize refuses prototype-named kty `" + kty + "`",
|
|
76
|
+
code(function () { b.jwk.canonicalize({ kty: kty }); }) === "jwk/unsupported-kty");
|
|
77
|
+
check("thumbprint refuses prototype-named kty `" + kty + "`",
|
|
78
|
+
code(function () { b.jwk.thumbprint({ kty: kty }); }) === "jwk/unsupported-kty");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function testHashOptionPrototypeNames() {
|
|
83
|
+
// Sibling root: the `hash` option indexes the HASHES lookup table by a
|
|
84
|
+
// caller-controlled key. A prototype-member name (`toString`, `valueOf`,
|
|
85
|
+
// `constructor`, `__proto__`) must surface the typed `jwk/bad-hash`
|
|
86
|
+
// refusal — not leak a raw Node ERR_INVALID_ARG_TYPE from createHash when
|
|
87
|
+
// the inherited member (a function/object, truthy) slips past the `!hash`
|
|
88
|
+
// guard.
|
|
89
|
+
var badHashes = ["toString", "valueOf", "constructor", "__proto__", "hasOwnProperty"];
|
|
90
|
+
for (var i = 0; i < badHashes.length; i++) {
|
|
91
|
+
var h = badHashes[i];
|
|
92
|
+
check("thumbprint refuses prototype-named hash `" + h + "` with jwk/bad-hash",
|
|
93
|
+
code(function () { b.jwk.thumbprint(RFC_RSA, { hash: h }); }) === "jwk/bad-hash");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
58
97
|
function testComposition() {
|
|
59
98
|
// DPoP and DBSC compute their thumbprints through b.jwk.
|
|
60
99
|
var ec = { kty: "EC", crv: "P-256", x: "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", y: "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0" };
|
|
@@ -68,6 +107,8 @@ async function run() {
|
|
|
68
107
|
testKtys();
|
|
69
108
|
testHashOption();
|
|
70
109
|
testErrors();
|
|
110
|
+
testUnsupportedKtyPrototypeNames();
|
|
111
|
+
testHashOptionPrototypeNames();
|
|
71
112
|
testComposition();
|
|
72
113
|
}
|
|
73
114
|
module.exports = { run: run };
|