[GH-ISSUE #2029] Admin clear-all should require backend confirmation #992

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

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

Originally assigned to: @cha1latte on GitHub.

Problem

Target 2 parityscan batch 2 found an admin destructive guard gap.

Legacy /admin/clear-all rejects requests unless the body includes { confirm: true } (origin/main:packages/server/src/routes/admin.routes.ts).

Refactor admin_clear_all_command calls admin::admin_clear_all(&state) directly, and admin_clear_all accepts only &AppState. That means the backend has no confirmation argument to validate once the command is invoked. UI confirmation helps, but the destructive storage guard should also live in the command/backend path.

Remote non-loopback privileged commands are admin-secret gated in src-tauri/src/http_server.rs, but focused tests currently do not cover admin_clear_all confirmation rejection or remote admin access rejection.

Expected

  • admin_clear_all_command and remote dispatch require explicit confirmation before destructive deletion.
  • Missing or false confirmation returns invalid_input and leaves storage/files intact.
  • Remote non-loopback admin commands have negative tests for missing/invalid admin secret.
  • Positive clear-all/expunge controls still prove scoped data is cleared when confirmed and authorized.

Evidence

  • src-tauri/src/commands/storage/admin.rs: admin_expunge validates confirm; admin_clear_all does not accept a confirm arg.
  • src-tauri/src/commands/storage/commands/agents.rs: admin_clear_all_command has no confirm parameter.
  • src-tauri/src/http_dispatch.rs: remote admin_clear_all_command dispatches directly to admin::admin_clear_all.
  • cargo test --manifest-path src-tauri/Cargo.toml admin_expunge -> 1 passed.
  • cargo test --manifest-path src-tauri/Cargo.toml admin_clear_all -> 0 matched.
  • cargo test --manifest-path src-tauri/Cargo.toml admin_access -> 0 matched.

Source

Target 2 parityscan batch 2: #2028

Originally created by @Xelvanis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2029 Originally assigned to: @cha1latte on GitHub. ## Problem Target 2 parityscan batch 2 found an admin destructive guard gap. Legacy `/admin/clear-all` rejects requests unless the body includes `{ confirm: true }` (`origin/main:packages/server/src/routes/admin.routes.ts`). Refactor `admin_clear_all_command` calls `admin::admin_clear_all(&state)` directly, and `admin_clear_all` accepts only `&AppState`. That means the backend has no confirmation argument to validate once the command is invoked. UI confirmation helps, but the destructive storage guard should also live in the command/backend path. Remote non-loopback privileged commands are admin-secret gated in `src-tauri/src/http_server.rs`, but focused tests currently do not cover `admin_clear_all` confirmation rejection or remote admin access rejection. ## Expected - `admin_clear_all_command` and remote dispatch require explicit confirmation before destructive deletion. - Missing or false confirmation returns `invalid_input` and leaves storage/files intact. - Remote non-loopback admin commands have negative tests for missing/invalid admin secret. - Positive clear-all/expunge controls still prove scoped data is cleared when confirmed and authorized. ## Evidence - `src-tauri/src/commands/storage/admin.rs`: `admin_expunge` validates `confirm`; `admin_clear_all` does not accept a confirm arg. - `src-tauri/src/commands/storage/commands/agents.rs`: `admin_clear_all_command` has no confirm parameter. - `src-tauri/src/http_dispatch.rs`: remote `admin_clear_all_command` dispatches directly to `admin::admin_clear_all`. - `cargo test --manifest-path src-tauri/Cargo.toml admin_expunge` -> 1 passed. - `cargo test --manifest-path src-tauri/Cargo.toml admin_clear_all` -> 0 matched. - `cargo test --manifest-path src-tauri/Cargo.toml admin_access` -> 0 matched. ## Source Target 2 parityscan batch 2: #2028
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#992
No description provided.