@tangle-network/agent-provider-tangle 5.0.1 → 5.0.2
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/dist/exact-process.js
CHANGED
|
@@ -182,10 +182,6 @@ function exactSandboxOptions(input, defaults, providerName, identityDigest) {
|
|
|
182
182
|
input.provisionTimeoutMs < 1)) {
|
|
183
183
|
throw new Error("exact process provisionTimeoutMs must be a positive integer");
|
|
184
184
|
}
|
|
185
|
-
if (input.egress.mode === "strict" &&
|
|
186
|
-
input.egress.allowDomains.length === 0) {
|
|
187
|
-
throw new Error("strict exact process egress requires at least one domain");
|
|
188
|
-
}
|
|
189
185
|
const resources = sandboxResourcesFromRequest(input.resources);
|
|
190
186
|
return {
|
|
191
187
|
environment: input.image,
|
|
@@ -200,7 +196,7 @@ function exactSandboxOptions(input, defaults, providerName, identityDigest) {
|
|
|
200
196
|
? { mode: "blocked" }
|
|
201
197
|
: {
|
|
202
198
|
mode: "strict",
|
|
203
|
-
allowDomains:
|
|
199
|
+
allowDomains: input.egress.allowDomains.map((e) => typeof e === "string" ? e : { ...e, allowPrivateIps: [...e.allowPrivateIps] }),
|
|
204
200
|
includeImplicitDomains: false,
|
|
205
201
|
},
|
|
206
202
|
maxLifetimeSeconds: input.maxLifetimeMs / 1_000,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
1
|
+
import { AgentEnvironmentEgressAllowDomainSchema, canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
2
2
|
export const MAX_EXACT_FILE_BYTES = 64 * 1024 * 1024;
|
|
3
3
|
export const MAX_LIST_RESULTS = 100_000;
|
|
4
4
|
/** Sandbox caps list responses at 1,000 resources. */
|
|
@@ -50,6 +50,8 @@ export const MAX_INLINE_PAYLOAD_BYTES = 1024 * 1024 - 8 * 1024;
|
|
|
50
50
|
*/
|
|
51
51
|
export const MAX_TOTAL_PAYLOAD_BYTES = 64 * 1024 * 1024;
|
|
52
52
|
export const MAX_ARRAY_LENGTH = 1_024;
|
|
53
|
+
/** Strict exact-process egress: the interface entry shape, one to {@link MAX_ARRAY_LENGTH} entries. */
|
|
54
|
+
const EXACT_PROCESS_ALLOW_DOMAINS = AgentEnvironmentEgressAllowDomainSchema.array().min(1).max(MAX_ARRAY_LENGTH);
|
|
53
55
|
export const MAX_MAP_ENTRIES = 256;
|
|
54
56
|
export const MAX_JSON_DEPTH = 16;
|
|
55
57
|
export const MAX_JSON_NODES = 8_192;
|
|
@@ -438,17 +440,9 @@ export function validateExactProcessCreateInput(input, providerName, options) {
|
|
|
438
440
|
throw new Error("strict exact process egress has unsupported fields");
|
|
439
441
|
}
|
|
440
442
|
if (input.egress.mode === "strict") {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if (input.egress.allowDomains.length > MAX_ARRAY_LENGTH) {
|
|
445
|
-
throw new Error("exact process egress allowDomains has too many entries");
|
|
446
|
-
}
|
|
447
|
-
if (input.egress.allowDomains.length === 0) {
|
|
448
|
-
throw new Error("strict exact process egress requires at least one domain");
|
|
449
|
-
}
|
|
450
|
-
for (const domain of input.egress.allowDomains) {
|
|
451
|
-
boundedIdentifier(domain, "exact process egress domain");
|
|
443
|
+
// The interface schema owns the entry shape; strict exact egress also needs one entry.
|
|
444
|
+
if (!EXACT_PROCESS_ALLOW_DOMAINS.safeParse(input.egress.allowDomains).success) {
|
|
445
|
+
throw new Error("strict exact process egress requires one to 1024 valid allowDomains entries");
|
|
452
446
|
}
|
|
453
447
|
}
|
|
454
448
|
if (!Number.isSafeInteger(input.maxLifetimeMs) ||
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertCliAuthReferenceSupported, cliAuthReferenceSchema, } from "@tangle-network/sandbox/auth";
|
|
2
2
|
import { parseBackendType, } from "@tangle-network/sandbox";
|
|
3
|
-
import { AgentEnvironmentEgressPolicySchema, WorkspaceRequestSchema, workspaceCwdPathForBase, } from "@tangle-network/agent-interface/environment-provider";
|
|
3
|
+
import { AgentEnvironmentEgressAllowDomainSchema, AgentEnvironmentEgressPolicySchema, WorkspaceRequestSchema, workspaceCwdPathForBase, } from "@tangle-network/agent-interface/environment-provider";
|
|
4
4
|
import { assertBoundedJson, boundedIdentifier, boundedString, MAX_ARRAY_LENGTH, MAX_MAP_ENTRIES, PROFILE_AT_BACKEND_PROFILE, PROFILE_AT_ROOT, } from "./tangle-contract-safety.js";
|
|
5
5
|
import { profileCredentialSource } from "./model-credential-source.js";
|
|
6
6
|
import { sandboxResourcesFromResourceRequest } from "./tangle-resources.js";
|
|
@@ -383,18 +383,11 @@ export function assertMappedCreateOptions(options) {
|
|
|
383
383
|
throw new Error("Tangle mapped egress policy allows domains only in strict mode");
|
|
384
384
|
}
|
|
385
385
|
// The default path is schema-checked, so this gate holds a custom mapper to the same shape.
|
|
386
|
-
// A
|
|
386
|
+
// A malformed or padded host reaches the platform, matches nothing, and leaves the caller
|
|
387
387
|
// believing an allowlist is in force that is not.
|
|
388
|
-
if (options.egressPolicy.allowDomains !== undefined
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
if (options.egressPolicy.allowDomains.length > MAX_ARRAY_LENGTH) {
|
|
393
|
-
throw new Error("Tangle mapped egress allowed domains exceed their bound");
|
|
394
|
-
}
|
|
395
|
-
for (const domain of options.egressPolicy.allowDomains) {
|
|
396
|
-
boundedIdentifier(domain, "Tangle mapped egress allowed domain");
|
|
397
|
-
}
|
|
388
|
+
if (options.egressPolicy.allowDomains !== undefined &&
|
|
389
|
+
!AgentEnvironmentEgressAllowDomainSchema.array().max(MAX_ARRAY_LENGTH).safeParse(options.egressPolicy.allowDomains).success) {
|
|
390
|
+
throw new Error("Tangle mapped egress allowed domain is invalid");
|
|
398
391
|
}
|
|
399
392
|
}
|
|
400
393
|
if (options.env !== undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tangle-network/agent-interface": "^5.10.
|
|
36
|
+
"@tangle-network/agent-interface": "^5.10.10"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@tangle-network/sandbox": ">=1.0.
|
|
39
|
+
"@tangle-network/sandbox": ">=1.0.141 <2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@tangle-network/sandbox": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tangle-network/agent-provider-testkit": "0.12.1",
|
|
48
48
|
"@tangle-network/agent-runtime": "0.349.0",
|
|
49
|
-
"@tangle-network/sandbox": "1.0.
|
|
49
|
+
"@tangle-network/sandbox": "1.0.141",
|
|
50
50
|
"@types/node": "26.6.5",
|
|
51
51
|
"typescript": "6.0.3",
|
|
52
52
|
"vitest": "5.0.5"
|