[PR #1370] [MERGED] Fix hostable remote runtime security gates #5043

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1370
Author: @cha1latte
Created: 5/26/2026
Status: ✅ Merged
Merged: 5/26/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/refactor-issue-1345-hostable-security


📝 Commits (2)

  • 9dde656 Fix hostable remote runtime security gates
  • 8e94cf9 Address remote runtime security review

📊 Changes

4 files changed (+816 additions, -8 deletions)

View changed files

📝 README.md (+6 -0)
📝 docs/developer/run-build.html (+10 -0)
📝 src-tauri/src/http_server.rs (+799 -8)
📝 src/shared/api/remote-runtime.ts (+1 -0)

📄 Description

Linked issue

Closes #1345

Why this change

  • The refactor hostable Rust runtime exposed remote API routes with permissive CORS and without the legacy server-side remote access gates. That left remote access dependent on client behavior instead of server enforcement.

What changed

  • Added hostable runtime security middleware for CORS allowlisted origins, Basic Auth, IP allowlist checks, CSRF/origin checks, and security headers.
  • Updated the remote runtime client to send X-Marinara-CSRF: 1 on remote API calls.
  • Documented the remote runtime access-control expectations in README and developer docs.
  • Added focused Rust coverage for allowed and denied remote-access rows, including should-not-match negative controls.

Refactor impact

Primary owner:

Remote runtime / Rust hostable server

Impact areas reviewed:

  • Shared API wrapper or remote runtime routing
  • Tauri/Rust HTTP runtime, security, and remote access docs

Boundary notes:

  • This PR only gates the hostable Rust HTTP runtime. It does not add TLS termination, serve the React UI from marinara-server, or add new admin-only API routes.

Pressure points touched:

  • src-tauri/src/http_server.rs
  • src/shared/api/remote-runtime.ts
  • Remote runtime docs

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex ran node scratch/issue-1345-hostable-security-repro.mjs --expect-fixed.
  • Codex ran cargo test --manifest-path src-tauri/Cargo.toml hostable_security --lib.
  • Codex ran pnpm check.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json.
  • Manually verify a configured desktop client can still use a remote runtime with the intended CORS_ORIGINS / CSRF_TRUSTED_ORIGINS settings for the target deployment.

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, backend remote runtime security change.

Summary by CodeRabbit

  • New Features

    • Remote runtime now enforces stricter access control by default, with support for IP allowlisting, optional Basic Authentication, and CSRF protection.
  • Documentation

    • Updated security configuration guidance for remote runtime setup, including environment variable options for authentication and access control.

Review Change Stack


🔄 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/1370 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/26/2026 **Status:** ✅ Merged **Merged:** 5/26/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-1345-hostable-security` --- ### 📝 Commits (2) - [`9dde656`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9dde6569e27f291bb9a4b9a44a3d4e69de1b6977) Fix hostable remote runtime security gates - [`8e94cf9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e94cf92e2d9937528d68b39771f0d7791b8855c) Address remote runtime security review ### 📊 Changes **4 files changed** (+816 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+6 -0) 📝 `docs/developer/run-build.html` (+10 -0) 📝 `src-tauri/src/http_server.rs` (+799 -8) 📝 `src/shared/api/remote-runtime.ts` (+1 -0) </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 #1345 ## Why this change - The refactor hostable Rust runtime exposed remote API routes with permissive CORS and without the legacy server-side remote access gates. That left remote access dependent on client behavior instead of server enforcement. ## What changed - Added hostable runtime security middleware for CORS allowlisted origins, Basic Auth, IP allowlist checks, CSRF/origin checks, and security headers. - Updated the remote runtime client to send `X-Marinara-CSRF: 1` on remote API calls. - Documented the remote runtime access-control expectations in README and developer docs. - Added focused Rust coverage for allowed and denied remote-access rows, including should-not-match negative controls. ## Refactor impact Primary owner: Remote runtime / Rust hostable server Impact areas reviewed: - Shared API wrapper or remote runtime routing - Tauri/Rust HTTP runtime, security, and remote access docs Boundary notes: - This PR only gates the hostable Rust HTTP runtime. It does not add TLS termination, serve the React UI from `marinara-server`, or add new admin-only API routes. Pressure points touched: - `src-tauri/src/http_server.rs` - `src/shared/api/remote-runtime.ts` - Remote runtime docs ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex ran `node scratch/issue-1345-hostable-security-repro.mjs --expect-fixed`. - Codex ran `cargo test --manifest-path src-tauri/Cargo.toml hostable_security --lib`. - Codex ran `pnpm check`. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`. - Manually verify a configured desktop client can still use a remote runtime with the intended `CORS_ORIGINS` / `CSRF_TRUSTED_ORIGINS` settings for the target deployment. ## 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, backend remote runtime security change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Remote runtime now enforces stricter access control by default, with support for IP allowlisting, optional Basic Authentication, and CSRF protection. * **Documentation** * Updated security configuration guidance for remote runtime setup, including environment variable options for authentication and access control. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1370?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:43 +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#5043
No description provided.