fix(sandbox): align canonical spec with msb 0.6.8 runtime defaults

This commit is contained in:
Chris Scott committed 2026-08-23 12:07:27 -04:00
1 parent f2d0ae0595
commit 3791a74569
4 files changed
+15 -13

No files matched your search

+4 -2
View File
@@ -9,6 +9,8 @@ export const SANDBOX_UNAVAILABLE_PREFIX = 'Sandbox enforcement is on but the san
const SANDBOX_PLAN_REQUEST_MARGIN_MS = 30000
const MSB_METRICS_SAMPLE_INTERVAL_MS = 1000
export function sandboxPlanTimeoutMs(): number {
return ENV.SANDBOX.START_TIMEOUT_MS + SANDBOX_PLAN_REQUEST_MARGIN_MS
}
@@ -237,7 +239,7 @@ export function resolveExpectedSandboxNetworkPolicy(netProfile: string): Sandbox
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
...groups.map((group) => ({ direction: 'egress', destination: { group }, protocols: [], ports: [], action: 'allow' })),
],
}
@@ -402,7 +404,7 @@ export function buildCanonicalSandboxSpec(): Record<string, unknown> {
hostname: null,
user: args.user,
log_level: null,
metrics_sample_interval_ms: null,
metrics_sample_interval_ms: MSB_METRICS_SAMPLE_INTERVAL_MS,
disable_metrics_sample: false,
},
env: [],
+2 -2
View File
@@ -47,7 +47,7 @@ function trustedRunningInspect(): { exitCode: number; stdout: string; stderr: st
hostname: null,
user: resolveSandboxExecUser(),
log_level: null,
metrics_sample_interval_ms: null,
metrics_sample_interval_ms: 1000,
disable_metrics_sample: false,
},
env: [],
@@ -67,7 +67,7 @@ function trustedRunningInspect(): { exitCode: number; stdout: string; stderr: st
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
],
},
@@ -552,7 +552,7 @@ describe('sandbox network policy attestation helpers', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
],
}
@@ -566,7 +566,7 @@ describe('sandbox network policy attestation helpers', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'private' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: [], ports: [], action: 'allow' },
@@ -648,7 +648,7 @@ describe('sandbox network policy attestation helpers', () => {
expect(sandboxNetworkPolicyMismatch({ default_egress: 'deny' }, expected)).toContain('missing or malformed')
expect(sandboxNetworkPolicyMismatch({ ...publicPolicy, rules: 'not-an-array' }, expected)).toContain('missing or malformed')
expect(sandboxNetworkPolicyMismatch(
{ ...publicPolicy, rules: [{ direction: 'egress', destination: { group: 'dns' }, action: 'allow' }] },
{ ...publicPolicy, rules: [{ direction: 'egress', destination: { group: 'host' }, action: 'allow' }] },
expected,
)).toContain('network policy')
})
@@ -130,7 +130,7 @@ describe('SandboxRuntimeService', () => {
hostname: null,
user: resolveSandboxExecUser(),
log_level: 'info',
metrics_sample_interval_ms: null,
metrics_sample_interval_ms: 1000,
disable_metrics_sample: false,
},
env: [
@@ -153,7 +153,7 @@ describe('SandboxRuntimeService', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
],
},
@@ -1142,7 +1142,7 @@ describe('SandboxRuntimeService', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { any: true }, protocols: [], ports: [], action: 'allow' },
],
},
@@ -1185,7 +1185,7 @@ describe('SandboxRuntimeService', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'private' }, protocols: [], ports: [], action: 'allow' },
],
@@ -1229,7 +1229,7 @@ describe('SandboxRuntimeService', () => {
default_egress: 'deny',
default_ingress: 'allow',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
],
},
max_connections: null,
@@ -1271,7 +1271,7 @@ describe('SandboxRuntimeService', () => {
default_egress: 'deny',
default_ingress: 'deny',
rules: [
{ direction: 'egress', destination: { group: 'dns' }, protocols: [], ports: [], action: 'allow' },
{ direction: 'egress', destination: { group: 'host' }, protocols: ['udp', 'tcp'], ports: [{ start: 53, end: 53 }], action: 'allow' },
{ direction: 'egress', destination: { group: 'public' }, protocols: [], ports: [], action: 'allow' },
],
},