@awacloud/fw 0.1.0 → 1.0.0
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 +125 -0
- package/NOTICE +8 -0
- package/README.md +163 -31
- package/dist/build/fw.core.pure.meta.json +6 -6
- package/dist/build/fw.core.pure.min.js +15 -12
- package/dist/build/fw.full.pure.meta.json +13 -7
- package/dist/build/fw.full.pure.min.js +45 -42
- package/dist/build/fw.minimal.pure.meta.json +6 -6
- package/dist/build/fw.minimal.pure.min.js +16 -13
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +6 -6
- package/dist/build/fw.pack.compress-heavy.pure.min.js +3 -3
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-basic.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +7 -6
- package/dist/build/fw.pack.crypto-identity.pure.min.js +4 -4
- package/dist/build/fw.pwa.pure.meta.json +7 -6
- package/dist/build/fw.pwa.pure.min.js +38 -35
- package/dist/build/fw.site-interactive.pure.meta.json +6 -6
- package/dist/build/fw.site-interactive.pure.min.js +37 -34
- package/dist/build/fw.site.pure.meta.json +6 -6
- package/dist/build/fw.site.pure.min.js +24 -21
- package/dist/build/fw.spa.pure.meta.json +8 -7
- package/dist/build/fw.spa.pure.min.js +41 -38
- package/dist/build/sanity-base-classic.min.js +1 -1
- package/dist/build/sanity.min.js +1 -1
- package/dist/types/core/internal.d.ts +29 -0
- package/dist/types/core/internal.d.ts.map +1 -0
- package/dist/types/core/logger.d.ts +23 -4
- package/dist/types/core/logger.d.ts.map +1 -1
- package/dist/types/core/modules.d.ts +374 -61
- package/dist/types/core/modules.d.ts.map +1 -1
- package/dist/types/core/runtime.d.ts +10 -6
- package/dist/types/core/runtime.d.ts.map +1 -1
- package/dist/types/core/worker-helper.d.ts +35 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -1
- package/dist/types/crypto/cipher/aes.d.ts +1 -7
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -1
- package/dist/types/crypto/cipher/chacha20.d.ts +0 -10
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -1
- package/dist/types/crypto/hash/argon2.d.ts +0 -15
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -1
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -1
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -1
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha224.d.ts +1 -1
- package/dist/types/crypto/hash/sha256.d.ts +4 -13
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha384.d.ts +1 -1
- package/dist/types/crypto/hash/sha512.d.ts +4 -13
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -1
- package/dist/types/crypto/mode/cmac.d.ts +0 -6
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -1
- package/dist/types/crypto/mode/ctr.d.ts +0 -6
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -1
- package/dist/types/crypto/mode/gcm.d.ts +0 -9
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ecc.d.ts +0 -1
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ed25519.d.ts +4 -25
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -1
- package/dist/types/crypto/pkc/hybridSign.d.ts +25 -5
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_dsa.d.ts +6 -26
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_kem.d.ts +0 -43
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -1
- package/dist/types/crypto/pkc/rsa.d.ts +0 -24
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/slh_dsa.d.ts +6 -16
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/x25519.d.ts +0 -6
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -1
- package/dist/types/crypto/utils/bitArray.d.ts +0 -8
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -1
- package/dist/types/crypto/utils/jws.d.ts +6 -14
- package/dist/types/crypto/utils/jws.d.ts.map +1 -1
- package/dist/types/crypto/utils/keyformat.d.ts +52 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -1
- package/dist/types/crypto/utils/random.d.ts +1 -10
- package/dist/types/crypto/utils/random.d.ts.map +1 -1
- package/dist/types/crypto/utils/rsaKeygen.d.ts +0 -10
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -1
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -1
- package/dist/types/crypto/utils/x509.d.ts +397 -0
- package/dist/types/crypto/utils/x509.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +2 -1
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/pbkdf2.d.ts +2 -2
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -1
- package/dist/types/crypto/wasm/runtime.d.ts +13 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/digest.d.ts +0 -4
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -1
- package/dist/types/dom/fs/fileIntake.d.ts +59 -0
- package/dist/types/dom/fs/fileIntake.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -1
- package/dist/types/dom/query/dnd.d.ts.map +1 -1
- package/dist/types/dom/query/sound.d.ts +89 -0
- package/dist/types/dom/query/sound.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -1
- package/dist/types/dom/rendering/component.d.ts +9 -3
- package/dist/types/dom/rendering/component.d.ts.map +1 -1
- package/dist/types/dom/rendering/parser.d.ts +39 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -1
- package/dist/types/dom/rendering/render.d.ts.map +1 -1
- package/dist/types/dom/rendering/sanitize.d.ts +4 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -1
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -1
- package/dist/types/dom/rendering/styleSheet.d.ts +74 -0
- package/dist/types/dom/rendering/styleSheet.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +9 -3
- package/dist/types/dom/rendering/template.d.ts.map +1 -1
- package/dist/types/dom/rendering/themeTokens.d.ts +9 -3
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-core.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-list.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession.d.ts +18 -6
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -1
- package/dist/types/dom/sw/installPrompt.d.ts +89 -0
- package/dist/types/dom/sw/installPrompt.d.ts.map +1 -0
- package/dist/types/dom/sw/precache.d.ts +149 -0
- package/dist/types/dom/sw/precache.d.ts.map +1 -0
- package/dist/types/dom/sw/swUpdate.d.ts +129 -0
- package/dist/types/dom/sw/swUpdate.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +8 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -1
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -1
- package/dist/types/dom/utils/route.d.ts.map +1 -1
- package/dist/types/dom/utils/ua.d.ts +2 -2
- package/dist/types/dom/utils/ua.d.ts.map +1 -1
- package/dist/types/io/calc/crc32.d.ts.map +1 -1
- package/dist/types/io/codec/b64.d.ts +24 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -1
- package/dist/types/io/codec/cbor.d.ts +1 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -1
- package/dist/types/io/codec/hex.d.ts.map +1 -1
- package/dist/types/io/codec/msgpack.d.ts +1 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -1
- package/dist/types/io/codec/url.d.ts +3 -1
- package/dist/types/io/codec/url.d.ts.map +1 -1
- package/dist/types/io/codec/utf8.d.ts.map +1 -1
- package/dist/types/io/compress/bitstream.d.ts +1 -1
- package/dist/types/io/compress/brotli.d.ts +0 -1
- package/dist/types/io/compress/brotli.d.ts.map +1 -1
- package/dist/types/io/compress/brotli_shared.d.ts +0 -4
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -1
- package/dist/types/io/compress/deflate.d.ts +14 -1
- package/dist/types/io/compress/deflate.d.ts.map +1 -1
- package/dist/types/io/compress/gzip.d.ts +4 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -1
- package/dist/types/io/compress/huffman.d.ts +7 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -1
- package/dist/types/io/compress/lz4.d.ts +4 -2
- package/dist/types/io/compress/lz4.d.ts.map +1 -1
- package/dist/types/io/compress/lz77.d.ts +17 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -1
- package/dist/types/io/compress/lzw.d.ts +2 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -1
- package/dist/types/io/compress/zip.d.ts.map +1 -1
- package/dist/types/io/compress/zlib.d.ts +9 -2
- package/dist/types/io/compress/zlib.d.ts.map +1 -1
- package/dist/types/io/math/linalg.d.ts.map +1 -1
- package/dist/types/process/rpc.d.ts.map +1 -1
- package/dist/types/process/workerPool.d.ts.map +1 -1
- package/dist/types/sanity/base.d.ts +12 -2
- package/dist/types/sanity/base.d.ts.map +1 -1
- package/dist/types/sanity/lockdown.d.ts +6 -5
- package/dist/types/sanity/lockdown.d.ts.map +1 -1
- package/dist/types/sanity/wasm-gate.d.ts +1 -1
- package/docs/README.md +17 -10
- package/docs/api/README.md +5 -5
- package/docs/api/core/logger.md +2 -1
- package/docs/api/core/modules.md +3 -3
- package/docs/api/core/runtime.md +9 -9
- package/docs/api/core/worker-helper.md +12 -2
- package/docs/api/crypto/README.md +1 -1
- package/docs/api/crypto/cipher/README.md +2 -2
- package/docs/api/crypto/cipher/aes.md +5 -10
- package/docs/api/crypto/cipher/chacha20.md +3 -8
- package/docs/api/crypto/hash/README.md +5 -5
- package/docs/api/crypto/hash/adf.md +21 -11
- package/docs/api/crypto/hash/argon2.md +3 -12
- package/docs/api/crypto/hash/blake2b.md +12 -14
- package/docs/api/crypto/hash/pbkdf2.md +1 -1
- package/docs/api/crypto/hash/sha224.md +2 -2
- package/docs/api/crypto/hash/sha256.md +4 -4
- package/docs/api/crypto/hash/sha3.md +2 -2
- package/docs/api/crypto/hash/sha384.md +1 -1
- package/docs/api/crypto/hash/sha512.md +5 -5
- package/docs/api/crypto/hash/sha512_224.md +1 -1
- package/docs/api/crypto/hash/sha512_256.md +1 -1
- package/docs/api/crypto/mode/README.md +3 -3
- package/docs/api/crypto/mode/cbc.md +2 -2
- package/docs/api/crypto/mode/chacha20poly1305.md +1 -1
- package/docs/api/crypto/mode/cmac.md +4 -4
- package/docs/api/crypto/mode/ctr.md +2 -3
- package/docs/api/crypto/mode/gcm.md +5 -5
- package/docs/api/crypto/mode/kw.md +4 -4
- package/docs/api/crypto/pkc/README.md +8 -8
- package/docs/api/crypto/pkc/ecc.md +19 -17
- package/docs/api/crypto/pkc/ed25519.md +10 -15
- package/docs/api/crypto/pkc/hybridKem.md +8 -2
- package/docs/api/crypto/pkc/hybridSign.md +34 -7
- package/docs/api/crypto/pkc/ml_dsa.md +20 -19
- package/docs/api/crypto/pkc/ml_kem.md +3 -3
- package/docs/api/crypto/pkc/rsa.md +7 -9
- package/docs/api/crypto/pkc/slh_dsa.md +12 -12
- package/docs/api/crypto/pkc/x25519.md +5 -4
- package/docs/api/crypto/utils/README.md +7 -7
- package/docs/api/crypto/utils/aes_modes.md +2 -5
- package/docs/api/crypto/utils/asn1.md +25 -16
- package/docs/api/crypto/utils/jws.md +6 -4
- package/docs/api/crypto/utils/keyformat.md +24 -15
- package/docs/api/crypto/utils/pad.md +1 -1
- package/docs/api/crypto/utils/pem.md +3 -3
- package/docs/api/crypto/utils/random.md +3 -4
- package/docs/api/crypto/utils/rsaKeygen.md +2 -2
- package/docs/api/crypto/utils/totp.md +2 -2
- package/docs/api/crypto/utils/uuid.md +5 -5
- package/docs/api/crypto/utils/x509.md +124 -0
- package/docs/api/crypto/wasm/aes.md +1 -1
- package/docs/api/crypto/wasm/argon2.md +6 -4
- package/docs/api/crypto/wasm/ml_kem.md +1 -0
- package/docs/api/crypto/wasm/pbkdf2.md +8 -8
- package/docs/api/crypto/wasm/rsa.md +1 -1
- package/docs/api/crypto/wasm/runtime.md +27 -10
- package/docs/api/crypto/webcrypto/aes.md +1 -1
- package/docs/api/crypto/webcrypto/aeskw.md +2 -2
- package/docs/api/crypto/webcrypto/digest.md +3 -5
- package/docs/api/crypto/webcrypto/ecc.md +1 -1
- package/docs/api/crypto/webcrypto/ed25519.md +1 -1
- package/docs/api/crypto/webcrypto/rsa.md +3 -2
- package/docs/api/crypto/webcrypto/x25519.md +1 -1
- package/docs/api/dom/README.md +6 -1
- package/docs/api/dom/fs/README.md +1 -0
- package/docs/api/dom/fs/fileIntake.md +120 -0
- package/docs/api/dom/fs/fsAccess.md +1 -0
- package/docs/api/dom/fs/indexedDB.md +1 -1
- package/docs/api/dom/fs/storage.md +1 -1
- package/docs/api/dom/query/README.md +2 -1
- package/docs/api/dom/query/dnd.md +4 -1
- package/docs/api/dom/query/dom.md +5 -0
- package/docs/api/dom/query/sound.md +103 -0
- package/docs/api/dom/rendering/README.md +4 -3
- package/docs/api/dom/rendering/chart.md +5 -4
- package/docs/api/dom/rendering/component.md +25 -3
- package/docs/api/dom/rendering/parser.md +5 -2
- package/docs/api/dom/rendering/reactiveBind.md +1 -1
- package/docs/api/dom/rendering/render.md +2 -2
- package/docs/api/dom/rendering/sanitize.md +10 -2
- package/docs/api/dom/rendering/secPolicy.md +4 -4
- package/docs/api/dom/rendering/styleSheet.md +85 -0
- package/docs/api/dom/rendering/template.md +20 -5
- package/docs/api/dom/rendering/themeTokens.md +6 -3
- package/docs/api/dom/rendering/uiSession.md +18 -5
- package/docs/api/dom/rendering/virtualScroll.md +2 -2
- package/docs/api/dom/sensors/geolocation.md +1 -1
- package/docs/api/dom/sw/README.md +7 -1
- package/docs/api/dom/sw/cache.md +2 -1
- package/docs/api/dom/sw/installPrompt.md +111 -0
- package/docs/api/dom/sw/precache.md +124 -0
- package/docs/api/dom/sw/serviceWorker.md +4 -2
- package/docs/api/dom/sw/swUpdate.md +112 -0
- package/docs/api/dom/utils/clipboard.md +56 -5
- package/docs/api/dom/utils/entropyCollector.md +1 -1
- package/docs/api/dom/utils/keybindings.md +17 -2
- package/docs/api/dom/utils/leaderElection.md +2 -2
- package/docs/api/dom/utils/route.md +1 -0
- package/docs/api/dom/utils/ua.md +15 -10
- package/docs/api/io/calc/crc32.md +4 -1
- package/docs/api/io/codec/README.md +2 -2
- package/docs/api/io/codec/b64.md +31 -2
- package/docs/api/io/codec/buffer.md +1 -1
- package/docs/api/io/codec/cbor.md +6 -4
- package/docs/api/io/codec/csv.md +178 -178
- package/docs/api/io/codec/hex.md +10 -2
- package/docs/api/io/codec/msgpack.md +4 -3
- package/docs/api/io/codec/url.md +4 -3
- package/docs/api/io/codec/utf8.md +3 -3
- package/docs/api/io/compress/bitstream.md +6 -3
- package/docs/api/io/compress/brotli.md +36 -4
- package/docs/api/io/compress/brotli_shared.md +1 -1
- package/docs/api/io/compress/deflate.md +42 -34
- package/docs/api/io/compress/gzip.md +26 -6
- package/docs/api/io/compress/huffman.md +2 -1
- package/docs/api/io/compress/lz4.md +5 -3
- package/docs/api/io/compress/lz77.md +26 -3
- package/docs/api/io/compress/lzw.md +13 -8
- package/docs/api/io/compress/zip.md +36 -10
- package/docs/api/io/compress/zlib.md +21 -5
- package/docs/api/io/math/linalg.md +1 -1
- package/docs/api/io/utils/valid.md +1 -1
- package/docs/api/process/rpc.md +3 -2
- package/docs/api/process/workerPool.md +1 -1
- package/docs/api/sanity/base.md +9 -5
- package/docs/api/sanity/lockdown.md +7 -6
- package/docs/api/surface.json +12311 -0
- package/docs/api/typed.md +5 -3
- package/docs/dev/README.md +2 -0
- package/docs/dev/bench.md +76 -0
- package/docs/dev/crypto-references.md +54 -0
- package/docs/dev/provenance.md +30 -7
- package/docs/dev/publishing.md +7 -7
- package/docs/dev/runtime.md +1 -1
- package/docs/dev/testing.md +13 -0
- package/docs/evidence/l4-evidence.md +86 -0
- package/docs/evidence/pqc-hybrid-evidence.md +7 -6
- package/docs/guide/README.md +1 -0
- package/docs/guide/_QUICK_REF.md +5 -5
- package/docs/guide/doc-format.md +4 -3
- package/docs/guide/integrations-hmr.md +1 -1
- package/docs/guide/module-creation-workflow.md +8 -8
- package/docs/guide/rendering-pipeline.md +11 -4
- package/docs/guide/security.md +7 -5
- package/docs/guide/stability.md +123 -0
- package/docs/guide/tutorial-todo.md +20 -8
- package/docs/guide/typescript.md +9 -0
- package/docs/guide/worker-confinement.md +30 -17
- package/docs/notes/lz77-deflate-factorization.md +3 -3
- package/docs/tools/README.md +1 -1
- package/docs/tools/bundler.md +3 -3
- package/docs/tools/codegen.md +1 -1
- package/docs/tools/standalone.md +0 -1
- package/fw.config.json +2 -2
- package/integrations/_shared/catalog.generated.json +7 -1
- package/integrations/_shared/core.js +1 -1
- package/integrations/astro/index.js +1 -1
- package/integrations/eslint/README.md +7 -1
- package/integrations/nextjs/index.js +1 -1
- package/integrations/nodejs/README.md +3 -3
- package/integrations/turbopack/index.js +2 -2
- package/integrations/typedoc/categorize.js +1 -1
- package/integrations/typedoc/typedoc.json +2 -1
- package/integrations/vite/index.js +2 -2
- package/integrations/vite/vite-env.d.ts +7 -4
- package/integrations/webpack/index.js +3 -3
- package/package.json +76 -10
- package/src/core/internal.js +31 -0
- package/src/core/logger.js +95 -23
- package/src/core/modules.js +17 -8
- package/src/core/readyState.js +1 -1
- package/src/core/runtime.js +74 -27
- package/src/core/worker-helper.js +83 -4
- package/src/crypto/NIST_CONFORMANCE.md +47 -34
- package/src/crypto/cipher/aes.acvp.md +7 -8
- package/src/crypto/cipher/aes.js +280 -229
- package/src/crypto/cipher/chacha20.acvp.md +6 -7
- package/src/crypto/cipher/chacha20.js +91 -61
- package/src/crypto/hash/adf.js +1 -1
- package/src/crypto/hash/argon2.acvp.md +11 -15
- package/src/crypto/hash/argon2.js +9 -24
- package/src/crypto/hash/blake2b.js +157 -125
- package/src/crypto/hash/hkdf.acvp.md +15 -15
- package/src/crypto/hash/hkdf.js +1 -1
- package/src/crypto/hash/hmac.acvp.md +10 -12
- package/src/crypto/hash/hmac.js +5 -1
- package/src/crypto/hash/pbkdf2.acvp.md +13 -13
- package/src/crypto/hash/pbkdf2.js +36 -8
- package/src/crypto/hash/poly1305.acvp.md +10 -6
- package/src/crypto/hash/poly1305.js +171 -50
- package/src/crypto/hash/sha224.acvp.md +3 -3
- package/src/crypto/hash/sha224.js +4 -4
- package/src/crypto/hash/sha256.acvp.md +2 -2
- package/src/crypto/hash/sha256.js +514 -50
- package/src/crypto/hash/sha3.acvp.md +9 -9
- package/src/crypto/hash/sha3.js +127 -71
- package/src/crypto/hash/sha384.acvp.md +3 -3
- package/src/crypto/hash/sha384.js +4 -4
- package/src/crypto/hash/sha512.acvp.md +7 -8
- package/src/crypto/hash/sha512.js +107 -108
- package/src/crypto/hash/sha512_224.acvp.md +6 -6
- package/src/crypto/hash/sha512_224.js +2 -2
- package/src/crypto/hash/sha512_256.acvp.md +6 -6
- package/src/crypto/hash/sha512_256.js +2 -2
- package/src/crypto/mode/cbc.acvp.md +2 -2
- package/src/crypto/mode/cbc.js +1 -1
- package/src/crypto/mode/chacha20poly1305.acvp.md +6 -6
- package/src/crypto/mode/chacha20poly1305.js +3 -3
- package/src/crypto/mode/cmac.acvp.md +5 -5
- package/src/crypto/mode/cmac.js +8 -8
- package/src/crypto/mode/ctr.acvp.md +2 -2
- package/src/crypto/mode/ctr.js +1 -3
- package/src/crypto/mode/gcm.acvp.md +6 -6
- package/src/crypto/mode/gcm.js +7 -7
- package/src/crypto/mode/kw.acvp.md +4 -4
- package/src/crypto/mode/kw.js +5 -5
- package/src/crypto/pkc/ecc.acvp.md +13 -13
- package/src/crypto/pkc/ecc.js +9 -11
- package/src/crypto/pkc/ed25519.acvp.md +30 -34
- package/src/crypto/pkc/ed25519.js +453 -94
- package/src/crypto/pkc/hybrid-kat.provenance.md +4 -4
- package/src/crypto/pkc/hybridSign.js +103 -24
- package/src/crypto/pkc/ml_dsa.acvp.md +18 -18
- package/src/crypto/pkc/ml_dsa.js +29 -32
- package/src/crypto/pkc/ml_kem.acvp.md +7 -7
- package/src/crypto/pkc/ml_kem.js +15 -21
- package/src/crypto/pkc/rsa.acvp.md +11 -15
- package/src/crypto/pkc/rsa.js +7 -44
- package/src/crypto/pkc/slh_dsa.acvp.md +16 -16
- package/src/crypto/pkc/slh_dsa.js +16 -18
- package/src/crypto/pkc/x25519.acvp.md +13 -10
- package/src/crypto/pkc/x25519.js +273 -29
- package/src/crypto/utils/aes_modes.acvp.md +1 -2
- package/src/crypto/utils/aes_modes.js +2 -2
- package/src/crypto/utils/asn1-oid.js +1 -1
- package/src/crypto/utils/asn1.js +1 -1
- package/src/crypto/utils/bitArray.js +33 -48
- package/src/crypto/utils/bn.js +1 -1
- package/src/crypto/utils/jws.js +37 -41
- package/src/crypto/utils/keyformat.js +181 -2
- package/src/crypto/utils/pem.js +1 -1
- package/src/crypto/utils/random.acvp.md +5 -5
- package/src/crypto/utils/random.js +845 -846
- package/src/crypto/utils/rsaKeygen.acvp.md +3 -2
- package/src/crypto/utils/rsaKeygen.js +6 -6
- package/src/crypto/utils/totp.js +1 -1
- package/src/crypto/utils/uuid.acvp.md +5 -5
- package/src/crypto/utils/uuid.js +11 -10
- package/src/crypto/utils/x509.js +591 -0
- package/src/crypto/wasm/aes.js +1 -1
- package/src/crypto/wasm/aes.scalar.wasm +0 -0
- package/src/crypto/wasm/argon2.js +17 -1
- package/src/crypto/wasm/argon2.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.simd.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.scalar.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.simd.wasm +0 -0
- package/src/crypto/wasm/cmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ecc.js +3 -3
- package/src/crypto/wasm/ecc.scalar.wasm +0 -0
- package/src/crypto/wasm/ed25519.js +1 -1
- package/src/crypto/wasm/ed25519.scalar.wasm +0 -0
- package/src/crypto/wasm/hkdf.scalar.wasm +0 -0
- package/src/crypto/wasm/hmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.js +2 -2
- package/src/crypto/wasm/ml_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.simd.wasm +0 -0
- package/src/crypto/wasm/ml_kem.js +2 -2
- package/src/crypto/wasm/ml_kem.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_kem.simd.wasm +0 -0
- package/src/crypto/wasm/pbkdf2.js +8 -6
- package/src/crypto/wasm/pbkdf2.scalar.wasm +0 -0
- package/src/crypto/wasm/rsa.js +6 -5
- package/src/crypto/wasm/rsa.scalar.wasm +0 -0
- package/src/crypto/wasm/runtime.js +84 -17
- package/src/crypto/wasm/sha2.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.simd.wasm +0 -0
- package/src/crypto/wasm/slh_dsa.js +1 -1
- package/src/crypto/wasm/slh_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/x25519.js +1 -1
- package/src/crypto/wasm/x25519.scalar.wasm +0 -0
- package/src/crypto/webcrypto/aes.js +8 -2
- package/src/crypto/webcrypto/aeskw.js +7 -2
- package/src/crypto/webcrypto/digest.js +1 -15
- package/src/crypto/webcrypto/ecc.js +2 -2
- package/src/crypto/webcrypto/ed25519.js +2 -2
- package/src/crypto/webcrypto/hmac.js +2 -2
- package/src/crypto/webcrypto/rsa.js +7 -2
- package/src/crypto/webcrypto/x25519.js +2 -2
- package/src/dom/display/animate.js +1 -1
- package/src/dom/display/fullscreen.js +1 -1
- package/src/dom/fs/download.js +1 -1
- package/src/dom/fs/fileIntake.js +192 -0
- package/src/dom/fs/fsAccess.js +2 -3
- package/src/dom/fs/indexedDB.js +1 -1
- package/src/dom/fs/remoteStore.js +1 -1
- package/src/dom/fs/storage.js +1 -1
- package/src/dom/lifecycle/idle.js +1 -1
- package/src/dom/lifecycle/visibility.js +1 -1
- package/src/dom/lifecycle/wakeLock.js +1 -1
- package/src/dom/net/ajax.js +1 -1
- package/src/dom/net/network.js +1 -1
- package/src/dom/net/sse.js +1 -1
- package/src/dom/net/webrtc.js +1 -1
- package/src/dom/net/ws.js +1 -1
- package/src/dom/query/dnd.js +56 -4
- package/src/dom/query/dom.js +1 -1
- package/src/dom/query/events.js +1 -1
- package/src/dom/query/gesture.js +1 -1
- package/src/dom/query/media.js +1 -1
- package/src/dom/query/sound.js +333 -0
- package/src/dom/rendering/chart.js +736 -663
- package/src/dom/rendering/component.js +25 -14
- package/src/dom/rendering/devtools.js +2 -2
- package/src/dom/rendering/parser.js +155 -12
- package/src/dom/rendering/render.js +14 -4
- package/src/dom/rendering/sanitize.js +11 -4
- package/src/dom/rendering/secPolicy.js +6 -4
- package/src/dom/rendering/styleSheet.js +217 -0
- package/src/dom/rendering/template.js +72 -13
- package/src/dom/rendering/themeTokens.js +542 -522
- package/src/dom/rendering/uiSession-core.js +51 -6
- package/src/dom/rendering/uiSession-direct.js +1 -1
- package/src/dom/rendering/uiSession-list.js +4 -4
- package/src/dom/rendering/uiSession.js +1 -1
- package/src/dom/rendering/virtualScroll.js +341 -341
- package/src/dom/sensors/battery.js +1 -1
- package/src/dom/sensors/geolocation.js +1 -1
- package/src/dom/sensors/networkInfo.js +1 -1
- package/src/dom/sensors/sensors.js +1 -1
- package/src/dom/sw/backgroundSync.js +1 -1
- package/src/dom/sw/cache.js +1 -1
- package/src/dom/sw/installPrompt.js +151 -0
- package/src/dom/sw/precache.js +257 -0
- package/src/dom/sw/push.js +1 -1
- package/src/dom/sw/sharedWorker.js +1 -1
- package/src/dom/sw/swUpdate.js +239 -0
- package/src/dom/utils/a11y.js +1 -1
- package/src/dom/utils/clipboard.js +56 -6
- package/src/dom/utils/entropyCollector.js +1 -1
- package/src/dom/utils/focus.js +1 -1
- package/src/dom/utils/form.js +1 -1
- package/src/dom/utils/keybindings.js +600 -574
- package/src/dom/utils/leaderElection.js +1 -1
- package/src/dom/utils/notifications.js +1 -1
- package/src/dom/utils/permissions.js +107 -107
- package/src/dom/utils/route.js +14 -2
- package/src/dom/utils/ua.js +42 -28
- package/src/dom/utils/webauthn.js +1 -1
- package/src/io/binary/reader.js +1 -1
- package/src/io/binary/writer.js +1 -1
- package/src/io/calc/bigint.js +1 -1
- package/src/io/calc/crc32.js +28 -2
- package/src/io/calc/easing.js +514 -514
- package/src/io/codec/b64.js +189 -52
- package/src/io/codec/base32.js +1 -1
- package/src/io/codec/base58.js +1 -1
- package/src/io/codec/buffer.js +1 -1
- package/src/io/codec/cbor.js +111 -18
- package/src/io/codec/csv.js +1 -1
- package/src/io/codec/hex.js +51 -6
- package/src/io/codec/mime.js +1 -1
- package/src/io/codec/msgpack.js +47 -6
- package/src/io/codec/url.js +24 -7
- package/src/io/codec/utf8.js +5 -3
- package/src/io/codec/xml.js +1 -1
- package/src/io/compress/bitstream.js +2 -2
- package/src/io/compress/brotli.js +663 -163
- package/src/io/compress/brotli_dict.js +1 -1
- package/src/io/compress/brotli_dict_words.js +1 -1
- package/src/io/compress/brotli_frame.js +1 -1
- package/src/io/compress/brotli_shared.js +7 -7
- package/src/io/compress/deflate.js +87 -53
- package/src/io/compress/gzip.js +187 -74
- package/src/io/compress/huffman.js +24 -1
- package/src/io/compress/lz4.js +45 -7
- package/src/io/compress/lz77.js +148 -63
- package/src/io/compress/lzw.js +35 -19
- package/src/io/compress/zip.js +862 -815
- package/src/io/compress/zlib.js +87 -7
- package/src/io/i18n/i18n.js +1 -1
- package/src/io/math/fixed-point.js +1 -1
- package/src/io/math/geom.js +1 -1
- package/src/io/math/interp.js +1 -1
- package/src/io/math/linalg.js +10 -4
- package/src/io/math/stats.js +1 -1
- package/src/io/structures/btree.js +1 -1
- package/src/io/structures/heap.js +1 -1
- package/src/io/structures/lruCache.js +1 -1
- package/src/io/structures/ringBuffer.js +1 -1
- package/src/io/structures/tree-walker.js +1 -1
- package/src/io/structures/trie.js +1 -1
- package/src/io/sync/abort.js +1 -1
- package/src/io/sync/atomics.js +1 -1
- package/src/io/sync/cancellable.js +1 -1
- package/src/io/sync/channel.js +1 -1
- package/src/io/sync/mutex.js +1 -1
- package/src/io/sync/semaphore.js +1 -1
- package/src/io/sync/tokenBucket.js +1 -1
- package/src/io/text/ansi.js +1 -1
- package/src/io/text/html-entities.js +1 -1
- package/src/io/time/date.js +1 -1
- package/src/io/timing/clock.js +1 -1
- package/src/io/timing/rateLimit.js +1 -1
- package/src/io/timing/scheduler.js +1 -1
- package/src/io/utils/errors.js +1 -1
- package/src/io/utils/eventBus.js +1 -1
- package/src/io/utils/signal.js +1 -1
- package/src/io/utils/valid.js +1 -1
- package/src/main.js +1 -1
- package/src/process/message.js +1 -1
- package/src/process/rpc.js +7 -3
- package/src/process/workerPool.js +11 -4
- package/src/sanity/base.js +85 -39
- package/src/sanity/lockdown-apply.js +3 -3
- package/src/sanity/lockdown.js +58 -32
- package/src/sanity/wasm-gate.js +2 -2
- package/src/typed.js +7 -3
- package/third-party/NOTICE-brotli-dictionary.txt +69 -0
- package/third-party/NOTICE-fw-wasm-crypto.txt +576 -0
- package/third-party/NOTICE-whatwg-entities.txt +44 -0
- package/types/registry.generated.d.ts +7 -1
- package/types/typed.d.ts +7 -3
- package/dist/types/crypto/utils/aes_ctr.d.ts +0 -84
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +0 -1
- package/docs/api/crypto/utils/aes_ctr.md +0 -71
- package/src/crypto/utils/aes_ctr.acvp.md +0 -67
- package/src/crypto/utils/aes_ctr.js +0 -134
package/src/sanity/base.js
CHANGED
|
@@ -58,6 +58,7 @@ const BLOCKED_DOCUMENT_APIS = [
|
|
|
58
58
|
'write', 'writeln', 'open', 'close', 'execCommand', 'execScript', 'evaluate', 'implementation', 'createContextualFragment'
|
|
59
59
|
];
|
|
60
60
|
const BLOCKED_ELEMENT_APIS = ['setHTML', 'evaluate'];
|
|
61
|
+
const BLOCKED_RANGE_APIS = ['createContextualFragment'];
|
|
61
62
|
|
|
62
63
|
const BLOCKED_HISTORY_APIS = [
|
|
63
64
|
'pushState', 'replaceState', 'go', 'back', 'forward'
|
|
@@ -88,7 +89,7 @@ function logAttempt(api, operation) {
|
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
function blockPropertyAccess(obj, propertyNames, objName = 'object') {
|
|
92
|
+
function blockPropertyAccess(obj, propertyNames, objName = 'object', fail = null) {
|
|
92
93
|
if (!obj) return;
|
|
93
94
|
propertyNames.forEach(propertyName => {
|
|
94
95
|
try {
|
|
@@ -109,26 +110,41 @@ function blockPropertyAccess(obj, propertyNames, objName = 'object') {
|
|
|
109
110
|
});
|
|
110
111
|
} catch (e) {
|
|
111
112
|
console.warn(`Cannot block ${objName}.${propertyName}:`, e.message);
|
|
113
|
+
if (fail) fail(`${objName}.${propertyName}`, e);
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
function redirectPropertySetter(obj, sourceProperties, targetProperties) {
|
|
118
|
+
function redirectPropertySetter(obj, sourceProperties, targetProperties, fail = null) {
|
|
117
119
|
sourceProperties.forEach((sourceProp, index) => {
|
|
118
120
|
const targetProp = targetProperties[index];
|
|
119
121
|
try {
|
|
120
|
-
Object.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const current = Object.getOwnPropertyDescriptor(obj, sourceProp);
|
|
123
|
+
if (current && typeof current.value === 'function') {
|
|
124
|
+
// A METHOD (insertAdjacentHTML): a set-only accessor would leave
|
|
125
|
+
// no getter, so the call would throw instead of inserting text.
|
|
126
|
+
Object.defineProperty(obj, sourceProp, {
|
|
127
|
+
value: function (position, value) {
|
|
128
|
+
return this[targetProp](position, value);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
// An accessor (innerHTML, outerHTML): only the setter is
|
|
133
|
+
// replaced; the existing getter is kept.
|
|
134
|
+
Object.defineProperty(obj, sourceProp, {
|
|
135
|
+
set: function (value) {
|
|
136
|
+
this[targetProp] = value;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
125
140
|
} catch (e) {
|
|
126
141
|
console.warn(`Cannot redirect ${sourceProp}:`, e.message);
|
|
142
|
+
if (fail) fail(`Element.prototype.${sourceProp}`, e);
|
|
127
143
|
}
|
|
128
144
|
});
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
function freezePrototypes() {
|
|
147
|
+
function freezePrototypes(fail = null) {
|
|
132
148
|
const prototypes = [
|
|
133
149
|
Object.prototype,
|
|
134
150
|
Array.prototype,
|
|
@@ -142,14 +158,20 @@ function freezePrototypes() {
|
|
|
142
158
|
];
|
|
143
159
|
|
|
144
160
|
prototypes.forEach(proto => {
|
|
161
|
+
const protoName = (proto.constructor && proto.constructor.name) + '.prototype';
|
|
145
162
|
try {
|
|
146
|
-
// Prevent __proto__ manipulation
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
163
|
+
// Prevent __proto__ manipulation. Only Object.prototype owns the
|
|
164
|
+
// __proto__ accessor: a set-only accessor defined on any other
|
|
165
|
+
// prototype would shadow the inherited getter (`[].__proto__` would
|
|
166
|
+
// read undefined). Every object inherits the guarded setter.
|
|
167
|
+
if (proto === Object.prototype) {
|
|
168
|
+
Object.defineProperty(proto, '__proto__', {
|
|
169
|
+
set: function () {
|
|
170
|
+
logAttempt('prototype.__proto__', 'set');
|
|
171
|
+
throw new Error(BLOCKED_MESSAGE);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
153
175
|
|
|
154
176
|
Object.defineProperty(proto, 'constructor', {
|
|
155
177
|
writable: false,
|
|
@@ -159,6 +181,7 @@ function freezePrototypes() {
|
|
|
159
181
|
Object.freeze(proto);
|
|
160
182
|
} catch (e) {
|
|
161
183
|
console.warn('Cannot freeze prototype:', e.message);
|
|
184
|
+
if (fail) fail(protoName, e);
|
|
162
185
|
}
|
|
163
186
|
});
|
|
164
187
|
}
|
|
@@ -215,7 +238,7 @@ function blockJSONParsing() {
|
|
|
215
238
|
Object.freeze(JSON);
|
|
216
239
|
}
|
|
217
240
|
|
|
218
|
-
function blockDangerousElements() {
|
|
241
|
+
function blockDangerousElements(fail = null) {
|
|
219
242
|
// The tag→constructor table is built HERE, not at module scope: it
|
|
220
243
|
// references HTMLIFrameElement/HTMLObjectElement/HTMLEmbedElement, which do
|
|
221
244
|
// not exist in a non-browser realm. At module scope it would throw a
|
|
@@ -242,6 +265,7 @@ function blockDangerousElements() {
|
|
|
242
265
|
});
|
|
243
266
|
} catch (e) {
|
|
244
267
|
console.warn(`Cannot block ${tag}.${prop}:`, e.message);
|
|
268
|
+
if (fail) fail(`${tag}.${prop}`, e);
|
|
245
269
|
}
|
|
246
270
|
});
|
|
247
271
|
});
|
|
@@ -263,7 +287,7 @@ function disableDebugger() {
|
|
|
263
287
|
}
|
|
264
288
|
}
|
|
265
289
|
|
|
266
|
-
function blockPerformanceAPIs() {
|
|
290
|
+
function blockPerformanceAPIs(fail = null) {
|
|
267
291
|
// Block high-resolution timing
|
|
268
292
|
try {
|
|
269
293
|
const originalNow = Date.now;
|
|
@@ -276,10 +300,11 @@ function blockPerformanceAPIs() {
|
|
|
276
300
|
});
|
|
277
301
|
} catch (e) {
|
|
278
302
|
console.warn('Cannot modify Date.now:', e.message);
|
|
303
|
+
if (fail) fail('Date.now', e);
|
|
279
304
|
}
|
|
280
305
|
}
|
|
281
306
|
|
|
282
|
-
function blockMathRandom() {
|
|
307
|
+
function blockMathRandom(fail = null) {
|
|
283
308
|
// Replace Math.random with blocked version (should use crypto.getRandomValues in production)
|
|
284
309
|
const blockedRandom = function () {
|
|
285
310
|
logAttempt('Math.random', 'call');
|
|
@@ -294,6 +319,7 @@ function blockMathRandom() {
|
|
|
294
319
|
});
|
|
295
320
|
} catch (e) {
|
|
296
321
|
console.warn('Cannot block Math.random:', e.message);
|
|
322
|
+
if (fail) fail('Math.random', e);
|
|
297
323
|
}
|
|
298
324
|
}
|
|
299
325
|
|
|
@@ -310,45 +336,64 @@ function blockMathRandom() {
|
|
|
310
336
|
*
|
|
311
337
|
* The returned `steps` list names each hardening pass in application order.
|
|
312
338
|
* Prototype freezing runs FIRST by design (most critical, and later passes
|
|
313
|
-
* install setters that must survive it).
|
|
339
|
+
* install setters that must survive it). A pass is listed once it ran; the
|
|
340
|
+
* individual slots it could not harden (a non-configurable property, a frozen
|
|
341
|
+
* namespace) are listed in `failures`, one `{ step, target, message }` entry
|
|
342
|
+
* each, `[]` on a clean apply. They are also warned on the console.
|
|
314
343
|
*
|
|
315
|
-
* @returns {{applied: boolean, reason?: string, steps: string[]
|
|
344
|
+
* @returns {{applied: boolean, reason?: string, steps: string[],
|
|
345
|
+
* failures: Array<{step: string, target: string, message: string}>}}
|
|
346
|
+
* report of what was applied
|
|
316
347
|
*/
|
|
317
348
|
export function applyBase() {
|
|
318
|
-
if (_applied) return { applied: false, reason: 'already-applied', steps: [] };
|
|
349
|
+
if (_applied) return { applied: false, reason: 'already-applied', steps: [], failures: [] };
|
|
319
350
|
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
320
|
-
return { applied: false, reason: 'non-browser-realm', steps: [] };
|
|
351
|
+
return { applied: false, reason: 'non-browser-realm', steps: [], failures: [] };
|
|
321
352
|
}
|
|
322
353
|
_applied = true;
|
|
323
354
|
|
|
324
355
|
/** @type {string[]} */
|
|
325
356
|
const steps = [];
|
|
357
|
+
/** @type {Array<{step: string, target: string, message: string}>} */
|
|
358
|
+
const failures = [];
|
|
359
|
+
let step = '';
|
|
360
|
+
const fail = (target, e) => {
|
|
361
|
+
failures.push({ step, target, message: String(e && e.message ? e.message : e) });
|
|
362
|
+
};
|
|
326
363
|
|
|
327
364
|
// Freeze prototypes first (most critical)
|
|
328
|
-
freezePrototypes(); steps.push(
|
|
365
|
+
step = 'freezePrototypes'; freezePrototypes(fail); steps.push(step);
|
|
329
366
|
|
|
330
|
-
blockPropertyAccess(window, BLOCKED_WINDOW_APIS, 'window'); steps.push(
|
|
331
|
-
blockPropertyAccess(document, BLOCKED_DOCUMENT_APIS, 'document'); steps.push(
|
|
332
|
-
|
|
367
|
+
step = 'window'; blockPropertyAccess(window, BLOCKED_WINDOW_APIS, 'window', fail); steps.push(step);
|
|
368
|
+
step = 'document'; blockPropertyAccess(document, BLOCKED_DOCUMENT_APIS, 'document', fail); steps.push(step);
|
|
369
|
+
// The element step also closes `Range.prototype.createContextualFragment`,
|
|
370
|
+
// the markup parser `document.createRange()` still reached (the step list
|
|
371
|
+
// of the report is unchanged).
|
|
372
|
+
step = 'Element.prototype'; blockPropertyAccess(Element.prototype, BLOCKED_ELEMENT_APIS, 'Element.prototype', fail);
|
|
373
|
+
if (typeof Range !== 'undefined' && Range.prototype) blockPropertyAccess(Range.prototype, BLOCKED_RANGE_APIS, 'Range.prototype', fail);
|
|
374
|
+
steps.push(step);
|
|
333
375
|
|
|
334
|
-
blockPropertyAccess(window.history, BLOCKED_HISTORY_APIS, 'history'); steps.push(
|
|
376
|
+
step = 'history'; blockPropertyAccess(window.history, BLOCKED_HISTORY_APIS, 'history', fail); steps.push(step);
|
|
335
377
|
|
|
336
378
|
if (window.performance) {
|
|
337
|
-
blockPropertyAccess(window.performance, BLOCKED_PERF_APIS, 'performance'); steps.push(
|
|
379
|
+
step = 'performance'; blockPropertyAccess(window.performance, BLOCKED_PERF_APIS, 'performance', fail); steps.push(step);
|
|
338
380
|
}
|
|
339
381
|
|
|
340
382
|
if (window.crypto) {
|
|
341
|
-
blockPropertyAccess(window.crypto, BLOCKED_CRYPTO_APIS, 'crypto'); steps.push(
|
|
383
|
+
step = 'crypto'; blockPropertyAccess(window.crypto, BLOCKED_CRYPTO_APIS, 'crypto', fail); steps.push(step);
|
|
342
384
|
}
|
|
343
385
|
|
|
386
|
+
step = 'htmlRedirect';
|
|
344
387
|
redirectPropertySetter(
|
|
345
388
|
Element.prototype,
|
|
346
389
|
HTML_PROPERTY_REPLACEMENTS.sources,
|
|
347
|
-
HTML_PROPERTY_REPLACEMENTS.targets
|
|
390
|
+
HTML_PROPERTY_REPLACEMENTS.targets,
|
|
391
|
+
fail
|
|
348
392
|
);
|
|
349
|
-
steps.push(
|
|
393
|
+
steps.push(step);
|
|
350
394
|
|
|
351
395
|
// Block document.domain
|
|
396
|
+
step = 'document.domain';
|
|
352
397
|
try {
|
|
353
398
|
Object.defineProperty(document, 'domain', {
|
|
354
399
|
set: function (value) {
|
|
@@ -360,15 +405,16 @@ export function applyBase() {
|
|
|
360
405
|
steps.push('document.domain');
|
|
361
406
|
} catch (e) {
|
|
362
407
|
console.warn('Cannot block document.domain:', e.message);
|
|
408
|
+
fail('document.domain', e);
|
|
363
409
|
}
|
|
364
410
|
|
|
365
411
|
// Additional measures
|
|
366
|
-
wrapTimingFunctions(); steps.push(
|
|
367
|
-
blockJSONParsing(); steps.push(
|
|
368
|
-
blockDangerousElements(); steps.push(
|
|
369
|
-
disableDebugger(); steps.push(
|
|
370
|
-
blockPerformanceAPIs(); steps.push(
|
|
371
|
-
blockMathRandom(); steps.push(
|
|
372
|
-
|
|
373
|
-
return { applied: true, steps };
|
|
412
|
+
step = 'wrapTimingFunctions'; wrapTimingFunctions(); steps.push(step);
|
|
413
|
+
step = 'blockJSONParsing'; blockJSONParsing(); steps.push(step);
|
|
414
|
+
step = 'blockDangerousElements'; blockDangerousElements(fail); steps.push(step);
|
|
415
|
+
step = 'disableDebugger'; disableDebugger(); steps.push(step);
|
|
416
|
+
step = 'blockPerformanceAPIs'; blockPerformanceAPIs(fail); steps.push(step);
|
|
417
|
+
step = 'blockMathRandom'; blockMathRandom(fail); steps.push(step);
|
|
418
|
+
|
|
419
|
+
return { applied: true, steps, failures };
|
|
374
420
|
}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* which are driven by `core.sanityImportLine` and can inject
|
|
19
19
|
* `import {lockdown} …; lockdown();`), so `sanity: 'lockdown'` had nothing to
|
|
20
20
|
* prepend but a bare `@awacloud/fw/sanity/lockdown` — and since the sanity
|
|
21
|
-
* tiers became explicit-call ES modules (
|
|
22
|
-
* hardens NOTHING. `sanity: 'lockdown'` was therefore silently a no-op
|
|
21
|
+
* tiers became explicit-call ES modules (2026-07), a bare import of that
|
|
22
|
+
* hardens NOTHING. `sanity: 'lockdown'` was therefore silently a no-op.
|
|
23
23
|
* This module is the specifier such a host can prepend.
|
|
24
24
|
*
|
|
25
25
|
* `./lockdown.js` itself is UNCHANGED and stays explicit-call: importing it
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
*
|
|
43
43
|
* Because it is side-effect-only, this file is listed in the package's
|
|
44
44
|
* `sideEffects` array — without that, a production bundler flags it pure and
|
|
45
|
-
* deletes the prepended import,
|
|
45
|
+
* deletes the prepended import, and `sanity: 'lockdown'` is a no-op again.
|
|
46
46
|
*
|
|
47
47
|
* Related: `./lockdown.js` (the tier), `../../integrations/webpack/index.js`
|
|
48
48
|
* (the only consumer of this subpath) and `docs/api/sanity/lockdown.md`
|
package/src/sanity/lockdown.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* explicit-call ES module — it exports `lockdown()` and `harden()`, and a bare
|
|
12
12
|
* import hardens nothing. Integrity is opt-in and invoked once (auto-freezing
|
|
13
13
|
* intrinsics at import time would break SSR and is untestable). The same rule
|
|
14
|
-
* applies to how this tier composes `base.js` in step
|
|
14
|
+
* applies to how this tier composes `base.js` in step 5: it must CALL
|
|
15
15
|
* `applyBase()`, never rely on an import side effect.
|
|
16
16
|
*
|
|
17
17
|
* `lockdown()` performs, in order:
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* must hold the PRE-poison originals — see `sanity/wasm-gate.js`).
|
|
22
22
|
* 3. remove ambient evaluators (`eval`, `Function`, `WebAssembly.*`).
|
|
23
23
|
* 4. poison the synchronous `WebAssembly.Module` / `Instance` constructors.
|
|
24
|
-
* 5.
|
|
25
|
-
*
|
|
24
|
+
* 5. (browser realm only) compose the `base.js` DOM/XSS hardening, before
|
|
25
|
+
* the freeze (base installs wrappers on Math / JSON / Date).
|
|
26
|
+
* 6. harden(intrinsics) — transitive freeze over the standard intrinsic graph.
|
|
26
27
|
* 7. arm the wasm gate.
|
|
27
28
|
*
|
|
28
29
|
* WebAssembly, after step 7: only a holder of the fw wasm capability may
|
|
@@ -47,6 +48,7 @@ import {
|
|
|
47
48
|
poisonSyncConstructors,
|
|
48
49
|
arm as armWasmGate,
|
|
49
50
|
} from './wasm-gate.js';
|
|
51
|
+
import { applyBase } from './base.js';
|
|
50
52
|
|
|
51
53
|
const EVALUATOR_BLOCKED = 'lockdown: evaluator removed';
|
|
52
54
|
|
|
@@ -116,7 +118,10 @@ function harden(target) {
|
|
|
116
118
|
} catch {
|
|
117
119
|
continue;
|
|
118
120
|
}
|
|
119
|
-
|
|
121
|
+
// Not `Reflect.ownKeys`: base.js blocks the global `Reflect` slot, and
|
|
122
|
+
// `harden` must keep working after the base tier is applied.
|
|
123
|
+
const keys = /** @type {PropertyKey[]} */ (Object.getOwnPropertyNames(descriptors))
|
|
124
|
+
.concat(Object.getOwnPropertySymbols(descriptors));
|
|
120
125
|
for (let i = 0; i < keys.length; i++) {
|
|
121
126
|
const desc = descriptors[keys[i]];
|
|
122
127
|
if (!desc) continue;
|
|
@@ -222,7 +227,7 @@ function removeAmbientEvaluators() {
|
|
|
222
227
|
}
|
|
223
228
|
|
|
224
229
|
/**
|
|
225
|
-
* Build the enumerated intrinsic root set
|
|
230
|
+
* Build the enumerated intrinsic root set (no freezing).
|
|
226
231
|
*
|
|
227
232
|
* The set is exhaustive by design — a missing intrinsic is a hole an attacker
|
|
228
233
|
* could mutate. It contains every standard global constructor/namespace, each
|
|
@@ -230,8 +235,13 @@ function removeAmbientEvaluators() {
|
|
|
230
235
|
* (`%TypedArray%`, `%IteratorPrototype%`, `%AsyncIteratorPrototype%`, the three
|
|
231
236
|
* function-constructor intrinsics, `%ThrowTypeError%`). Every access is guarded
|
|
232
237
|
* (`typeof` / `try`) so frozen-but-missing hosts never throw.
|
|
238
|
+
*
|
|
239
|
+
* Collected BEFORE the base tier runs: base blocks the `Reflect` and
|
|
240
|
+
* `Function` global slots, after which a by-name lookup returns its stub.
|
|
241
|
+
*
|
|
242
|
+
* @returns {unknown[]}
|
|
233
243
|
*/
|
|
234
|
-
function
|
|
244
|
+
function collectIntrinsicRoots() {
|
|
235
245
|
const g = globalThis;
|
|
236
246
|
/** @type {unknown[]} */
|
|
237
247
|
const roots = [];
|
|
@@ -327,8 +337,16 @@ function hardenIntrinsics() {
|
|
|
327
337
|
if (d && typeof d.get === 'function') add(d.get);
|
|
328
338
|
} catch { /* */ }
|
|
329
339
|
|
|
330
|
-
|
|
331
|
-
|
|
340
|
+
return roots;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Transitively `harden` an intrinsic root set (DFS shares no visited set
|
|
345
|
+
* across roots, but `harden` is idempotent and each call is O(reachable)).
|
|
346
|
+
*
|
|
347
|
+
* @param {unknown[]} roots from {@link collectIntrinsicRoots}
|
|
348
|
+
*/
|
|
349
|
+
function hardenIntrinsics(roots) {
|
|
332
350
|
for (let i = 0; i < roots.length; i++) {
|
|
333
351
|
harden(roots[i]);
|
|
334
352
|
}
|
|
@@ -344,11 +362,12 @@ function hardenIntrinsics() {
|
|
|
344
362
|
* sync wasm constructors, harden intrinsics) target pure-JS intrinsics and
|
|
345
363
|
* therefore run in ANY realm — main thread, Worker, or SSR. The DOM step
|
|
346
364
|
* (compose `base.js` DOM/XSS hardening) runs only in a browser realm (`window`
|
|
347
|
-
* + `document` present)
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
365
|
+
* + `document` present), synchronously, BEFORE the intrinsics are frozen:
|
|
366
|
+
* base installs wrappers on `Math`, `JSON`, `Date` and the DOM prototypes,
|
|
367
|
+
* which a frozen namespace would refuse, and the freeze then covers those
|
|
368
|
+
* wrappers too. `base.js` is an explicit-call module, so importing it is inert
|
|
369
|
+
* in a non-browser realm, where `applyBase()` is never called. When
|
|
370
|
+
* `lockdown()` returns, both tiers are in force.
|
|
352
371
|
*
|
|
353
372
|
* @param {object} [options] reserved for future opts (currently unused)
|
|
354
373
|
* @returns {void}
|
|
@@ -378,31 +397,38 @@ function lockdown(options = {}) {
|
|
|
378
397
|
// hardening of the `WebAssembly` namespace cannot silently defeat it.
|
|
379
398
|
poisonSyncConstructors();
|
|
380
399
|
|
|
381
|
-
//
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
//
|
|
386
|
-
//
|
|
400
|
+
// The intrinsic roots are collected now, while every global slot still
|
|
401
|
+
// holds the real intrinsic (step 5 blocks `Reflect` and `Function`).
|
|
402
|
+
const roots = collectIntrinsicRoots();
|
|
403
|
+
|
|
404
|
+
// 5. Browser-only: compose base.js DOM/XSS hardening (innerHTML→innerText
|
|
405
|
+
// redirect, dangerous elements, document.write/execCommand, Math.random,
|
|
406
|
+
// Date.now, JSON.parse …). It runs BEFORE the freeze of step 6: base
|
|
407
|
+
// assigns wrappers onto Math/JSON/Date, which a frozen namespace refuses
|
|
408
|
+
// (in strict code the first such assignment throws and aborts the whole
|
|
409
|
+
// layer). A failure must not stop the integrity tier, and must not be
|
|
410
|
+
// silent either: it is reported once the integrity steps are complete.
|
|
411
|
+
let baseFailure = null;
|
|
387
412
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
// cannot catch a rejected dynamic import.
|
|
394
|
-
import('./base.js')
|
|
395
|
-
.then((base) => base.applyBase())
|
|
396
|
-
.catch(() => {
|
|
397
|
-
// base.js unavailable (bundler stripped / path moved) or its
|
|
398
|
-
// own application failed: the integrity tier is already
|
|
399
|
-
// applied; DOM hardening is best-effort.
|
|
400
|
-
});
|
|
413
|
+
try {
|
|
414
|
+
applyBase();
|
|
415
|
+
} catch (e) {
|
|
416
|
+
baseFailure = e;
|
|
417
|
+
}
|
|
401
418
|
}
|
|
402
419
|
|
|
420
|
+
// 6. Transitive freeze of the standard intrinsic graph (base's wrappers
|
|
421
|
+
// included).
|
|
422
|
+
hardenIntrinsics(roots);
|
|
423
|
+
|
|
403
424
|
// 7. Arm the wasm capability seam LAST: from here on `opts.fetchBytes` is
|
|
404
425
|
// refused, so the byte source of fw's own loader cannot be swapped.
|
|
405
426
|
armWasmGate();
|
|
427
|
+
|
|
428
|
+
if (baseFailure !== null) {
|
|
429
|
+
console.warn('lockdown: the base DOM/XSS layer did not fully apply: '
|
|
430
|
+
+ (baseFailure && baseFailure.message ? baseFailure.message : String(baseFailure)));
|
|
431
|
+
}
|
|
406
432
|
}
|
|
407
433
|
|
|
408
434
|
export { lockdown, harden };
|
package/src/sanity/wasm-gate.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* sanity/wasm-gate — the WebAssembly **capability seam** of the lockdown tier.
|
|
7
7
|
*
|
|
8
|
-
* ── The invariant (frozen wording
|
|
8
|
+
* ── The invariant (frozen wording) ──
|
|
9
9
|
*
|
|
10
10
|
* > **Only a holder of the fw wasm capability may compile or instantiate
|
|
11
11
|
* > WebAssembly after `lockdown()`. The sole holder is `wasmRuntime`, whose
|
|
@@ -132,7 +132,7 @@ export function captureRealEvaluators(g = globalThis) {
|
|
|
132
132
|
* Close the SYNCHRONOUS compile path — `new WebAssembly.Module(bytes)` and
|
|
133
133
|
* `new WebAssembly.Instance(module)`.
|
|
134
134
|
*
|
|
135
|
-
* MEASURED HOLE
|
|
135
|
+
* MEASURED HOLE: `removeAmbientEvaluators()`
|
|
136
136
|
* poisons the four *async* slots only. The synchronous constructors were left
|
|
137
137
|
* untouched, so caller-supplied wasm still compiled AND EXECUTED after
|
|
138
138
|
* `lockdown()` — proven end to end. Whitelisting the async four while the sync
|
package/src/typed.js
CHANGED
|
@@ -38,8 +38,11 @@ export const asTyped = (runtime) => runtime;
|
|
|
38
38
|
* (via `registerAllDeep`, so transitive `deps` come along), and return it.
|
|
39
39
|
* Typed as `TypedModuleRuntime` in `types/typed.d.ts`.
|
|
40
40
|
*
|
|
41
|
-
* Accepts an array of module definitions
|
|
42
|
-
*
|
|
41
|
+
* Accepts an array of module definitions (the default export of
|
|
42
|
+
* `@awacloud/fw/core/modules`), an object whose values are module
|
|
43
|
+
* definitions, or a module namespace whose values are such arrays
|
|
44
|
+
* (`import * as ns from '@awacloud/fw/core/modules'`, i.e.
|
|
45
|
+
* `{ default: [...] }`): an array value is registered entry by entry.
|
|
43
46
|
*
|
|
44
47
|
* @param {*} [modules]
|
|
45
48
|
* @returns {*}
|
|
@@ -47,7 +50,8 @@ export const asTyped = (runtime) => runtime;
|
|
|
47
50
|
export const createRuntime = (modules) => {
|
|
48
51
|
const rt = new ModuleRuntime();
|
|
49
52
|
if (modules) {
|
|
50
|
-
|
|
53
|
+
const list = Array.isArray(modules) ? modules : Object.values(modules).flat();
|
|
54
|
+
rt.registerAllDeep(list);
|
|
51
55
|
}
|
|
52
56
|
return rt;
|
|
53
57
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Brotli static dictionary — RFC 7932 Appendix A
|
|
2
|
+
==============================================
|
|
3
|
+
|
|
4
|
+
Used in: src/io/compress/brotli_dict.bin (and its copy under dist/build/),
|
|
5
|
+
the 122 784-byte static dictionary of the Brotli format, loaded by
|
|
6
|
+
src/io/compress/brotli_dict_words.js. The file is bit-identical to the
|
|
7
|
+
"Static Dictionary Data" of RFC 7932 Appendix A (CRC-32 0x5136CB04, as the
|
|
8
|
+
appendix states; SHA-256
|
|
9
|
+
20e42eb1b511c21806d4d227d07e5dd06877d8ce7b3a817f378f313653f35c70). It was
|
|
10
|
+
copied from the reference implementation's repository, google/brotli
|
|
11
|
+
(c/common/dictionary.bin). Both notices follow.
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
RFC 7932 — Brotli Compressed Data Format (J. Alakuijala, Z. Szabadka)
|
|
15
|
+
|
|
16
|
+
Code Components extracted from RFC 7932 are licensed under the following
|
|
17
|
+
terms (IETF Trust Legal Provisions, Section 4.e):
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2016 IETF Trust and the persons identified as authors of the
|
|
20
|
+
code. All rights reserved.
|
|
21
|
+
|
|
22
|
+
Redistribution and use in source and binary forms, with or without
|
|
23
|
+
modification, are permitted provided that the following conditions are met:
|
|
24
|
+
|
|
25
|
+
- Redistributions of source code must retain the above copyright notice,
|
|
26
|
+
this list of conditions and the following disclaimer.
|
|
27
|
+
|
|
28
|
+
- Redistributions in binary form must reproduce the above copyright notice,
|
|
29
|
+
this list of conditions and the following disclaimer in the documentation
|
|
30
|
+
and/or other materials provided with the distribution.
|
|
31
|
+
|
|
32
|
+
- Neither the name of Internet Society, IETF or IETF Trust, nor the names of
|
|
33
|
+
specific contributors, may be used to endorse or promote products derived
|
|
34
|
+
from this software without specific prior written permission.
|
|
35
|
+
|
|
36
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
37
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
38
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
39
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
40
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
41
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
42
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
43
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
44
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
45
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
46
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
47
|
+
|
|
48
|
+
--------------------------------------------------------------------------------
|
|
49
|
+
google/brotli (https://github.com/google/brotli) — MIT License
|
|
50
|
+
|
|
51
|
+
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
in the Software without restriction, including without limitation the rights
|
|
56
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
furnished to do so, subject to the following conditions:
|
|
59
|
+
|
|
60
|
+
The above copyright notice and this permission notice shall be included in
|
|
61
|
+
all copies or substantial portions of the Software.
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
69
|
+
THE SOFTWARE.
|