veryfront 0.1.1213 → 0.1.1214
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/esm/deno.js +1 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +2 -6
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts +1 -1
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-policy-enforcement.js +1 -8
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/platform/adapters/index.d.ts +25 -0
- package/esm/src/platform/adapters/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/index.js +23 -0
- package/esm/src/platform/adapters/security/index.d.ts +8 -0
- package/esm/src/platform/adapters/security/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/security/index.js +7 -0
- package/esm/src/platform/adapters/token/factory.d.ts +10 -0
- package/esm/src/platform/adapters/token/factory.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/factory.js +79 -0
- package/esm/src/platform/adapters/token/index.d.ts +9 -0
- package/esm/src/platform/adapters/token/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/index.js +8 -0
- package/esm/src/platform/adapters/token/integration.d.ts +6 -0
- package/esm/src/platform/adapters/token/integration.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/integration.js +61 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.d.ts +22 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.js +88 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.d.ts +15 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.js +212 -0
- package/esm/src/platform/adapters/token/veryfront/index.d.ts +10 -0
- package/esm/src/platform/adapters/token/veryfront/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/index.js +9 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.d.ts +20 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.js +52 -0
- package/esm/src/platform/adapters/token/veryfront/types.d.ts +86 -0
- package/esm/src/platform/adapters/token/veryfront/types.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/types.js +81 -0
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/security/http/config.d.ts +5 -0
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +16 -1
- package/esm/src/security/http/derived-csp-cache.d.ts +33 -0
- package/esm/src/security/http/derived-csp-cache.d.ts.map +1 -0
- package/esm/src/security/http/derived-csp-cache.js +101 -0
- package/esm/src/security/http/derived-csp-origins.d.ts +54 -0
- package/esm/src/security/http/derived-csp-origins.d.ts.map +1 -0
- package/esm/src/security/http/derived-csp-origins.js +156 -0
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +9 -2
- package/esm/src/security/sandbox/constants.d.ts +3 -0
- package/esm/src/security/sandbox/constants.d.ts.map +1 -0
- package/esm/src/security/sandbox/constants.js +2 -0
- package/esm/src/security/sandbox/deno-sandbox.d.ts +71 -0
- package/esm/src/security/sandbox/deno-sandbox.d.ts.map +1 -0
- package/esm/src/security/sandbox/deno-sandbox.js +184 -0
- package/esm/src/security/sandbox/permission-system.d.ts +11 -0
- package/esm/src/security/sandbox/permission-system.d.ts.map +1 -0
- package/esm/src/security/sandbox/permission-system.js +85 -0
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-runtime-context.js +97 -1
- package/esm/src/types/server.d.ts +10 -0
- package/esm/src/types/server.d.ts.map +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/api.d.ts +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface SandboxOptions {
|
|
2
|
+
timeoutMs?: number;
|
|
3
|
+
memoryLimitMb?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Operator opt-in env var that allows {@link runInWorker} to execute on Node.js
|
|
7
|
+
* despite the lack of permission isolation. Read via {@link getHostEnv} so that
|
|
8
|
+
* a per-request project env overlay cannot enable unsafe execution from inside
|
|
9
|
+
* a tenant context.
|
|
10
|
+
*
|
|
11
|
+
* @internal Exported for testing.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NODE_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE";
|
|
14
|
+
/**
|
|
15
|
+
* Pure decision helper for the Node.js sandbox guard. Given the raw env-var
|
|
16
|
+
* value, decide whether to block execution on Node.
|
|
17
|
+
*
|
|
18
|
+
* Returns `true` only when the value is the literal string `"1"`. Any other
|
|
19
|
+
* value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the
|
|
20
|
+
* guard active. Strict equality is intentional for a security opt-in.
|
|
21
|
+
*
|
|
22
|
+
* @internal Exported for testing only.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isNodeSandboxAllowedUnsafe(envValue: string | undefined): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Operator opt-in env var that allows {@link runInWorker} to execute on Bun
|
|
27
|
+
* despite the lack of permission isolation. Read via {@link getHostEnv} so that
|
|
28
|
+
* a per-request project env overlay cannot enable unsafe execution from inside
|
|
29
|
+
* a tenant context.
|
|
30
|
+
*
|
|
31
|
+
* @internal Exported for testing.
|
|
32
|
+
*/
|
|
33
|
+
export declare const BUN_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE";
|
|
34
|
+
/**
|
|
35
|
+
* Pure decision helper for the Bun sandbox guard. Given the raw env-var
|
|
36
|
+
* value, decide whether to block execution on Bun.
|
|
37
|
+
*
|
|
38
|
+
* Returns `true` only when the value is the literal string `"1"`. Any other
|
|
39
|
+
* value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the
|
|
40
|
+
* guard active. Strict equality is intentional for a security opt-in.
|
|
41
|
+
*
|
|
42
|
+
* @internal Exported for testing only.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isBunSandboxAllowedUnsafe(envValue: string | undefined): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Run untrusted JavaScript in an isolated Worker.
|
|
47
|
+
*
|
|
48
|
+
* ## Isolation model
|
|
49
|
+
*
|
|
50
|
+
* - **Deno (recommended):** the worker is spawned with `permissions: "none"`,
|
|
51
|
+
* denying filesystem, network, env, and subprocess access. This is the
|
|
52
|
+
* primary safe execution path.
|
|
53
|
+
* - **Node.js:** Node Workers do not support permission isolation. They
|
|
54
|
+
* inherit full access to the filesystem, network, env vars, and built-in
|
|
55
|
+
* modules. Only memory limits can be enforced. Because of this, the Node
|
|
56
|
+
* path is **disabled by default** and throws {@link NOT_SUPPORTED}.
|
|
57
|
+
* Operators who deliberately trust their input may set the env var
|
|
58
|
+
* `VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard.
|
|
59
|
+
* - **Bun:** Bun Workers have the same lack of permission isolation as Node.js.
|
|
60
|
+
* The Bun path is **disabled by default** and throws {@link NOT_SUPPORTED}.
|
|
61
|
+
* Operators who deliberately trust their input may set the env var
|
|
62
|
+
* `VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard.
|
|
63
|
+
*
|
|
64
|
+
* Callers SHOULD NOT pass untrusted code to this function on Node.js or Bun
|
|
65
|
+
* unless they have audited every caller and operator and accept the risk.
|
|
66
|
+
*
|
|
67
|
+
* @throws NOT_SUPPORTED on Node.js without the explicit opt-in env var.
|
|
68
|
+
* @throws NOT_SUPPORTED on Bun without the explicit opt-in env var.
|
|
69
|
+
*/
|
|
70
|
+
export declare function runInWorker<T = unknown>(code: string, options?: SandboxOptions): Promise<T>;
|
|
71
|
+
//# sourceMappingURL=deno-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno-sandbox.d.ts","sourceRoot":"","sources":["../../../../src/src/security/sandbox/deno-sandbox.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAYD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,wCAAwC,CAAC;AAEnF;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEhF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,uCAAuC,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC,CA6H/F"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { DEFAULT_SANDBOX_TIMEOUT_MS, MAX_SANDBOX_CODE_SIZE } from "./constants.js";
|
|
2
|
+
import { isCompiledBinary, serverLogger } from "../../utils/index.js";
|
|
3
|
+
import { isBun, isDeno, isNode } from "../../platform/compat/runtime.js";
|
|
4
|
+
import { getHostEnv } from "../../platform/compat/process/env.js";
|
|
5
|
+
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
6
|
+
import { INVALID_ARGUMENT, NOT_SUPPORTED, TIMEOUT_ERROR, UNKNOWN_ERROR } from "../../errors/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Operator opt-in env var that allows {@link runInWorker} to execute on Node.js
|
|
9
|
+
* despite the lack of permission isolation. Read via {@link getHostEnv} so that
|
|
10
|
+
* a per-request project env overlay cannot enable unsafe execution from inside
|
|
11
|
+
* a tenant context.
|
|
12
|
+
*
|
|
13
|
+
* @internal Exported for testing.
|
|
14
|
+
*/
|
|
15
|
+
export const NODE_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE";
|
|
16
|
+
/**
|
|
17
|
+
* Pure decision helper for the Node.js sandbox guard. Given the raw env-var
|
|
18
|
+
* value, decide whether to block execution on Node.
|
|
19
|
+
*
|
|
20
|
+
* Returns `true` only when the value is the literal string `"1"`. Any other
|
|
21
|
+
* value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the
|
|
22
|
+
* guard active. Strict equality is intentional for a security opt-in.
|
|
23
|
+
*
|
|
24
|
+
* @internal Exported for testing only.
|
|
25
|
+
*/
|
|
26
|
+
export function isNodeSandboxAllowedUnsafe(envValue) {
|
|
27
|
+
return envValue === "1";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Operator opt-in env var that allows {@link runInWorker} to execute on Bun
|
|
31
|
+
* despite the lack of permission isolation. Read via {@link getHostEnv} so that
|
|
32
|
+
* a per-request project env overlay cannot enable unsafe execution from inside
|
|
33
|
+
* a tenant context.
|
|
34
|
+
*
|
|
35
|
+
* @internal Exported for testing.
|
|
36
|
+
*/
|
|
37
|
+
export const BUN_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE";
|
|
38
|
+
/**
|
|
39
|
+
* Pure decision helper for the Bun sandbox guard. Given the raw env-var
|
|
40
|
+
* value, decide whether to block execution on Bun.
|
|
41
|
+
*
|
|
42
|
+
* Returns `true` only when the value is the literal string `"1"`. Any other
|
|
43
|
+
* value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the
|
|
44
|
+
* guard active. Strict equality is intentional for a security opt-in.
|
|
45
|
+
*
|
|
46
|
+
* @internal Exported for testing only.
|
|
47
|
+
*/
|
|
48
|
+
export function isBunSandboxAllowedUnsafe(envValue) {
|
|
49
|
+
return envValue === "1";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run untrusted JavaScript in an isolated Worker.
|
|
53
|
+
*
|
|
54
|
+
* ## Isolation model
|
|
55
|
+
*
|
|
56
|
+
* - **Deno (recommended):** the worker is spawned with `permissions: "none"`,
|
|
57
|
+
* denying filesystem, network, env, and subprocess access. This is the
|
|
58
|
+
* primary safe execution path.
|
|
59
|
+
* - **Node.js:** Node Workers do not support permission isolation. They
|
|
60
|
+
* inherit full access to the filesystem, network, env vars, and built-in
|
|
61
|
+
* modules. Only memory limits can be enforced. Because of this, the Node
|
|
62
|
+
* path is **disabled by default** and throws {@link NOT_SUPPORTED}.
|
|
63
|
+
* Operators who deliberately trust their input may set the env var
|
|
64
|
+
* `VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard.
|
|
65
|
+
* - **Bun:** Bun Workers have the same lack of permission isolation as Node.js.
|
|
66
|
+
* The Bun path is **disabled by default** and throws {@link NOT_SUPPORTED}.
|
|
67
|
+
* Operators who deliberately trust their input may set the env var
|
|
68
|
+
* `VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard.
|
|
69
|
+
*
|
|
70
|
+
* Callers SHOULD NOT pass untrusted code to this function on Node.js or Bun
|
|
71
|
+
* unless they have audited every caller and operator and accept the risk.
|
|
72
|
+
*
|
|
73
|
+
* @throws NOT_SUPPORTED on Node.js without the explicit opt-in env var.
|
|
74
|
+
* @throws NOT_SUPPORTED on Bun without the explicit opt-in env var.
|
|
75
|
+
*/
|
|
76
|
+
export function runInWorker(code, options = {}) {
|
|
77
|
+
if (typeof code !== "string") {
|
|
78
|
+
return Promise.reject(INVALID_ARGUMENT.create({ message: "Sandbox code must be a string" }));
|
|
79
|
+
}
|
|
80
|
+
if (code.length === 0) {
|
|
81
|
+
return Promise.reject(INVALID_ARGUMENT.create({ message: "Sandbox code cannot be empty" }));
|
|
82
|
+
}
|
|
83
|
+
const codeByteLength = new TextEncoder().encode(code).byteLength;
|
|
84
|
+
if (codeByteLength > MAX_SANDBOX_CODE_SIZE) {
|
|
85
|
+
return Promise.reject(INVALID_ARGUMENT.create({
|
|
86
|
+
message: `Sandbox code exceeds maximum size (${MAX_SANDBOX_CODE_SIZE} bytes)`,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
// SEC-008: Node Workers have no permission isolation. Refuse execution
|
|
90
|
+
// unless the operator has explicitly opted in via host env var. Use
|
|
91
|
+
// getHostEnv so a tenant project env overlay cannot enable this.
|
|
92
|
+
if (isNode && !isNodeSandboxAllowedUnsafe(getHostEnv(NODE_SANDBOX_ALLOW_UNSAFE_ENV))) {
|
|
93
|
+
return Promise.reject(NOT_SUPPORTED.create({
|
|
94
|
+
detail: "Sandbox execution is not safely supported on Node.js. The current " +
|
|
95
|
+
"implementation provides only memory limits, not permission isolation. " +
|
|
96
|
+
"Set VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE=1 to enable execution at your " +
|
|
97
|
+
"own risk, or run under Deno for full isolation.",
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
// SEC-008: Bun Workers have no permission isolation (same risk as Node.js).
|
|
101
|
+
// Refuse execution unless the operator has explicitly opted in via host env
|
|
102
|
+
// var. Use getHostEnv so a tenant project env overlay cannot enable this.
|
|
103
|
+
if (isBun && !isBunSandboxAllowedUnsafe(getHostEnv(BUN_SANDBOX_ALLOW_UNSAFE_ENV))) {
|
|
104
|
+
return Promise.reject(NOT_SUPPORTED.create({
|
|
105
|
+
detail: "Sandbox execution is not safely supported on Bun. The current " +
|
|
106
|
+
"implementation provides no permission isolation. " +
|
|
107
|
+
"Set VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE=1 to enable execution at your " +
|
|
108
|
+
"own risk, or run under Deno for full isolation.",
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_SANDBOX_TIMEOUT_MS;
|
|
112
|
+
return withSpan("security.sandbox.runInWorker", () => {
|
|
113
|
+
const workerOptions = { type: "module" };
|
|
114
|
+
if (isDeno)
|
|
115
|
+
workerOptions.deno = { permissions: "none" };
|
|
116
|
+
const { memoryLimitMb } = options;
|
|
117
|
+
if (typeof memoryLimitMb === "number") {
|
|
118
|
+
if (!Number.isFinite(memoryLimitMb) || memoryLimitMb <= 0) {
|
|
119
|
+
throw INVALID_ARGUMENT.create({
|
|
120
|
+
detail: "Sandbox memoryLimitMb must be a positive, finite number",
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (!isNode) {
|
|
124
|
+
throw NOT_SUPPORTED.create({
|
|
125
|
+
detail: "Sandbox memory limits are not supported in this runtime",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
workerOptions.resourceLimits = {
|
|
129
|
+
...workerOptions.resourceLimits,
|
|
130
|
+
maxOldGenerationSizeMb: Math.floor(memoryLimitMb),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const workerCode = `self.onmessage = async (e) => {` +
|
|
134
|
+
` const { code } = e.data;` +
|
|
135
|
+
` let result;` +
|
|
136
|
+
` try { result = await (async () => {` +
|
|
137
|
+
` return await (new Function(code))();` +
|
|
138
|
+
` })(); } catch (error) {` +
|
|
139
|
+
` self.postMessage({ error: String(error && error.message || error) });` +
|
|
140
|
+
` return;` +
|
|
141
|
+
` }` +
|
|
142
|
+
` self.postMessage({ result });` +
|
|
143
|
+
`};`;
|
|
144
|
+
// Use data URL for compiled binaries (blob URLs don't work in deno compile)
|
|
145
|
+
// See: https://github.com/denoland/deno/issues/18327
|
|
146
|
+
const workerUrl = isCompiledBinary()
|
|
147
|
+
? `data:text/javascript;base64,${btoa(workerCode)}`
|
|
148
|
+
: URL.createObjectURL(new Blob([workerCode], { type: "application/javascript" }));
|
|
149
|
+
const worker = new Worker(workerUrl, workerOptions);
|
|
150
|
+
function safeTerminate(logMessage, error) {
|
|
151
|
+
try {
|
|
152
|
+
worker.terminate();
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
serverLogger.debug(logMessage, { error: error ?? e });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const promise = new Promise((resolve, reject) => {
|
|
159
|
+
const timer = setTimeout(() => {
|
|
160
|
+
safeTerminate("[sandbox] worker terminate failed");
|
|
161
|
+
reject(TIMEOUT_ERROR.create({ detail: "Sandbox timeout" }));
|
|
162
|
+
}, timeoutMs);
|
|
163
|
+
worker.onmessage = (e) => {
|
|
164
|
+
clearTimeout(timer);
|
|
165
|
+
const { result, error } = e.data ?? {};
|
|
166
|
+
if (error)
|
|
167
|
+
reject(UNKNOWN_ERROR.create({ detail: error }));
|
|
168
|
+
else
|
|
169
|
+
resolve(result);
|
|
170
|
+
safeTerminate("[sandbox] worker terminate failed");
|
|
171
|
+
};
|
|
172
|
+
worker.onerror = (e) => {
|
|
173
|
+
clearTimeout(timer);
|
|
174
|
+
reject(UNKNOWN_ERROR.create({ detail: String(e.message || e.error || "Worker error") }));
|
|
175
|
+
safeTerminate("[sandbox] worker terminate failed on error");
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
worker.postMessage({ code });
|
|
179
|
+
return promise;
|
|
180
|
+
}, {
|
|
181
|
+
"sandbox.timeoutMs": timeoutMs,
|
|
182
|
+
"sandbox.memoryLimitMb": options.memoryLimitMb ?? 0,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Permission = "net" | "fs" | "env" | "run" | "read" | "write";
|
|
2
|
+
export interface PermissionRequest {
|
|
3
|
+
name: Permission;
|
|
4
|
+
host?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PermissionResult {
|
|
8
|
+
state: "granted" | "denied" | "prompt";
|
|
9
|
+
}
|
|
10
|
+
export declare function requestPermission(request: PermissionRequest): Promise<PermissionResult>;
|
|
11
|
+
//# sourceMappingURL=permission-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-system.d.ts","sourceRoot":"","sources":["../../../../src/src/security/sandbox/permission-system.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACxC;AAkGD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CA2B3B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
+
import { serverLogger } from "../../utils/index.js";
|
|
3
|
+
import { isDeno } from "../../platform/compat/runtime.js";
|
|
4
|
+
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
5
|
+
const logger = serverLogger.component("permissions");
|
|
6
|
+
/**
|
|
7
|
+
* Access the Deno permissions API through a narrow, typed view.
|
|
8
|
+
* Returns null when not running under Deno or the API is unavailable.
|
|
9
|
+
*/
|
|
10
|
+
function getDenoPermissions() {
|
|
11
|
+
const denoGlobal = dntShim.dntGlobalThis.Deno;
|
|
12
|
+
const permissions = denoGlobal?.permissions;
|
|
13
|
+
if (!permissions || typeof permissions.request !== "function")
|
|
14
|
+
return null;
|
|
15
|
+
return permissions;
|
|
16
|
+
}
|
|
17
|
+
function createPermissionDescriptor(request) {
|
|
18
|
+
const { name, host, path } = request;
|
|
19
|
+
switch (name) {
|
|
20
|
+
case "net":
|
|
21
|
+
return host ? { name, host } : { name };
|
|
22
|
+
case "read":
|
|
23
|
+
case "write":
|
|
24
|
+
return path ? { name, path } : { name };
|
|
25
|
+
case "env":
|
|
26
|
+
case "run":
|
|
27
|
+
return { name };
|
|
28
|
+
case "fs":
|
|
29
|
+
default:
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function requestDenoPermission(request) {
|
|
34
|
+
return withSpan("security.permissions.requestDeno", async () => {
|
|
35
|
+
const permissions = getDenoPermissions();
|
|
36
|
+
if (!isDeno || !permissions)
|
|
37
|
+
return { state: "denied" };
|
|
38
|
+
if (request.name === "fs") {
|
|
39
|
+
const path = request.path;
|
|
40
|
+
const readStatus = await permissions.request({ name: "read", path });
|
|
41
|
+
if (readStatus.state !== "granted")
|
|
42
|
+
return { state: readStatus.state };
|
|
43
|
+
const writeStatus = await permissions.request({ name: "write", path });
|
|
44
|
+
return { state: writeStatus.state };
|
|
45
|
+
}
|
|
46
|
+
const descriptor = createPermissionDescriptor(request);
|
|
47
|
+
if (!descriptor) {
|
|
48
|
+
logger.warn("Unsupported permission request", request);
|
|
49
|
+
return { state: "denied" };
|
|
50
|
+
}
|
|
51
|
+
const status = await permissions.request(descriptor);
|
|
52
|
+
return { state: status.state };
|
|
53
|
+
}, { "permission.name": request.name });
|
|
54
|
+
}
|
|
55
|
+
let warnedNonDenoAutoGrant = false;
|
|
56
|
+
function warnNonDenoAutoGrantOnce() {
|
|
57
|
+
if (warnedNonDenoAutoGrant)
|
|
58
|
+
return;
|
|
59
|
+
warnedNonDenoAutoGrant = true;
|
|
60
|
+
logger.warn("Permission sandbox is a no-op on non-Deno runtimes: all permission " +
|
|
61
|
+
"requests are auto-granted. Do not rely on this guard for isolation " +
|
|
62
|
+
"when running outside Deno.");
|
|
63
|
+
}
|
|
64
|
+
export function requestPermission(request) {
|
|
65
|
+
return withSpan("security.permissions.request", async () => {
|
|
66
|
+
try {
|
|
67
|
+
if (isDeno)
|
|
68
|
+
return await requestDenoPermission(request);
|
|
69
|
+
// On non-Deno runtimes there is no OS-level permission API to consult,
|
|
70
|
+
// so every request is auto-granted — this guard provides NO isolation
|
|
71
|
+
// here. Warn loudly (once) so an operator running the runtime outside
|
|
72
|
+
// Deno cannot mistake this for an enforced sandbox.
|
|
73
|
+
warnNonDenoAutoGrantOnce();
|
|
74
|
+
serverLogger.debug("[permissions] Permission auto-granted (non-Deno runtime)", { permission: request.name });
|
|
75
|
+
return { state: "granted" };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
logger.warn("Permission request failed", {
|
|
79
|
+
permission: request.name,
|
|
80
|
+
error,
|
|
81
|
+
});
|
|
82
|
+
return { state: "denied" };
|
|
83
|
+
}
|
|
84
|
+
}, { "permission.name": request.name });
|
|
85
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-runtime-context.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/project-runtime-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"project-runtime-context.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/project-runtime-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAA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,SAAS,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,sBAAsB,CAAC,CA8CjC;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAcpC;AAED,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,+BAA+B,CAAC,CAqQ1C"}
|
|
@@ -2,6 +2,9 @@ import { getBaseLogger } from "../../utils/index.js";
|
|
|
2
2
|
import { getHostEnv } from "../../platform/compat/process.js";
|
|
3
3
|
import { prepareDeclarativeConfigContext } from "../../config/declarative-evaluator.js";
|
|
4
4
|
import { deriveSecurityContext } from "../../security/http/config.js";
|
|
5
|
+
import { getDerivedCspOrigins } from "../../security/http/derived-csp-cache.js";
|
|
6
|
+
import { resolveStyleContentVersion } from "../../html/styles-builder/content-version.js";
|
|
7
|
+
import { isExtendedFSAdapter } from "../../platform/adapters/index.js";
|
|
5
8
|
import { normalizeSourceIntegrationPolicy } from "../../integrations/source-policy.js";
|
|
6
9
|
import { createRequestContext } from "../context/request-context.js";
|
|
7
10
|
import { isProxyTrusted } from "../utils/proxy-trust.js";
|
|
@@ -157,11 +160,55 @@ export async function resolveProjectRuntimeContext(input) {
|
|
|
157
160
|
// deliberately config-less control-plane path config-less: those endpoints
|
|
158
161
|
// authenticate their signed operation envelope and do not expose an
|
|
159
162
|
// application/browser surface.
|
|
163
|
+
// Origins the project's own source references, so a project that never wrote
|
|
164
|
+
// a `security.csp` still loads its own images, video and fonts. Only passive
|
|
165
|
+
// directives are derived; see security/http/derived-csp-origins.ts for why
|
|
166
|
+
// script-src is not.
|
|
167
|
+
//
|
|
168
|
+
// Runs inside runWithContext, not after it. MultiProjectFSAdapter resolves
|
|
169
|
+
// the tenant from AsyncLocalStorage, and outside that context it either
|
|
170
|
+
// throws -- swallowed by getAllSourceFiles into an empty list that would then
|
|
171
|
+
// be cached forever -- or falls back to a default adapter, which would derive
|
|
172
|
+
// one project's origins from another's source.
|
|
173
|
+
//
|
|
174
|
+
// Derived for config-less projects too. Those are the ones this exists for:
|
|
175
|
+
// a project with no veryfront.config.* is exactly the project that never
|
|
176
|
+
// declared a policy, and gating on config would leave it on the bare floor.
|
|
177
|
+
//
|
|
178
|
+
// Excluded on the deferred path. Those control-plane endpoints authenticate a
|
|
179
|
+
// signed operation envelope, expose no browser surface, and deliberately read
|
|
180
|
+
// no outer source -- deriving there would both serve nothing and break that
|
|
181
|
+
// guarantee.
|
|
182
|
+
const derivedCsp = input.isProxyMode && projectRes.projectSlug && reqCtx.token &&
|
|
183
|
+
adapterRes.configOutcome !== "deferred"
|
|
184
|
+
? await deriveProjectCspOrigins({
|
|
185
|
+
adapter: adapterRes.adapter,
|
|
186
|
+
projectSlug: projectRes.projectSlug,
|
|
187
|
+
projectId: projectRes.projectId,
|
|
188
|
+
token: reqCtx.token,
|
|
189
|
+
releaseId: envRes.releaseId,
|
|
190
|
+
// Same precedence as the hosted config source context above. If the two
|
|
191
|
+
// disagree, derivation reads a different branch than the one that
|
|
192
|
+
// produced the config, and the origins describe content other than the
|
|
193
|
+
// page being served.
|
|
194
|
+
branch: reqCtx.branch ?? projectRes.parsedDomain?.branch,
|
|
195
|
+
environmentName: projectRes.environmentName,
|
|
196
|
+
})
|
|
197
|
+
: undefined;
|
|
160
198
|
const requestSecurity = input.isProxyMode && adapterRes.config !== undefined
|
|
161
199
|
? deriveSecurityContext(adapterRes.config, {
|
|
162
200
|
productionDefaults: envRes.resolvedEnvironment === "production",
|
|
201
|
+
derivedCsp,
|
|
163
202
|
})
|
|
164
|
-
|
|
203
|
+
// A hosted project with no config file still gets its own security context
|
|
204
|
+
// rather than the process-wide one: defaults plus whatever its source
|
|
205
|
+
// implies. `deferred` control-plane requests keep the config-less shape.
|
|
206
|
+
: input.isProxyMode && projectRes.projectSlug && adapterRes.configOutcome === "hosted-absent"
|
|
207
|
+
? deriveSecurityContext(undefined, {
|
|
208
|
+
productionDefaults: envRes.resolvedEnvironment === "production",
|
|
209
|
+
derivedCsp,
|
|
210
|
+
})
|
|
211
|
+
: undefined;
|
|
165
212
|
// Falling back here substitutes the process-wide security config for the
|
|
166
213
|
// project's, which serves a 200 whose CSP is the platform floor rather than
|
|
167
214
|
// the project's policy. The response looks correct, so nothing downstream
|
|
@@ -307,3 +354,52 @@ function createProxyGuard(req, isProxyMode, headers, proxyTrusted, identityHeade
|
|
|
307
354
|
}),
|
|
308
355
|
};
|
|
309
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Derive a project's passive CSP origins inside its own adapter context.
|
|
359
|
+
*
|
|
360
|
+
* The source read and the snapshot identity are both taken under
|
|
361
|
+
* `runWithContext`, because the multi-project adapter selects the tenant from
|
|
362
|
+
* AsyncLocalStorage and silently yields nothing -- or the wrong project --
|
|
363
|
+
* without it.
|
|
364
|
+
*/
|
|
365
|
+
async function deriveProjectCspOrigins(args) {
|
|
366
|
+
if (!isExtendedFSAdapter(args.adapter.fs) || !args.adapter.fs.runWithContext)
|
|
367
|
+
return undefined;
|
|
368
|
+
const fs = args.adapter.fs;
|
|
369
|
+
const run = async () => {
|
|
370
|
+
const underlying = typeof fs.getUnderlyingAdapter === "function"
|
|
371
|
+
? fs.getUnderlyingAdapter()
|
|
372
|
+
: undefined;
|
|
373
|
+
if (!underlying || typeof underlying.getAllSourceFiles !== "function")
|
|
374
|
+
return undefined;
|
|
375
|
+
// Branch and environment content versions are stable while the content
|
|
376
|
+
// under them changes, so the adapter's snapshot generation is what actually
|
|
377
|
+
// moves when a preview is pushed to. Without it a preview would serve a
|
|
378
|
+
// derivation from before the push until the entry is evicted.
|
|
379
|
+
const snapshot = typeof underlying.getSourceSnapshotVersion === "function"
|
|
380
|
+
? underlying.getSourceSnapshotVersion()
|
|
381
|
+
: 0;
|
|
382
|
+
const contentVersion = `${resolveStyleContentVersion(underlying.getContentContext?.() ?? null, {
|
|
383
|
+
releaseId: args.releaseId,
|
|
384
|
+
branch: args.branch,
|
|
385
|
+
environmentName: args.environmentName,
|
|
386
|
+
})}@${snapshot}`;
|
|
387
|
+
return await getDerivedCspOrigins({
|
|
388
|
+
projectScope: args.projectSlug,
|
|
389
|
+
contentVersion,
|
|
390
|
+
loadSourceFiles: () => underlying.getAllSourceFiles(),
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
try {
|
|
394
|
+
return await fs.runWithContext(args.projectSlug, args.token, run, args.projectId, {
|
|
395
|
+
productionMode: Boolean(args.releaseId),
|
|
396
|
+
releaseId: args.releaseId ?? null,
|
|
397
|
+
branch: args.branch ?? null,
|
|
398
|
+
environmentName: args.environmentName ?? null,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
// Never fail a response over a CSP nicety.
|
|
403
|
+
return undefined;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
@@ -31,6 +31,16 @@ export interface SecurityConfig {
|
|
|
31
31
|
* renderer requires.
|
|
32
32
|
*/
|
|
33
33
|
csp?: Partial<Record<string, string | string[] | null>>;
|
|
34
|
+
/**
|
|
35
|
+
* Origins derived from the project's own released source, merged between the
|
|
36
|
+
* platform floor and `csp`.
|
|
37
|
+
*
|
|
38
|
+
* Platform-owned: `deriveSecurityContext` overwrites whatever a project
|
|
39
|
+
* config carries under this key, because `SecurityConfig` has an index
|
|
40
|
+
* signature and would otherwise let a project declare its own derived layer.
|
|
41
|
+
* Projects extend the policy through `csp`, which is merged on top of this.
|
|
42
|
+
*/
|
|
43
|
+
derivedCsp?: import("../security/http/derived-csp-origins.js").DerivedCspOrigins;
|
|
34
44
|
coop?: "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
35
45
|
corp?: "same-origin" | "same-site" | "cross-origin";
|
|
36
46
|
coep?: "require-corp" | "unsafe-none";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/src/types/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE;YACN,QAAQ,EAAE,MAAM,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAC;YACjB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,IAAI,CAAC,EACD,OAAO,GACP;QACA,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC;QACpE,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,OAAO,CAAC,EA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C,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,KAAK,YAAY,GAAG,CAClB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;CAAE,KAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAC3C"}
|
|
@@ -52,7 +52,7 @@ export declare const api: {
|
|
|
52
52
|
cursor?: string;
|
|
53
53
|
limit?: number;
|
|
54
54
|
pattern?: string;
|
|
55
|
-
}) => Promise<import("../platform/adapters/
|
|
55
|
+
}) => Promise<import("../platform/adapters/index.js").FileListResult>;
|
|
56
56
|
/**
|
|
57
57
|
* List all files in the project (handles pagination automatically)
|
|
58
58
|
*/
|
|
@@ -72,7 +72,7 @@ export declare const api: {
|
|
|
72
72
|
* Get file details (content + metadata)
|
|
73
73
|
* @param pathOrId - File path or ID
|
|
74
74
|
*/
|
|
75
|
-
get: (pathOrId: string) => Promise<import("../platform/adapters/
|
|
75
|
+
get: (pathOrId: string) => Promise<import("../platform/adapters/index.js").FileDetail>;
|
|
76
76
|
/**
|
|
77
77
|
* Search for files matching a pattern
|
|
78
78
|
* @param pattern - Search pattern (glob-like)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1214",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -421,13 +421,13 @@
|
|
|
421
421
|
"@deno/shim-crypto": "0.3.1",
|
|
422
422
|
"@types/react": "19.2.14",
|
|
423
423
|
"@types/react-dom": "19.2.3",
|
|
424
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
425
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
426
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
427
|
-
"@veryfront/ext-dev-ui-react": "0.1.
|
|
428
|
-
"@veryfront/ext-node-websocket-ws": "0.1.
|
|
429
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
430
|
-
"@veryfront/ext-yaml": "0.1.
|
|
424
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1214",
|
|
425
|
+
"@veryfront/ext-content-mdx": "0.1.1214",
|
|
426
|
+
"@veryfront/ext-css-tailwind": "0.1.1214",
|
|
427
|
+
"@veryfront/ext-dev-ui-react": "0.1.1214",
|
|
428
|
+
"@veryfront/ext-node-websocket-ws": "0.1.1214",
|
|
429
|
+
"@veryfront/ext-parser-babel": "0.1.1214",
|
|
430
|
+
"@veryfront/ext-yaml": "0.1.1214"
|
|
431
431
|
},
|
|
432
432
|
"devDependencies": {
|
|
433
433
|
"@types/node": "20.9.0"
|