feat: run sandbox transports in disposable workers
The control plane opened ssh connections itself, so a malicious ssh server attacked the process that held the database, the master key, and every room's keys. It now starts one worker per target and workspace. The worker gets one target key on stdin, binds loopback behind a random token, and serves exec, files, the pty, and the preview proxy. It has no database and no master key, and a closed stdin ends it. The preview HTTP client moved into the worker too. The app sees a typed response, and the worker caps bodies, output tails, handshakes, and transport waits. Direct targets now reject loopback, private, link-local, multicast, unspecified, carrier-grade NAT, and documentation addresses when a target is created and again when its worker starts. TOGETHER_ALLOW_PRIVATE_TARGETS=1 lifts the check for a server that runs on one private network.
This commit is contained in:
1 parent
a8f7e74ba0
commit
fc684115b5
16 files changed
+1355
-208
No files matched your search
@@ -33,6 +33,11 @@ pub struct Config {
|
||||
/// invites as the only doors.
|
||||
#[serde(default)]
|
||||
pub allow_registration: bool,
|
||||
/// Whether a sandbox target may point at a loopback, private,
|
||||
/// link-local, or multicast address. Off by default, so a target
|
||||
/// cannot turn the server into a probe of its own network.
|
||||
#[serde(default)]
|
||||
pub allow_private_targets: bool,
|
||||
}
|
||||
|
||||
fn default_steps() -> u32 {
|
||||
@@ -51,6 +56,7 @@ impl Default for Config {
|
||||
max_turn_steps: default_steps(),
|
||||
allowed_frame_ancestors: Vec::new(),
|
||||
allow_registration: false,
|
||||
allow_private_targets: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +95,9 @@ impl Config {
|
||||
if let Ok(value) = std::env::var("TOGETHER_ALLOW_REGISTRATION") {
|
||||
config.allow_registration = matches!(value.as_str(), "1" | "true" | "yes");
|
||||
}
|
||||
if let Ok(value) = std::env::var("TOGETHER_ALLOW_PRIVATE_TARGETS") {
|
||||
config.allow_private_targets = matches!(value.as_str(), "1" | "true" | "yes");
|
||||
}
|
||||
config.public_url = config.public_url.trim_end_matches('/').to_owned();
|
||||
config.preview_origin = config.preview_origin.trim_end_matches('/').to_owned();
|
||||
Ok(config)
|
||||
|
||||
Reference in new issue
Block a user