@@ -821,13 +827,13 @@ const storedSecrets = reactive({ cube: false, e2b: false })
const envRows = ref<{ key: string; value: string; stored?: boolean }[]>([])
const skillRollout = ref<'next_turn' | 'new_session'>('next_turn')
// Both defaults are the zero value on the server too: egress allowed, inbound
-// requiring the per-sandbox credential.
+// requiring the per-sandbox credential. Inbound is not editable in this form.
const denyEgressByDefault = ref(false)
-const allowPublicInbound = ref(false)
const allowOutRows = ref([])
const denyOutRows = ref([])
type CubeRuleForm = {
+ key: string
name: string
scheme?: string
sni?: string
@@ -859,6 +865,12 @@ type E2BRuleForm = {
}
const cubeRules = ref([])
const e2bHostRules = ref([])
+let cubeRuleKeySeq = 0
+
+function newCubeRuleKey(): string {
+ cubeRuleKeySeq += 1
+ return `cube-rule-${cubeRuleKeySeq}`
+}
function isStoredNetworkSecretRecoverable(
row: { stored?: boolean },
@@ -875,11 +887,19 @@ function isStoredNetworkSecretRecoverable(
function addCubeRule() {
for (const rule of cubeRules.value) rule.expanded = false
cubeRules.value.push({
+ key: newCubeRuleKey(),
name: '', scheme: 'https', sni: '', host: '',
methodsText: '', path: '', deny: false, audit: '', expanded: true, inject: [],
})
}
+function moveCubeRule(index: number, delta: number) {
+ const next = index + delta
+ if (next < 0 || next >= cubeRules.value.length) return
+ const [row] = cubeRules.value.splice(index, 1)
+ cubeRules.value.splice(next, 0, row)
+}
+
function addE2BHostRule() {
for (const rule of e2bHostRules.value) rule.expanded = false
e2bHostRules.value.push({ host: '', expanded: true, headers: [] })
@@ -1124,10 +1144,10 @@ function reset() {
skillRollout.value = cfg.skill_rollout === 'new_session' ? 'new_session' : 'next_turn'
const net = cfg.network || {}
denyEgressByDefault.value = net.deny_egress_by_default === true
- allowPublicInbound.value = net.allow_public_inbound === true
allowOutRows.value = [...(net.allow_out || [])]
denyOutRows.value = [...(net.deny_out || [])]
cubeRules.value = (net.cube_rules || []).map((rule) => ({
+ key: newCubeRuleKey(),
name: rule.name || '',
scheme: rule.scheme || '',
sni: rule.sni || '',
@@ -1172,17 +1192,10 @@ function reset() {
function selectBackend(value: string) {
if (backend.value === value) return
- const crossingDocker = backend.value === 'docker' || value === 'docker'
backend.value = value
if (value === 'docker' && !docker.image) {
docker.image = defaultDockerImage
}
- if (crossingDocker) {
- // Docker has no inbound token. Leaving this true while the radio is
- // hidden, then switching to Cube/E2B, would create a publicly reachable
- // sandbox under a control the admin never saw on the docker form.
- allowPublicInbound.value = false
- }
onBackendChange()
}
@@ -1463,14 +1476,12 @@ function collectPayload(): SandboxConfig {
// admin never touched serializes to the same thing as a fresh default.
function collectNetworkPolicy(): SandboxNetworkPolicy {
const policy: SandboxNetworkPolicy = {}
- // Docker can only honour network_mode on the docker block. Sending the
- // Cube/E2B radios would persist a public-inbound flag that becomes real
- // the moment the admin switches backend.
+ // Docker can only honour network_mode on the docker block.
if (backend.value === 'docker') {
return policy
}
if (denyEgressByDefault.value) policy.deny_egress_by_default = true
- if (allowPublicInbound.value) policy.allow_public_inbound = true
+ // Inbound stays the zero value: require the per-sandbox credential.
if (backend.value !== 'docker') {
const allowOut = allowOutRows.value.map((row) => row.trim()).filter(Boolean)
@@ -2218,12 +2229,17 @@ onUnmounted(stopTemplatePolling)
.net-rule__bar {
display: grid;
- grid-template-columns: minmax(0, 1fr) 22px;
+ grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
min-height: 26px;
padding: 0 2px;
}
+.net-rule__actions {
+ display: flex;
+ align-items: center;
+}
+
.net-rule__toggle {
display: flex;
align-items: center;
@@ -2258,6 +2274,7 @@ onUnmounted(stopTemplatePolling)
color: var(--td-text-color-placeholder);
}
+.net-rule__move,
.net-rule__remove {
display: flex;
align-items: center;
@@ -2272,6 +2289,16 @@ onUnmounted(stopTemplatePolling)
border-radius: 4px;
}
+.net-rule__move:hover:not(:disabled) {
+ color: var(--td-text-color-primary);
+ background: var(--td-bg-color-container-hover);
+}
+
+.net-rule__move:disabled {
+ opacity: 0.35;
+ cursor: default;
+}
+
.net-rule__remove:hover {
color: var(--td-error-color);
background: var(--td-bg-color-container-hover);
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index e9d5b240..8968c116 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -1129,11 +1129,7 @@ export default {
sectionRuntime: 'Execution settings',
sectionNetwork: 'Network policy',
sectionEnvironment: 'Environment variables',
- networkHint: 'Controls inbound and outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
- inboundAccess: 'Inbound access',
- inboundAccessHelp: 'Credentials are required by default: the public sandbox URL must carry the token issued at creation.',
- inboundTokenRequired: 'Require credentials (default)',
- inboundPublic: 'Publicly accessible',
+ networkHint: 'Controls outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
egressDefault: 'Default egress',
egressAllowAll: 'Allow public network (default)',
egressDenyAll: 'Deny by default',
@@ -1146,12 +1142,14 @@ export default {
denyOutHelp: 'Deny rules match destination IP only, so domains are not supported.',
domainAllowNeedsDenyAll: 'When allowed destinations contain a domain, also choose “Deny by default” or add 0.0.0.0/0 to denied destinations; otherwise the allowlist is ineffective.',
cubeL7Rules: 'HTTP access rules (L7)',
- cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443.',
+ cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443. Rules are first-match-wins from top to bottom.',
e2bHostRules: 'Host request transforms',
e2bHostRulesHelp: 'Inject headers by host. A rule does not authorize egress; its host must also appear in allowed destinations.',
ruleUntitled: 'Untitled rule',
expandRule: 'Expand rule',
collapseRule: 'Collapse rule',
+ moveRuleUp: 'Move rule up',
+ moveRuleDown: 'Move rule down',
ruleName: 'Rule name',
ruleScheme: 'Scheme',
ruleSni: 'SNI',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 0eb748ae..455acc95 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -5073,11 +5073,7 @@ export default {
sectionRuntime: 'Execution settings',
sectionNetwork: 'Network policy',
sectionEnvironment: 'Environment variables',
- networkHint: 'Controls inbound and outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
- inboundAccess: 'Inbound access',
- inboundAccessHelp: 'Credentials are required by default: the public sandbox URL must carry the token issued at creation.',
- inboundTokenRequired: 'Require credentials (default)',
- inboundPublic: 'Publicly accessible',
+ networkHint: 'Controls outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
egressDefault: 'Default egress',
egressAllowAll: 'Allow public network (default)',
egressDenyAll: 'Deny by default',
@@ -5090,12 +5086,14 @@ export default {
denyOutHelp: 'Deny rules match destination IP only, so domains are not supported.',
domainAllowNeedsDenyAll: 'When allowed destinations contain a domain, also choose “Deny by default” or add 0.0.0.0/0 to denied destinations; otherwise the allowlist is ineffective.',
cubeL7Rules: 'HTTP access rules (L7)',
- cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443.',
+ cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443. Rules are first-match-wins from top to bottom.',
e2bHostRules: 'Host request transforms',
e2bHostRulesHelp: 'Inject headers by host. A rule does not authorize egress; its host must also appear in allowed destinations.',
ruleUntitled: 'Untitled rule',
expandRule: 'Expand rule',
collapseRule: 'Collapse rule',
+ moveRuleUp: 'Move rule up',
+ moveRuleDown: 'Move rule down',
ruleName: 'Rule name',
ruleScheme: 'Scheme',
ruleSni: 'SNI',
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 2451ff2d..cbe37caf 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -5073,11 +5073,7 @@ export default {
sectionRuntime: 'Execution settings',
sectionNetwork: 'Network policy',
sectionEnvironment: 'Environment variables',
- networkHint: 'Controls inbound and outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
- inboundAccess: 'Inbound access',
- inboundAccessHelp: 'Credentials are required by default: the public sandbox URL must carry the token issued at creation.',
- inboundTokenRequired: 'Require credentials (default)',
- inboundPublic: 'Publicly accessible',
+ networkHint: 'Controls outbound networking for every sandbox using this configuration. Changes affect only newly created sandboxes; existing sandboxes keep their policy until reclaimed.',
egressDefault: 'Default egress',
egressAllowAll: 'Allow public network (default)',
egressDenyAll: 'Deny by default',
@@ -5090,12 +5086,14 @@ export default {
denyOutHelp: 'Deny rules match destination IP only, so domains are not supported.',
domainAllowNeedsDenyAll: 'When allowed destinations contain a domain, also choose “Deny by default” or add 0.0.0.0/0 to denied destinations; otherwise the allowlist is ineffective.',
cubeL7Rules: 'HTTP access rules (L7)',
- cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443.',
+ cubeL7RulesHelp: 'Every rule requires host or sni; the network layer derives allowed targets only from those fields. Fields are AND-ed and methods are OR-ed. Applies only to HTTP 80 / HTTPS 443. Rules are first-match-wins from top to bottom.',
e2bHostRules: 'Host request transforms',
e2bHostRulesHelp: 'Inject headers by host. A rule does not authorize egress; its host must also appear in allowed destinations.',
ruleUntitled: 'Untitled rule',
expandRule: 'Expand rule',
collapseRule: 'Collapse rule',
+ moveRuleUp: 'Move rule up',
+ moveRuleDown: 'Move rule down',
ruleName: 'Rule name',
ruleScheme: 'Scheme',
ruleSni: 'SNI',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 8511961e..63f47498 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -5075,11 +5075,7 @@ export default {
sectionRuntime: '执行设置',
sectionNetwork: '网络策略',
sectionEnvironment: '环境变量',
- networkHint: '控制该配置下所有沙箱的出入网。改动只影响之后新建的沙箱,已有沙箱按原策略运行到回收。',
- inboundAccess: '入站访问',
- inboundAccessHelp: '默认要求凭证:沙箱公网 URL 必须携带创建时签发的 token。',
- inboundTokenRequired: '要求凭证(默认)',
- inboundPublic: '公网可访问',
+ networkHint: '控制该配置下所有沙箱的出网。改动只影响之后新建的沙箱,已有沙箱按原策略运行到回收。',
egressDefault: '出站默认',
egressAllowAll: '允许公网(默认)',
egressDenyAll: '默认拒绝',
@@ -5092,12 +5088,14 @@ export default {
denyOutHelp: '拒绝只按目的 IP 匹配,因此不支持域名。',
domainAllowNeedsDenyAll: '放行目标里有域名时,必须同时选择「默认拒绝」或在拒绝目标中加入 0.0.0.0/0,否则白名单不生效。',
cubeL7Rules: 'HTTP 访问规则(L7)',
- cubeL7RulesHelp: '每条规则必须填 host 或 sni,网络层只从这两个字段提取放行目标。字段之间是 AND,method 列表内部是 OR。仅 HTTP 80 / HTTPS 443 生效。',
+ cubeL7RulesHelp: '每条规则必须填 host 或 sni,网络层只从这两个字段提取放行目标。字段之间是 AND,method 列表内部是 OR。仅 HTTP 80 / HTTPS 443 生效。规则从上到下先匹配先生效。',
e2bHostRules: 'Host 请求变换',
e2bHostRulesHelp: '按 host 注入 header。规则本身不授权出网,host 必须同时出现在放行目标里。',
ruleUntitled: '未命名规则',
expandRule: '展开规则',
collapseRule: '收起规则',
+ moveRuleUp: '上移规则',
+ moveRuleDown: '下移规则',
ruleName: '规则名',
ruleScheme: '协议',
ruleSni: 'SNI',