Skip to content

Commit bb9690a

Browse files
Platformechobt
authored andcommitted
feat: agent ZIP upload frontend with env vars + SUDO_PASSWORD auth
- GET / serves HTML upload form (password-protected via SUDO_PASSWORD env) - POST /upload-agent accepts multipart: ZIP archive + env vars (KEY=VALUE) - GET /agent-code returns stored ZIP (password in X-Password header) - ZIP validated, env vars parsed and stored in-memory - Constant-time password comparison for security
1 parent 492d068 commit bb9690a

File tree

6 files changed

+351
-37
lines changed

6 files changed

+351
-37
lines changed

src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub struct Config {
3131
pub consensus_threshold: f64,
3232
pub consensus_ttl_secs: u64,
3333
pub max_pending_consensus: usize,
34+
pub sudo_password: Option<String>,
3435
}
3536

3637
impl Config {
@@ -71,6 +72,9 @@ impl Config {
7172
"MAX_PENDING_CONSENSUS",
7273
DEFAULT_MAX_PENDING_CONSENSUS,
7374
),
75+
sudo_password: std::env::var("SUDO_PASSWORD")
76+
.ok()
77+
.filter(|s| !s.is_empty()),
7478
})
7579
}
7680

src/executor.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,11 @@ async fn run_task_pipeline(
365365
.await?;
366366

367367
// Capture git diff after agent runs (the patch the agent produced)
368-
let agent_patch = match run_cmd(
369-
&["git", "diff"],
370-
&repo_dir,
371-
Duration::from_secs(30),
372-
None,
373-
)
374-
.await
375-
{
376-
Ok((stdout, _, _)) => stdout,
377-
Err(_) => String::new(),
378-
};
368+
let agent_patch =
369+
match run_cmd(&["git", "diff"], &repo_dir, Duration::from_secs(30), None).await {
370+
Ok((stdout, _, _)) => stdout,
371+
Err(_) => String::new(),
372+
};
379373
debug!("[{}] Agent patch: {} bytes", task.id, agent_patch.len());
380374

381375
// Store agent output and patch for later retrieval

0 commit comments

Comments
 (0)