Files
texturecraft/crates/automation/Cargo.toml
AgapenordevandClaude Opus 5.5 5a065c1e15 Control channel: harden the token file and the app's control server
The desktop app wrote its control token to <temp>/texturecraft-control-<port>.token with
default permissions (world-readable in a shared /tmp), from a hash-based generator, and
compared it non-constant-time with no connection limit. Any local user could read the token
and drive the app, whose command.run takes host paths.

- Token files are created new (remove, then O_EXCL) with mode 0600, so a planted file or
  symlink can neither keep its permissions nor redirect the write; one that cannot be
  replaced disables the server with a hint to set TEXTURECRAFT_CONTROL_TOKEN.
- Clients only read a token file that is a regular file owned by them with no group or
  other permissions, opened without following symlinks or blocking on a FIFO.
- The app's control server uses the shared security module: OS-random 256-bit token,
  constant-time compare, validated and trimmed env token, bounded lines and at most 16
  connections.
- Connections must authenticate within 10 s (AuthDeadline) and get one attempt.
- The app and `serve --port` bind before writing the token file, so a server whose port is
  busy no longer replaces the running server's token.

Regression tests cover owner-only files over an existing open file, symlink and FIFO
handling, the auth deadline, the connection limit and the app's token checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:16:37 +01:00

32 lines
879 B
TOML

[package]
name = "texturecraft-automation"
description = "TextureCraft automation: MCP server (rmcp), headless JSON-lines RPC and a bridge to the running app"
version.workspace = true
edition.workspace = true
license.workspace = true
[lints]
workspace = true
[dependencies]
texturecraft-engine = { workspace = true }
texturecraft-render = { workspace = true }
texturecraft-formats = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
image = { workspace = true }
rayon = { workspace = true }
rmcp = { workspace = true }
tokio = { workspace = true }
schemars = { workspace = true }
base64 = { workspace = true }
cap-std = { workspace = true }
getrandom = { workspace = true }
[target.'cfg(unix)'.dependencies]
rustix = { workspace = true }
[dev-dependencies]
rmcp = { workspace = true, features = ["client"] }