steam_update func runs SteamCMD per game (rust/conan/soulmask app-ids;
dune rejected), streaming stdout to {instance}.steam_status. Jailed
file manager on {instance}.files.cmd: list/read/write/delete/rename/
mkdir/mkfile/move/copy, all confined to instance root via two-stage
lexical-normalize + canonicalize (defeats ../ traversal AND symlink
escape — incl chained symlinks). Replaces the Go agent's UNJAILED
legacy files API (retired, not ported). 5MiB read cap.
42/42 tests green: 24 filemanager incl 7 jail-escape attempts
(dotdot, deep dotdot, absolute, symlink-inside, direct symlink,
chained symlink), 5 steamcmd app-id (cfg-gated win/linux soulmask).
Jail logic reviewed line-by-line: Path::starts_with is component-wise
(no sibling-prefix bypass), non-existent suffix components can't be
symlinks, leading .. normalizes to / and fails the prefix check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
40 lines
1.4 KiB
Rust
40 lines
1.4 KiB
Rust
//! Corrosion wire protocol v2 subject scheme (see PROTOCOL.md).
|
|
//!
|
|
//! Host-level subjects live under `corrosion.{license}.host.*`; per-instance
|
|
//! subjects under `corrosion.{license}.{instance_id}.*`. Instance ids are
|
|
//! validated at config load so they can never collide with the reserved
|
|
//! `host` segment or contain subject metacharacters.
|
|
|
|
pub fn host_heartbeat(license: &str) -> String {
|
|
format!("corrosion.{license}.host.heartbeat")
|
|
}
|
|
|
|
pub fn host_cmd(license: &str) -> String {
|
|
format!("corrosion.{license}.host.cmd")
|
|
}
|
|
|
|
pub fn host_going_offline(license: &str) -> String {
|
|
format!("corrosion.{license}.host.going_offline")
|
|
}
|
|
|
|
/// Per-instance command channel (start/stop/restart/status; rcon et al. to come).
|
|
pub fn instance_cmd(license: &str, instance: &str) -> String {
|
|
format!("corrosion.{license}.{instance}.cmd")
|
|
}
|
|
|
|
/// Per-instance state-change events.
|
|
pub fn instance_status(license: &str, instance: &str) -> String {
|
|
format!("corrosion.{license}.{instance}.status")
|
|
}
|
|
|
|
/// Per-instance SteamCMD progress stream. Lines from `steamcmd` stdout are
|
|
/// published here so the panel can display live update output.
|
|
pub fn instance_steam_status(license: &str, instance: &str) -> String {
|
|
format!("corrosion.{license}.{instance}.steam_status")
|
|
}
|
|
|
|
/// Per-instance file manager command channel (request-reply).
|
|
pub fn instance_files_cmd(license: &str, instance: &str) -> String {
|
|
format!("corrosion.{license}.{instance}.files.cmd")
|
|
}
|