[GH-ISSUE #2333] [Issue]: /health is unauthenticated, un-rate-limited, and does a disk write+delete on every request (server runtime) #1160

Closed
opened 2026-10-21 05:28:07 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2333

Originally assigned to: @Xelvanis on GitHub.

Summary

Severity: Low — Performance / DoS-hardening (server runtime). On the Axum server runtime, /health bypasses both auth and rate limiting, and performs a real disk write + delete on every request. An unauthenticated remote client can flood /health to drive sustained disk write/unlink churn and inode/dentry pressure on the data volume with zero throttling.

Expected behavior

/health should return a cheap liveness response without touching disk on every request. The writable probe should be gated (e.g. behind a ?probe=1 flag) and/or its result cached for a few seconds.

Actual behavior

src-tauri/src/http_server.rs:174-198:

async fn health(State(state): State<HttpState>) -> Json<Value> {
    let writable = probe_data_dir_writable(&state.app.data_dir.join("data")).await;
    Json(json!({ "ok": true, "runtime": "marinara-server", "writable": writable }))
}

probe_data_dir_writable (187-198) does create_dir_all + write(path, b"ok") + remove_file(path) on every hit, with a uniquely-named temp file (no caching). Auth is bypassed: evaluate_request (1660-1665) returns Ok(()) early for path == "/health". Rate-limit is bypassed: ApiRateLimiter::check (1398-1405) returns None for non-/api/ paths (a test at 2454 asserts the exemption). So an unauthenticated, un-throttled GET flood drives 2 filesystem mutations per request on the data volume.

Steps to reproduce

  1. Server-mode deployment.
  2. Unauthenticated remote client repeatedly GET /health.
  3. Each request performs a disk write + delete in the data dir, with no throttling.

Impact area

  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime

Environment

  • Branch or commit: refactor @ b0e5561d
  • Run mode: remote/Docker runtime (Axum server) — not the primary Tauri desktop path
  • OS + version: not relevant (static source audit)
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? yes (server-only)
  • Provider, model, or integration, if relevant: n/a

Logs, screenshots, or video

Static source audit; cited to file:line above.

Regression notes

Found via static audit of the refactor branch; not verified against main. The write is 2 bytes + immediate unlink (modest amplification), and unauthenticated/rate-exempt /health is a legitimate liveness-probe design; the fixable part is doing real disk I/O per probe, hence low.

Additional context

Suggested fix: default /health returns a cheap liveness response without touching disk; gate the writable probe behind an explicit flag (e.g. ?probe=1) and/or cache the writable result for a few seconds so repeated hits don't re-probe per request.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2333 Originally assigned to: @Xelvanis on GitHub. ## Summary **Severity: Low — Performance / DoS-hardening (server runtime).** On the Axum server runtime, `/health` bypasses both auth and rate limiting, and performs a real disk write + delete on every request. An unauthenticated remote client can flood `/health` to drive sustained disk write/unlink churn and inode/dentry pressure on the data volume with zero throttling. ## Expected behavior `/health` should return a cheap liveness response without touching disk on every request. The writable probe should be gated (e.g. behind a `?probe=1` flag) and/or its result cached for a few seconds. ## Actual behavior `src-tauri/src/http_server.rs:174-198`: ```rust async fn health(State(state): State<HttpState>) -> Json<Value> { let writable = probe_data_dir_writable(&state.app.data_dir.join("data")).await; Json(json!({ "ok": true, "runtime": "marinara-server", "writable": writable })) } ``` `probe_data_dir_writable` (187-198) does `create_dir_all` + `write(path, b"ok")` + `remove_file(path)` on every hit, with a uniquely-named temp file (no caching). Auth is bypassed: `evaluate_request` (1660-1665) returns `Ok(())` early for `path == "/health"`. Rate-limit is bypassed: `ApiRateLimiter::check` (1398-1405) returns `None` for non-`/api/` paths (a test at 2454 asserts the exemption). So an unauthenticated, un-throttled GET flood drives 2 filesystem mutations per request on the data volume. ## Steps to reproduce 1. Server-mode deployment. 2. Unauthenticated remote client repeatedly `GET /health`. 3. Each request performs a disk write + delete in the data dir, with no throttling. ## Impact area - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime ## Environment - Branch or commit: refactor @ b0e5561d - Run mode: remote/Docker runtime (Axum server) — not the primary Tauri desktop path - OS + version: not relevant (static source audit) - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? yes (server-only) - Provider, model, or integration, if relevant: n/a ## Logs, screenshots, or video Static source audit; cited to file:line above. ## Regression notes Found via static audit of the refactor branch; not verified against main. The write is 2 bytes + immediate unlink (modest amplification), and unauthenticated/rate-exempt `/health` is a legitimate liveness-probe design; the fixable part is doing real disk I/O per probe, hence low. ## Additional context Suggested fix: default `/health` returns a cheap liveness response without touching disk; gate the writable probe behind an explicit flag (e.g. `?probe=1`) and/or cache the writable result for a few seconds so repeated hits don't re-probe per request. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:28:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1160
No description provided.