@vekil/app-sdk 0.4.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.
@@ -0,0 +1,147 @@
1
+ # Security and versioning
2
+
3
+ Remote Apps execute in developer-operated infrastructure. This guide describes
4
+ the security responsibilities that apply before an App handles real requests.
5
+
6
+ ## Responsibility boundary
7
+
8
+ | Area | Vekil provides | Your Runtime provides |
9
+ | ------------- | ----------------------------------------------------------- | ------------------------------------------------------------ |
10
+ | Authorization | Signed, scoped, expiring installation and execution grants. | Provider authorization attempts and encrypted token storage. |
11
+ | Execution | Approved action, retry, timeout, and cancellation metadata. | Strict validation, provider calls, and idempotent effects. |
12
+ | Context | The minimum declared context for the current action. | Use only supplied fields for the duration of the request. |
13
+ | Credentials | Request-signing verification material. | Runtime signing key and all provider credentials. |
14
+ | Results | Validation and requester-facing conversation. | Typed outcomes, facts, artifacts, and safe Bubbles. |
15
+
16
+ A Remote App must not call another App directly. Return typed artifacts when a
17
+ later action may need structured data; Vekil handles authorized composition.
18
+
19
+ ## Signed requests and responses
20
+
21
+ `createRemoteAppRuntime` verifies requests before handler dispatch:
22
+
23
+ - Ed25519 signature and key selection;
24
+ - issuer and audience;
25
+ - timestamp and signature lifetime;
26
+ - one-time nonce through the replay store;
27
+ - exact raw-body digest;
28
+ - request schema;
29
+ - compatibility with the loaded Runtime manifest.
30
+
31
+ Responses are signed with the Runtime key and verified by Vekil against the
32
+ public JWKS declared by the App.
33
+
34
+ Do not terminate signature verification in a generic reverse proxy unless the
35
+ verified sender and exact raw body remain cryptographically bound to the
36
+ Runtime process. The SDK adapters are the supported verification boundary.
37
+
38
+ ## Secrets
39
+
40
+ Never place these values in an App Definition, manifest, App Context, Bubble,
41
+ artifact, log, or source repository:
42
+
43
+ - Runtime signing private JWK;
44
+ - provider OAuth client secret;
45
+ - provider access or refresh token;
46
+ - API key or webhook secret;
47
+ - database or vault encryption key;
48
+ - credentials received from Vekil.
49
+
50
+ The public JWKS contains public signing material only. Keep provider account
51
+ references and raw provider payloads in the Runtime when they are needed; send
52
+ Vekil only the declared normalized result.
53
+
54
+ ## Replay protection and idempotency
55
+
56
+ These controls solve different problems and both are required:
57
+
58
+ - The replay store atomically claims each signed request nonce until it expires.
59
+ - Business idempotency stores the durable result for the supplied idempotency
60
+ key and returns the same result for duplicate delivery.
61
+
62
+ A request may be retried with a new signature and nonce while retaining the
63
+ same business idempotency key.
64
+
65
+ ## Validate every boundary
66
+
67
+ The SDK validates protocol envelopes. Your App validates provider and business
68
+ data:
69
+
70
+ - parse App-owned action input before using it;
71
+ - read reserved artifacts through SDK helpers;
72
+ - resolve local action and outcome keys through manifest bindings;
73
+ - treat provider responses, webhooks, redirects, and requester strings as
74
+ untrusted;
75
+ - normalize provider errors without leaking payloads or credentials;
76
+ - return only outcomes and artifacts declared by the App;
77
+ - expose requester-visible results only when independently safe.
78
+
79
+ ## Provider authorization
80
+
81
+ Use a high-entropy, one-time state value for every provider authorization
82
+ attempt. Bind it to the installation, expected callback, requested permissions,
83
+ and expiry. Consume it atomically.
84
+
85
+ After callback:
86
+
87
+ - verify state before exchanging a code;
88
+ - compare the granted permissions with the requested contract;
89
+ - encrypt tokens at rest;
90
+ - rotate refresh credentials safely;
91
+ - revoke credentials on disconnect;
92
+ - reject a callback for an older or replaced connection attempt.
93
+
94
+ Do not send provider tokens through App settings or App Context.
95
+
96
+ ## SDK and App updates
97
+
98
+ The SDK package and the App released through Builder have separate lifecycles.
99
+ Updating `@vekil/app-sdk` in source code does not change an installed App.
100
+
101
+ To ship an SDK update in an App:
102
+
103
+ 1. update and lock the dependency;
104
+ 2. run validation, conformance, and tests;
105
+ 3. rebuild `definition.json`;
106
+ 4. prepare a new test release in Builder;
107
+ 5. download its manifest and deploy the matching Runtime;
108
+ 6. run the Runtime test;
109
+ 7. release the tested result and upgrade installations explicitly.
110
+
111
+ ## Compatibility before 1.0
112
+
113
+ The SDK follows Semantic Versioning with a pre-1.0 policy:
114
+
115
+ - patch releases (`0.4.x`) preserve public API and protocol behavior for that
116
+ minor line, except when a fail-closed security correction is required;
117
+ - minor releases (`0.x.0`) may contain author-facing breaking changes and must
118
+ include migration guidance;
119
+ - published package versions are immutable;
120
+ - the current minor line is the actively supported development line.
121
+
122
+ Use `^0.4.0` to receive compatible `0.4.x` patches without crossing into
123
+ `0.5.0`. Commit the package-manager lockfile for reproducible builds.
124
+
125
+ ## Deprecation
126
+
127
+ Deprecated exports remain documented for the supported minor line when a safe
128
+ migration exists. Security-sensitive behavior may fail closed immediately when
129
+ continuing it would expose credentials, widen authority, accept replay, or
130
+ execute an undeclared side effect.
131
+
132
+ Compatibility aliases are not added for retired fields, routes, or enum values.
133
+
134
+ ## Report a vulnerability
135
+
136
+ Do not open a public issue containing credentials, personal data, or a working
137
+ exploit against a deployed Runtime. Contact Vekil privately through the security
138
+ contact published on [vekil.me](https://vekil.me) and include:
139
+
140
+ - affected SDK and App versions;
141
+ - the impacted boundary;
142
+ - minimal reproduction steps;
143
+ - expected and observed behavior;
144
+ - whether credentials or user data may have been exposed.
145
+
146
+ Public product bugs and documentation issues may be reported in the repository
147
+ issue tracker linked by the package metadata.
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@vekil/app-sdk",
3
+ "version": "0.4.0",
4
+ "description": "Build, validate, test, and host Remote Apps for Vekil.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "Vekil",
8
+ "url": "https://vekil.me"
9
+ },
10
+ "homepage": "https://vekil.me/docs/remote",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/askvekil/vekil.me.git",
14
+ "directory": "packages/platform/app-sdk"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/askvekil/vekil.me/issues"
18
+ },
19
+ "keywords": [
20
+ "vekil",
21
+ "app-sdk",
22
+ "remote-apps",
23
+ "typescript",
24
+ "automation"
25
+ ],
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "docs"
34
+ ],
35
+ "bin": {
36
+ "vekil-app": "dist/cli.js"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "import": {
41
+ "types": "./dist/index.d.ts",
42
+ "default": "./dist/index.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
47
+ }
48
+ },
49
+ "./runtime": {
50
+ "import": {
51
+ "types": "./dist/runtime.d.ts",
52
+ "default": "./dist/runtime.js"
53
+ },
54
+ "require": {
55
+ "types": "./dist/runtime.d.cts",
56
+ "default": "./dist/runtime.cjs"
57
+ }
58
+ },
59
+ "./package.json": "./package.json"
60
+ },
61
+ "engines": {
62
+ "node": ">=22"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "build": "tsup",
69
+ "lint": "eslint .",
70
+ "prepack": "pnpm build",
71
+ "typecheck": "tsc --noEmit",
72
+ "test": "vitest run --passWithNoTests"
73
+ },
74
+ "dependencies": {
75
+ "@types/node": "26.1.0",
76
+ "zod": "4.4.3"
77
+ },
78
+ "devDependencies": {
79
+ "@vekil/app-compiler": "workspace:*",
80
+ "@vekil/app-protocol": "workspace:*",
81
+ "@vekil/app-runtime": "workspace:*",
82
+ "tsup": "8.5.1",
83
+ "typescript": "6.0.3",
84
+ "vitest": "4.1.9"
85
+ }
86
+ }