Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(deps): clear patched RustSec advisories without moving replay hashes
Bump bytes, h2, quinn-proto, rustls 0.23, and the other semver-compatible
advisories. Move aw-net-server and astraweave-net onto tokio-rustls 0.26
and rustls 0.23, and parse PEM with rustls-pki-types. Replace openh264 0.6,
steamworks 0.12, lru 0.12, and zip 6 with maintained releases. Drop the
unused opentelemetry-jaeger dependency.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
  • Loading branch information
cursoragent and lazyxeon committed Oct 16, 2026
commit cbac34295308da0709ccf8735be0ed522a0c0113
951 changes: 531 additions & 420 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ thiserror = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.9"
zip = "6.0"
zip = "9.0"
rand = "0.9"
rand_chacha = "0.9"
approx = "0.5"
Expand Down
3 changes: 1 addition & 2 deletions astraweave-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[features]
default = []
tls = ["tokio-rustls", "rustls", "rustls-pemfile", "webpki-roots"]
tls = ["tokio-rustls", "rustls", "webpki-roots"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("dangerous-testing"))'] }
Expand All @@ -26,7 +26,6 @@ rand = { workspace = true }
# TLS support (optional) - using ring for Windows compatibility
tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["ring"] }
rustls = { version = "0.23", optional = true, default-features = false, features = ["ring", "std"] }
rustls-pemfile = { version = "2", optional = true }
webpki-roots = { version = "0.26", optional = true }

[dev-dependencies]
Expand Down
46 changes: 16 additions & 30 deletions astraweave-net/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
//! // Use connector with tokio-tungstenite's connect_async_tls_with_config
//! ```

use std::fs::File;
use std::io::BufReader;
use std::path::Path;
use std::sync::Arc;

