fix: permit verified local APT acquisition with native network denial checks
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -265,10 +265,17 @@ Both modes run the same pipeline:
|
||||
probe. Never delete locks, kill owners or use simulation to prove locking.
|
||||
A busy foreign lock vetoes the bootstrap. Release only this process's fd.
|
||||
7. Fsync native-prechecks record, then sandbox-ready marker. Native APT uses
|
||||
exact local archives, `--no-download --no-remove --no-install-recommends` and
|
||||
exact local archives, `--no-remove --no-install-recommends` and
|
||||
constant isolated config. No global APT hooks/sources/preferences; reviewed
|
||||
dpkg global config is runtime-hash-bound in the signed action. Native foreign
|
||||
lock wait remains bounded to 10 seconds.
|
||||
**2026-11-13 native diagnosis:** `--no-download` prevented APT's local file
|
||||
acquisition and emitted `**ERROR**` instead of the absolute archive filename
|
||||
in protocol v3. The provider permits local acquisition of the presealed
|
||||
archive; the AF_UNIX-only private worker still rejects actual IPv4/IPv6
|
||||
socket creation. Both denials are now checked inside worker/hook/probe.
|
||||
A permitted IP socket or unrelated resource error vetoes; this is not a
|
||||
network-download allowance or acceptance/manifest/hash/path bypass.
|
||||
8. Mandatory v3 pre-dpkg hook repeats signed/runtime/scope/sandbox checks,
|
||||
validates the whole actual action set, actual hashes/control/payload,
|
||||
status/baseline and final deadline; O_EXCL + file/directory fsync effect-armed
|
||||
|
||||
@@ -14,6 +14,7 @@ import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import selectors
|
||||
import socket
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -824,6 +825,7 @@ APT::Install-Suggests "false";
|
||||
APT::Get::AutomaticRemove "false";
|
||||
APT::Get::Fix-Broken "false";
|
||||
APT::Get::Fix-Missing "false";
|
||||
APT::Get::Download "true";
|
||||
APT::Get::allow-Downgrades "false";
|
||||
APT::Get::allow-Remove-Essential "false";
|
||||
DPkg::Lock::Timeout "10";
|
||||
@@ -838,8 +840,12 @@ DPkg::Tools::Options::/usr/lib/rmm-apt-transaction/hook::InfoFD "0";
|
||||
|
||||
|
||||
def apt_argv(transaction):
|
||||
# APT's --no-download also prevents the local file method from resolving
|
||||
# its Install filename (v3 emits **ERROR**). Permit local acquisition of
|
||||
# the already sealed/hash-checked archive. Empty sources, fixed paths and
|
||||
# the verified AF_UNIX-only private worker still forbid network retrieval.
|
||||
return ['/usr/bin/apt-get', '--yes', '--no-remove', '--no-install-recommends',
|
||||
'--no-download', 'install', '--'] + [p.archive_path for p in transaction.packages]
|
||||
'install', '--'] + [p.archive_path for p in transaction.packages]
|
||||
|
||||
|
||||
def check_hook_config(config):
|
||||
@@ -985,6 +991,7 @@ def inspect_sandbox(workspace=None):
|
||||
require(caps == sum(1 << n for n in (0, 1, 3, 4, 6, 7, 8, 31)), 'SANDBOX_CAPS')
|
||||
require(int(status['CapInh'].strip(), 16) == 0 and int(status['CapAmb'].strip(), 16) == 0,
|
||||
'SANDBOX_INHERITED_CAPS')
|
||||
verify_no_ip_sockets()
|
||||
# Host PID1 must not be visible. Namespace PID1 is this trusted Python worker.
|
||||
require(Path('/proc/1/cmdline').read_bytes().startswith(b'/usr/bin/python3\x00-I\x00'),
|
||||
'SANDBOX_PID1')
|
||||
@@ -1003,6 +1010,19 @@ def inspect_sandbox(workspace=None):
|
||||
require(os.readlink('/proc/self/ns/' + name) != ids[name], 'SANDBOX_NAMESPACE')
|
||||
|
||||
|
||||
def verify_no_ip_sockets():
|
||||
"""Kernel enforcement, not a no-download flag or a network configuration claim."""
|
||||
for family in (socket.AF_INET, socket.AF_INET6):
|
||||
try:
|
||||
candidate = socket.socket(family, socket.SOCK_STREAM)
|
||||
except OSError as error:
|
||||
require(error.errno in (errno.EAFNOSUPPORT, errno.EPERM, errno.EACCES),
|
||||
'SANDBOX_IP_SOCKET_CHECK')
|
||||
else:
|
||||
candidate.close()
|
||||
raise Veto('SANDBOX_IP_SOCKET_ALLOWED')
|
||||
|
||||
|
||||
def inspect_private_control_paths():
|
||||
# Validate directory contents rather than guessing future key filenames.
|
||||
# Both historical and current cloud identity/config layouts must be hidden.
|
||||
|
||||
Reference in New Issue
Block a user