@pawmaskrelease/psecure 0.1.0-beta → 1.1.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 +49 -0
- package/LICENSE +44 -44
- package/README.md +560 -175
- package/bin/psecure.mjs +13 -0
- package/dist/adapters/desktop.d.ts +26 -26
- package/dist/adapters/desktop.js +25 -12
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/mobile-bridge.d.ts +28 -3
- package/dist/adapters/mobile-bridge.js +23 -12
- package/dist/adapters/react-native.d.ts +9 -15
- package/dist/adapters/react-native.js +15 -9
- package/dist/adapters/web-shield.d.ts +1 -1
- package/dist/adapters/web-shield.js +13 -11
- package/dist/adapters/web-vault.d.ts +58 -6
- package/dist/adapters/web-vault.js +97 -21
- package/dist/cli/doctor.d.ts +31 -0
- package/dist/cli/doctor.js +108 -0
- package/dist/client/index.js +1 -1
- package/dist/client/psecure-client.d.ts +56 -14
- package/dist/client/psecure-client.js +179 -38
- package/dist/crypto/block-ciphers.js +1 -1
- package/dist/crypto/chacha-cfb.js +33 -33
- package/dist/crypto/index.js +1 -1
- package/dist/crypto/mba.js +1 -1
- package/dist/crypto/primitives.js +1 -1
- package/dist/crypto/threefish.js +22 -22
- package/dist/crypto/wasm-coprocessor.d.ts +10 -9
- package/dist/crypto/wasm-coprocessor.js +40 -35
- package/dist/crypto/whitebox-aes.js +32 -32
- package/dist/dist-manifest.json +130 -100
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +53 -0
- package/dist/fetch/index.d.ts +40 -0
- package/dist/fetch/index.js +93 -0
- package/dist/fetch/load-client.d.ts +1 -0
- package/dist/fetch/load-client.js +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/protocol/canonical.d.ts +47 -0
- package/dist/protocol/canonical.js +73 -0
- package/dist/protocol/codecs.d.ts +1 -0
- package/dist/protocol/codecs.js +72 -63
- package/dist/protocol/constants.d.ts +1 -1
- package/dist/protocol/constants.js +3 -3
- package/dist/protocol/dvp-probes.js +51 -51
- package/dist/protocol/ed25519.d.ts +3 -8
- package/dist/protocol/ed25519.js +59 -46
- package/dist/protocol/index.js +1 -1
- package/dist/protocol/types.d.ts +8 -2
- package/dist/protocol/types.js +1 -1
- package/dist/protocol/wire.d.ts +2 -13
- package/dist/protocol/wire.js +98 -85
- package/dist/rasp/auto-collector.js +29 -27
- package/dist/rasp/behavior-stream.js +47 -47
- package/dist/rasp/dvp-consistency.js +9 -9
- package/dist/rasp/hardware-binding.js +7 -7
- package/dist/rasp/index.js +1 -1
- package/dist/rasp/klepto-seal.js +1 -1
- package/dist/rasp/mobile-native-probes.js +8 -8
- package/dist/rasp/probes.js +13 -13
- package/dist/rasp/web-integrity-probes.js +47 -44
- package/dist/server/authority-types.d.ts +113 -9
- package/dist/server/authority-types.js +4 -2
- package/dist/server/edge.d.ts +20 -0
- package/dist/server/edge.js +54 -0
- package/dist/server/express.d.ts +40 -0
- package/dist/server/express.js +65 -0
- package/dist/server/fastify.d.ts +35 -0
- package/dist/server/fastify.js +45 -0
- package/dist/server/guard.d.ts +129 -0
- package/dist/server/guard.js +121 -0
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +6 -6
- package/dist/server/middleware.d.ts +13 -3
- package/dist/server/middleware.js +50 -34
- package/dist/server/remote-authority-client.d.ts +4 -4
- package/dist/server/remote-authority-client.js +52 -45
- package/dist/server/verdicts.d.ts +19 -0
- package/dist/server/verdicts.js +49 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/vm/dynamic-ob.d.ts +2 -2
- package/dist/vm/dynamic-ob.js +48 -48
- package/dist/vm/env-key.js +5 -5
- package/dist/vm/iabc-isa.js +13 -13
- package/dist/vm/index.d.ts +0 -1
- package/dist/vm/index.js +1 -2
- package/dist/vm/psecure-vm.js +54 -58
- package/dist/web/psecure-polymorphic-loader.obf.js +5 -3
- package/dist/web/psecure-vm-kernel.d.ts +118 -0
- package/dist/web/psecure-vm-kernel.js +142 -78
- package/dist/web/psecure-web-shield.bundle.js +148 -78
- package/package.json +154 -122
- package/dist/server/authority.d.ts +0 -42
- package/dist/server/authority.js +0 -89
- package/dist/server/lease-store.d.ts +0 -25
- package/dist/server/lease-store.js +0 -92
- package/dist/server/pop-verifier.d.ts +0 -21
- package/dist/server/pop-verifier.js +0 -98
- package/dist/server/redis-store.d.ts +0 -89
- package/dist/server/redis-store.js +0 -111
- package/dist/server/store.d.ts +0 -90
- package/dist/server/store.js +0 -70
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog: `@pawmaskrelease/psecure`
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
Integrations in under an hour: framework adapters, a sealing `fetch`, actionable errors and a `doctor` CLI.
|
|
6
|
+
Backward compatible with 1.0.0: nothing was removed or changed in meaning, and every 1.0.0 import keeps working.
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **Server adapters** on one guard core (`createPSecureGuard`), configured from `PSECURE_*` environment variables:
|
|
11
|
+
- `@pawmaskrelease/psecure/fastify`: `psecureFastify` plugin. It captures the raw body itself, sets `request.psecure`,
|
|
12
|
+
and supports route config `{ psecure: true | false }`.
|
|
13
|
+
- `@pawmaskrelease/psecure/express`: `psecure()` middleware and `psecureRawBody` (for `express.json({ verify })`);
|
|
14
|
+
sets `req.psecure`.
|
|
15
|
+
- `@pawmaskrelease/psecure/edge`: `withPSecure(handler)` and `createPSecureEdge()` for Next.js, Hono, Cloudflare
|
|
16
|
+
Workers, Bun and Deno.
|
|
17
|
+
- `PSECURE_REQUEST_HEADERS` / `PSECURE_EXPOSED_HEADERS` for CORS, `getPSecureDecision(request)`, `onDecision` hook,
|
|
18
|
+
`createPSecureAuditThrottle`, pino-compatible logging that never contains the key, envelope, lease or body.
|
|
19
|
+
- Decision table: Monitor never blocks. Block refuses denied and malformed requests everywhere, and fails closed
|
|
20
|
+
(missing envelope, authority down) only on `protect` routes (default: all guarded routes). A lease reissue is
|
|
21
|
+
answered `401` + `x-psecure-reissued-lease`; any other refusal is `403 { error: 'PSECURE_REJECTED' }`.
|
|
22
|
+
- **The console Monitor/Block switch drives enforcement.** The default mode `auto` follows the app's mode, which the
|
|
23
|
+
authority (>= 1.1) reports on every verdict as `appMode`. The last mode seen is cached for 10 minutes when a request
|
|
24
|
+
carries no verdict; a cold start behaves as Monitor. `PSECURE_MODE=monitor | enforce | off` overrides the switch.
|
|
25
|
+
`PSecureVerificationVerdict.appMode` is typed.
|
|
26
|
+
- **App pinning** (`appKey` / `PSECURE_APP_KEY`, recommended): the guard sends it as `expectedAppKey`. The
|
|
27
|
+
authority then denies a lease of any other application, same organization included, with the new reason
|
|
28
|
+
`app_mismatch`, and the guard only takes a console mode reported for that app (`verdict.appKey`). This closes the
|
|
29
|
+
downgrade where a lease of a Monitor app is replayed against a Block app's backend. In `auto` without it, the guard
|
|
30
|
+
logs a one-time `APP_KEY_NOT_PINNED` warning, and `doctor` warns.
|
|
31
|
+
`PSecureRequestVerificationContext.expectedAppKey`, `PSecureHttpVerifyInput.expectedAppKey`, `verdict.appKey` and
|
|
32
|
+
the `app_mismatch` reason are typed and pass through `PSecureRemoteAuthorityClient`.
|
|
33
|
+
- **`createPSecureFetch`** (`@pawmaskrelease/psecure/fetch`, also from the root): a drop-in sealing `fetch`. It falls
|
|
34
|
+
back gracefully to plain `fetch`, filters origins, never sends a POST twice, provides `setAccount()`, refreshes the
|
|
35
|
+
lease in the background, defaults to `telemetry: 'minimal'` and lazy-loads the client core.
|
|
36
|
+
- **`PSecureConfigError`** with a stable `code`, an English `hint` and a `docsUrl`, for common misconfigurations
|
|
37
|
+
(public key missing, invalid or mismatched; keys swapped; non-https authority; CSP or unreachable authority; origins;
|
|
38
|
+
clock skew; raw body; server key missing or rejected).
|
|
39
|
+
- **`npx @pawmaskrelease/psecure doctor`**: checks that the authority is reachable, the pinned key, the clock, CORS,
|
|
40
|
+
a test lease with the app key and the server key (from `PSECURE_SERVER_KEY` only, never printed). Optionally checks
|
|
41
|
+
your API's CORS.
|
|
42
|
+
- `PSECURE_SDK_VERSION`.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- The `PSecureClient.connect` lease failure error now carries `status` and the authority's SDK `code`
|
|
47
|
+
(`INVALID_APP_KEY`, `CROSS_TENANT_APP_KEY`, …), and names the code in its message.
|
|
48
|
+
- The `@pawmaskrelease/psecure/server` barrel also exports the guard and the Express and Edge adapters (the Fastify
|
|
49
|
+
plugin uses `node:stream` and has its own subpath, so `/server` stays edge-safe).
|
package/LICENSE
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
Paw Mask PSecure SDK — Proprietary Commercial License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Paw Mask. All rights reserved.
|
|
4
|
-
|
|
5
|
-
This software and its accompanying files (the "Software") are the confidential
|
|
6
|
-
and proprietary property of Paw Mask. The Software is licensed, not sold.
|
|
7
|
-
|
|
8
|
-
1. License grant. Subject to your full and ongoing compliance with this
|
|
9
|
-
license, Paw Mask grants you a limited, non-exclusive, non-transferable,
|
|
10
|
-
non-sublicensable, revocable license to install and use the Software solely
|
|
11
|
-
in connection with a valid, active Paw Mask PSecure subscription, or under
|
|
12
|
-
the written terms of an authorized Paw Mask evaluation or sandbox agreement.
|
|
13
|
-
|
|
14
|
-
2. Restrictions. Except to the extent expressly permitted by this license or
|
|
15
|
-
by mandatory applicable law, you may NOT, and may not permit any third party
|
|
16
|
-
to:
|
|
17
|
-
(a) copy, redistribute, publish, sublicense, sell, rent, lease, or otherwise
|
|
18
|
-
make the Software available to any third party;
|
|
19
|
-
(b) reverse engineer, decompile, disassemble, deobfuscate, or otherwise
|
|
20
|
-
attempt to derive the source code, internal design, protocols, or
|
|
21
|
-
underlying ideas of the Software, or circumvent or disable any of its
|
|
22
|
-
security, anti-tamper, or licensing mechanisms;
|
|
23
|
-
(c) modify, adapt, or create derivative works of the Software; or
|
|
24
|
-
(d) remove, obscure, or alter any proprietary notices.
|
|
25
|
-
|
|
26
|
-
3. Ownership. Paw Mask retains all right, title, and interest in and to the
|
|
27
|
-
Software, including all intellectual property rights. No rights are granted
|
|
28
|
-
except as expressly set out in this license.
|
|
29
|
-
|
|
30
|
-
4. Termination. This license terminates automatically if your PSecure
|
|
31
|
-
subscription or evaluation/sandbox agreement lapses or is terminated, or if
|
|
32
|
-
you breach any term of this license. Upon termination you must cease all use
|
|
33
|
-
and destroy all copies of the Software.
|
|
34
|
-
|
|
35
|
-
5. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
36
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
37
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
38
|
-
|
|
39
|
-
6. Limitation of liability. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT
|
|
40
|
-
SHALL PAW MASK BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
|
41
|
-
CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR DATA, ARISING
|
|
42
|
-
OUT OF OR RELATED TO THE SOFTWARE.
|
|
43
|
-
|
|
44
|
-
For licensing inquiries: licensing@pawmask.com — https://pawmask.com/docs/psecure
|
|
1
|
+
Paw Mask PSecure SDK — Proprietary Commercial License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Paw Mask. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and its accompanying files (the "Software") are the confidential
|
|
6
|
+
and proprietary property of Paw Mask. The Software is licensed, not sold.
|
|
7
|
+
|
|
8
|
+
1. License grant. Subject to your full and ongoing compliance with this
|
|
9
|
+
license, Paw Mask grants you a limited, non-exclusive, non-transferable,
|
|
10
|
+
non-sublicensable, revocable license to install and use the Software solely
|
|
11
|
+
in connection with a valid, active Paw Mask PSecure subscription, or under
|
|
12
|
+
the written terms of an authorized Paw Mask evaluation or sandbox agreement.
|
|
13
|
+
|
|
14
|
+
2. Restrictions. Except to the extent expressly permitted by this license or
|
|
15
|
+
by mandatory applicable law, you may NOT, and may not permit any third party
|
|
16
|
+
to:
|
|
17
|
+
(a) copy, redistribute, publish, sublicense, sell, rent, lease, or otherwise
|
|
18
|
+
make the Software available to any third party;
|
|
19
|
+
(b) reverse engineer, decompile, disassemble, deobfuscate, or otherwise
|
|
20
|
+
attempt to derive the source code, internal design, protocols, or
|
|
21
|
+
underlying ideas of the Software, or circumvent or disable any of its
|
|
22
|
+
security, anti-tamper, or licensing mechanisms;
|
|
23
|
+
(c) modify, adapt, or create derivative works of the Software; or
|
|
24
|
+
(d) remove, obscure, or alter any proprietary notices.
|
|
25
|
+
|
|
26
|
+
3. Ownership. Paw Mask retains all right, title, and interest in and to the
|
|
27
|
+
Software, including all intellectual property rights. No rights are granted
|
|
28
|
+
except as expressly set out in this license.
|
|
29
|
+
|
|
30
|
+
4. Termination. This license terminates automatically if your PSecure
|
|
31
|
+
subscription or evaluation/sandbox agreement lapses or is terminated, or if
|
|
32
|
+
you breach any term of this license. Upon termination you must cease all use
|
|
33
|
+
and destroy all copies of the Software.
|
|
34
|
+
|
|
35
|
+
5. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
36
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
37
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
38
|
+
|
|
39
|
+
6. Limitation of liability. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT
|
|
40
|
+
SHALL PAW MASK BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
|
41
|
+
CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR DATA, ARISING
|
|
42
|
+
OUT OF OR RELATED TO THE SOFTWARE.
|
|
43
|
+
|
|
44
|
+
For licensing inquiries: licensing@pawmask.com — https://pawmask.com/docs/psecure
|