use anyhow::{Context, Result};
use rustls_pemfile::{certs, private_key};
use tokio_rustls::rustls::pki_types::{CertificateDer, ServerName};
use tokio_rustls::rustls::pki_types::pem::PemObject;
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer, ServerName};
use tokio_rustls::rustls::{ClientConfig, RootCertStore, ServerConfig};
use tokio_rustls::{TlsAcceptor, TlsConnector};
use webpki_roots::TLS_SERVER_ROOTS;
Expand All @@ -54,17 +52,16 @@ impl TlsServerConfig {
/// # Returns
/// TLS configuration ready to create an acceptor
pub fn from_pem_files(cert_path: impl AsRef<Path>, key_path: impl AsRef<Path>) -> Result<Self> {
// Load certificate chain
let cert_file = File::open(cert_path.as_ref()).with_context(|| {
format!(
"Failed to open cert file: {}",
redact_path_for_error(cert_path.as_ref())
)
})?;
let mut cert_reader = BufReader::new(cert_file);
let cert_chain: Vec<CertificateDer<'static>> = certs(&mut cert_reader)
.collect::<Result<Vec<_>, _>>()
.context("Failed to parse certificate chain")?;
let cert_chain: Vec<CertificateDer<'static>> =
CertificateDer::pem_file_iter(cert_path.as_ref())
.with_context(|| {
format!(
"Failed to open cert file: {}",
redact_path_for_error(cert_path.as_ref())
)
})?
.collect::<Result<Vec<_>, _>>()
.context("Failed to parse certificate chain")?;

if cert_chain.is_empty() {
anyhow::bail!(
Expand All @@ -73,22 +70,12 @@ impl TlsServerConfig {
);
}

// Load private key
let key_file = File::open(key_path.as_ref()).with_context(|| {
let private_key = PrivateKeyDer::from_pem_file(key_path.as_ref()).with_context(|| {
format!(
"Failed to open key file: {}",
"Failed to parse private key in {}",
redact_path_for_error(key_path.as_ref())
)
})?;
let mut key_reader = BufReader::new(key_file);
let private_key = private_key(&mut key_reader)
.context("Failed to parse private key")?
.ok_or_else(|| {
anyhow::anyhow!(
"No private key found in {}",
redact_path_for_error(key_path.as_ref())
)
})?;

// Build config immediately since PrivateKeyDer doesn't implement Clone
let server_config = ServerConfig::builder()
Expand Down Expand Up @@ -130,16 +117,15 @@ impl TlsClientConfig {
/// # Arguments
/// * `ca_cert_path` - Path to PEM-encoded CA certificate file
pub fn with_custom_ca(ca_cert_path: impl AsRef<Path>) -> Result<TlsConnector> {
let ca_file = File::open(ca_cert_path.as_ref()).with_context(|| {
let ca_certs = CertificateDer::pem_file_iter(ca_cert_path.as_ref()).with_context(|| {
format!(
"Failed to open CA cert: {}",
redact_path_for_error(ca_cert_path.as_ref())
)
})?;
let mut ca_reader = BufReader::new(ca_file);

let mut root_store = RootCertStore::empty();
for cert in certs(&mut ca_reader) {
for cert in ca_certs {
let cert = cert.context("Failed to parse CA certificate")?;
root_store
.add(cert)
Expand Down
3 changes: 1 addition & 2 deletions astraweave-observability/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ dashmap = "6.1"
async-trait = "0.1"
prometheus = { version = "0.14", optional = true }
opentelemetry = { version = "0.31", optional = true }
opentelemetry-jaeger = { version = "0.22", optional = true }
histogram = "0.11"
hdrhistogram = "7.5"
rand = "0.9"

[features]
default = []
prometheus = ["dep:prometheus"]
opentelemetry = ["dep:opentelemetry", "dep:opentelemetry-jaeger"]
opentelemetry = ["dep:opentelemetry"]

[dev-dependencies]
tempfile.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion astraweave-optimization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uuid = { version = "1.0", features = ["v4"] }
chrono = { version = "0.4", features = ["serde"] }
dashmap = "6.0"
async-trait = "0.1"
lru = "0.12"
lru = "0.18"
tokio-util = "0.7"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion astraweave-steam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "steam_adversarial"
harness = false

[dependencies]
steamworks = "0.12"
steamworks = "0.13"
anyhow = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
Expand Down
12 changes: 6 additions & 6 deletions docs/architecture/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lifecycle_status: active
integration_status: example_only
summary: "FALSE-PRODUCTION-READY (R.0.B 2026-06-30): the prior active/wired front-matter was example-only reality — astraweave-net::GameServer/Msg/Snapshot has no non-example engine/tool caller (ex-only). Real multiplayer wire-up is DEFERRED to v1.1 (a conscious deferral, not a drop). net.md §1"
owns: [astraweave-net]
doc_version: "1.4"
doc_version: "1.5"
last_verified_commit: a2474c5b7
---

Expand All @@ -27,11 +27,11 @@ last_verified_commit: a2474c5b7
|---|---|
| **System name** | Net (snapshot-based game server) |
| **Primary crates** | `astraweave-net` (sole crate in this subsystem) |
| **Document version** | 1.4 |
| **Document version** | 1.5 |
| **Last verified against commit** | `a2474c5b7` |
| **Last verified date** | 2026-05-12 |
| **Status** | Active |
| **Revision history** | 1.4 (2026-10-15): `GameServer` accepts WebSocket connections with `engine_ws_config` (`max_message_size` and `max_frame_size` 1 MiB). `astraweave-ipc` uses the same 1 MiB cap on accept and connect. 1.3 (2026-10-15): Hello requires a real token outside debug/test, and input uses the server player id. 1.2 (2026-05-12): Deep investigation pass. **Major new finding**: the aspirational `docs/src/core-systems/networking.md` doc claims AstraWeave uses **QUIC (via Quinn)** for transport — but the actual implementation uses **WebSocket (tokio-tungstenite over TCP)**. This is an architectural-class mismatch beyond the type-name mismatches already documented; added to §6. Enriched §11 Q2, Q6, Q8, Q9 with concrete factual context (test counts, call-site counts, exact line refs). Q6 (replay log) factually closed at the code level: 2 push sites (`lib.rs:837, 868`), 0 remove sites anywhere — confirmed truly unbounded. Q9 (webpki-roots) clarified as **client-side-only** — `TLS_SERVER_ROOTS` is imported only at `tls.rs:33, 119`, both inside `TlsClientConfig::default_connector`. Q8 (Box<dyn Interest>) quantified — 2 allocation sites per broadcast per connection. Added note that `tls.rs` exports **5 public methods** (not the 2 the §1 summary highlights): `TlsServerConfig::{from_pem_files, acceptor}`, `TlsClientConfig::{default_connector, with_custom_ca, insecure_connector}`.<br><br>1.1 (2026-05-12): Verification pass. **Corrected §4 / Appendix B**: the prior `[INFERRED]` claim of "no aspirational doc tree" was wrong — `docs/src/core-systems/networking.md` exists and references 7+ nonexistent submodules (`replication`, `state`, `delta`, `serialization`, `prediction`, plus types `Server`/`ServerConfig`/`Client`/`ClientConfig`/`ClientEvent`). Same `28bc94f21` "Create comprehensive bespoke wiki" sweep that created the aspirational audio/input docs. Added new §6 row. Resolved §10 sanitizer `[INFERRED]` — `astraweave-net` is explicitly listed in the `P1_CRATES` array at `sanitizers.yml:205`. Corrected Appendix B creation date: first commit was 2025-09-04 (`ba52548b3`), not 2025-09-05. |
| **Revision history** | 1.5 (2026-10-15): The `tls` feature parses PEM with `rustls-pki-types`. `rustls-pemfile` is not a dependency.<br><br>1.4 (2026-10-15): `GameServer` accepts WebSocket connections with `engine_ws_config` (`max_message_size` and `max_frame_size` 1 MiB). `astraweave-ipc` uses the same 1 MiB cap on accept and connect. 1.3 (2026-10-15): Hello requires a real token outside debug/test, and input uses the server player id. 1.2 (2026-05-12): Deep investigation pass. **Major new finding**: the aspirational `docs/src/core-systems/networking.md` doc claims AstraWeave uses **QUIC (via Quinn)** for transport — but the actual implementation uses **WebSocket (tokio-tungstenite over TCP)**. This is an architectural-class mismatch beyond the type-name mismatches already documented; added to §6. Enriched §11 Q2, Q6, Q8, Q9 with concrete factual context (test counts, call-site counts, exact line refs). Q6 (replay log) factually closed at the code level: 2 push sites (`lib.rs:837, 868`), 0 remove sites anywhere — confirmed truly unbounded. Q9 (webpki-roots) clarified as **client-side-only** — `TLS_SERVER_ROOTS` is imported only at `tls.rs:33, 119`, both inside `TlsClientConfig::default_connector`. Q8 (Box<dyn Interest>) quantified — 2 allocation sites per broadcast per connection. Added note that `tls.rs` exports **5 public methods** (not the 2 the §1 summary highlights): `TlsServerConfig::{from_pem_files, acceptor}`, `TlsClientConfig::{default_connector, with_custom_ca, insecure_connector}`.<br><br>1.1 (2026-05-12): Verification pass. **Corrected §4 / Appendix B**: the prior `[INFERRED]` claim of "no aspirational doc tree" was wrong — `docs/src/core-systems/networking.md` exists and references 7+ nonexistent submodules (`replication`, `state`, `delta`, `serialization`, `prediction`, plus types `Server`/`ServerConfig`/`Client`/`ClientConfig`/`ClientEvent`). Same `28bc94f21` "Create comprehensive bespoke wiki" sweep that created the aspirational audio/input docs. Added new §6 row. Resolved §10 sanitizer `[INFERRED]` — `astraweave-net` is explicitly listed in the `P1_CRATES` array at `sanitizers.yml:205`. Corrected Appendix B creation date: first commit was 2025-09-04 (`ba52548b3`), not 2025-09-05. |
| **Owner notes** | Self-contained snapshot-server library. Three direct production consumers (`examples/coop_server`, `examples/coop_client`, `examples/net_headless_sim`). Optional `tls` feature for secure WebSocket. Dedicated `.github/workflows/net-tests.yml` workflow. Not an ECS-Plugin — `astraweave-net` predates and operates parallel to the ECS-Plugin networking in `astraweave-net-ecs`. |

---
Expand Down Expand Up @@ -159,7 +159,7 @@ Optional TLS path (feature = "tls")
│ astraweave-net/src/tls.rs
▼
[TlsServerConfig::from_pem_files(cert.pem, key.pem)] (tls.rs:56-)
│ → Reads cert chain + private key with rustls_pemfile
│ → Reads cert chain + private key with rustls-pki-types (`CertificateDer::pem_file_iter`, `PrivateKeyDer::from_pem_file`)
│ → Builds rustls::ServerConfig with ring crypto backend
│ → Wraps in TlsAcceptor via .acceptor()
│
Expand Down Expand Up @@ -470,7 +470,7 @@ The runtime selects via the `InterestPolicy` enum (lib.rs:212-226): `Radius | Fo
| 13 | `replay_from` does NOT bail on per-event validation failures | Yes (intentional contract) | `lib.rs:928`: `let _ = validate_and_execute(...)`. |
| 14 | `ServerWelcome` is sent immediately after WebSocket upgrade, before any other server message | Yes | `lib.rs:601-604` — synchronous send before the writer-task spawn at `lib.rs:612`. |
| 15 | `GameServer::tick` uses `AtomicU64::fetch_add(1, Ordering::Relaxed)` | Yes | `lib.rs:559`. The relaxed ordering is sufficient because all reads happen on the same task that incremented. |
| 16 | TLS feature is opt-in (default features = `[]`) | Yes (compile-time) | `Cargo.toml:8`: `default = []`; `tls = ["tokio-rustls", "rustls", "rustls-pemfile", "webpki-roots"]` at line 9. |
| 16 | TLS feature is opt-in (default features = `[]`) | Yes (compile-time) | `Cargo.toml:8`: `default = []`; `tls = ["tokio-rustls", "rustls", "webpki-roots"]` at line 9. |

---

Expand Down Expand Up @@ -567,7 +567,7 @@ The runtime selects via the `InterestPolicy` enum (lib.rs:212-226): `Radius | Fo

**Verification process:**
- `rg 'pub fn|pub struct|pub enum|pub trait' astraweave-net/src/` should match §3 vocabulary surface.
- `cargo tree -p astraweave-net --depth 1` should list `anyhow`, `thiserror`, `serde`, `serde_json`, `tokio`, `futures-util`, `tungstenite`, `tokio-tungstenite`, `astraweave-core`, `rand`. Adding `tls` feature adds `tokio-rustls`, `rustls`, `rustls-pemfile`, `webpki-roots`.
- `cargo tree -p astraweave-net --depth 1` should list `anyhow`, `thiserror`, `serde`, `serde_json`, `tokio`, `futures-util`, `tungstenite`, `tokio-tungstenite`, `astraweave-core`, `rand`. Adding `tls` feature adds `tokio-rustls`, `rustls`, `webpki-roots`.
- `rg 'use astraweave_net' --type rust -g '!*test*' -g '!benches/*'` should find the three example consumers in §4. New consumers must be added there.
- `grep -c '#\[test\]\|#\[tokio::test\]\|proptest!' astraweave-net/src/*.rs astraweave-net/tests/*.rs astraweave-net/tests/integration/*.rs` should total ≥ 377 (the test-count invariant should grow, never shrink).
- Stamp the new commit hash and date in the metadata table after verification.
Expand Down
Loading