[PR #2086] [MERGED] Fix loopback admin secret hardening #5426

Closed
opened 2026-10-22 04:16:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2086
Author: @cha1latte
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2065-loopback-admin-secret


📝 Commits (1)

  • 7d55f31 Fix loopback admin secret hardening

📊 Changes

1 file changed (+52 additions, -4 deletions)

View changed files

📝 src-tauri/src/http_server.rs (+52 -4)

📄 Description

Linked issue

Closes #2065

Why this change

  • Refactor remote runtime dropped the legacy MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK hardening knob, so loopback privileged commands bypassed Admin Access even when operators configured ADMIN_SECRET and explicitly wanted loopback calls to require it.

What changed

  • Split privileged-command detection from the loopback exemption in require_admin_access_for_command.
  • Preserve the default legacy loopback bypass unless MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK is truthy.
  • Added a regression test covering hardened loopback rejection/acceptance, explicit false bypass, and unprivileged loopback behavior.

Refactor impact

Primary owner:

  • Rust remote runtime / Admin Access gate.

Impact areas reviewed:

  • Privileged remote command Admin Access.
  • Loopback versus non-loopback request handling.
  • Neighboring hostable security tests for basic auth, IP allowlist, origin, CSRF, and security headers.

Boundary notes:

  • Fix stays in src-tauri/src/http_server.rs; no React, engine, shared API, storage data format, schema, dependency, prompt, or release metadata changes.
  • Remote runtime remains the enforcing owner; no UI-only guard was added.

Pressure points touched:

  • src-tauri/src/http_server.rs privileged command gate and its Rust unit tests.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Codex reproduced the bug before the production fix with cargo test --manifest-path src-tauri\Cargo.toml hostable_security_can_require_admin_access_for_loopback_privileged_commands; the test failed because loopback backup_list returned success with MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK=true.
  • Codex verified the fix after rebasing onto current upstream/refactor:
    • cargo test --manifest-path src-tauri\Cargo.toml hostable_security passed, 12 tests.
    • cargo test --manifest-path src-tauri\Cargo.toml remote_admin_clear_all passed, 3 tests.
    • pnpm check passed.
    • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.
  • No human-only verification blocker is known; this is a non-UI Rust security gate covered by command tests.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix for a legacy remote-runtime security env knob; no new in-app discoverable feature.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • N/A: non-UI Rust Admin Access gate. Command proof is listed under validation.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2086 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2065-loopback-admin-secret` --- ### 📝 Commits (1) - [`7d55f31`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7d55f31802f600e18ec698d64a2a0f0f2d06ea1d) Fix loopback admin secret hardening ### 📊 Changes **1 file changed** (+52 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/http_server.rs` (+52 -4) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #2065 ## Why this change - Refactor remote runtime dropped the legacy `MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK` hardening knob, so loopback privileged commands bypassed Admin Access even when operators configured `ADMIN_SECRET` and explicitly wanted loopback calls to require it. ## What changed - Split privileged-command detection from the loopback exemption in `require_admin_access_for_command`. - Preserve the default legacy loopback bypass unless `MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK` is truthy. - Added a regression test covering hardened loopback rejection/acceptance, explicit false bypass, and unprivileged loopback behavior. ## Refactor impact Primary owner: - Rust remote runtime / Admin Access gate. Impact areas reviewed: - Privileged remote command Admin Access. - Loopback versus non-loopback request handling. - Neighboring hostable security tests for basic auth, IP allowlist, origin, CSRF, and security headers. Boundary notes: - Fix stays in `src-tauri/src/http_server.rs`; no React, engine, shared API, storage data format, schema, dependency, prompt, or release metadata changes. - Remote runtime remains the enforcing owner; no UI-only guard was added. Pressure points touched: - `src-tauri/src/http_server.rs` privileged command gate and its Rust unit tests. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - Codex reproduced the bug before the production fix with `cargo test --manifest-path src-tauri\Cargo.toml hostable_security_can_require_admin_access_for_loopback_privileged_commands`; the test failed because loopback `backup_list` returned success with `MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK=true`. - Codex verified the fix after rebasing onto current `upstream/refactor`: - `cargo test --manifest-path src-tauri\Cargo.toml hostable_security` passed, 12 tests. - `cargo test --manifest-path src-tauri\Cargo.toml remote_admin_clear_all` passed, 3 tests. - `pnpm check` passed. - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. - No human-only verification blocker is known; this is a non-UI Rust security gate covered by command tests. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix for a legacy remote-runtime security env knob; no new in-app discoverable feature. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - N/A: non-UI Rust Admin Access gate. Command proof is listed under validation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:13 +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#5426
No description provided.