Repository navigation
feat(reborn): delegate serve to WebUI ingress - #3828
serrrfirat wants to merge 0 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ironclaw_reborn_host crate to manage the host-side ingress lifecycle for the standalone Reborn binary, including listener binding and graceful shutdown. The ironclaw-reborn serve command has been updated to delegate to this new crate and now requires environment variables for authentication. Feedback identifies a security vulnerability where authentication tokens are compared using non-constant-time operations, which could lead to timing attacks. Additionally, the reviewer noted an issue in the error handling logic where a failure during runtime shutdown could potentially swallow a primary server error.
| if token == self.token { | ||
| Some(self.user_id.clone()) | ||
| } else { | ||
| None | ||
| } |
There was a problem hiding this comment.
Authentication tokens should be compared using constant-time operations to prevent timing attacks. Using a simple string comparison (==) allows an attacker to potentially guess the token byte-by-byte by measuring response time differences. Use the subtle crate's ConstantTimeEq for a secure comparison.
| anyhow = "1" | ||
| async-trait = "0.1" | ||
| axum = "0.8" | ||
| ironclaw_host_api = { path = "../ironclaw_host_api", version = "0.1.0" } | ||
| ironclaw_reborn_composition = { path = "../ironclaw_reborn_composition", version = "0.1.0", features = ["webui-v2-beta"] } | ||
| tokio = { version = "1", features = ["net", "signal"] } | ||
| tracing = "0.1" |
| let result = | ||
| serve_runtime_webui(&runtime, listen_addr, auth_token, tenant_id, auth_user_id).await; | ||
| let shutdown = runtime.shutdown().await; | ||
|
|
||
| result?; | ||
| shutdown.context("failed to shut down Reborn runtime after WebUI service exits")?; | ||
| Ok(()) |
There was a problem hiding this comment.
If both the WebUI service (serve_runtime_webui) and the runtime shutdown fail, the shutdown error will overwrite the primary server error. Per the general rules, the primary error should be returned to the caller, while the secondary failure (shutdown) should be logged as a warning.
References
- When a primary operation fails and a subsequent cleanup or secondary operation also fails, log the secondary failure as a warning and ensure the original primary error is returned to the caller to prevent it from being swallowed.
5b8745a to
0462b3a
Compare
0462b3a to
3c81d71
Compare
Summary
ironclaw_reborn_webui_ingresscrate for Reborn WebUI listener lifecycleironclaw-reborn serveto validate auth env, build runtime input, and delegate to WebUI ingressTests
cargo fmt --checkcargo test -p ironclaw_reborn_webui_ingresscargo test -p ironclaw_reborn_clicargo test -p ironclaw_reborn_composition --features webui-v2-betacargo test -p ironclaw_webui_v2 --features webui-v2-betacargo test -p ironclaw_architecturecargo clippy -p ironclaw_reborn_webui_ingress --all-targets -- -D warningscargo clippy -p ironclaw_reborn_cli --all-targets -- -D warningsStacked on #3815.