[GH-ISSUE #722] [Issue]: Prompt preset changes silently fail when the current origin is not trusted by CSRF protection #343

Closed
opened 2026-10-20 17:27:50 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @cha1latte on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/722

Summary

On a self-hosted Marinara install, changing a chat's prompt preset appears to work in the UI, but the selection does not persist. In the reported case, the chat stayed promptPresetId: null even after selecting Marinara's Universal Preset.

This affects setups that need multiple access origins, such as public IP, Tailscale, Docker, and localhost access.

Expected behavior

Selecting a prompt preset should save the chat's promptPresetId.

If the current origin is not trusted, the UI should show a visible save error instead of silently leaving the chat unchanged.

Common self-hosted origins such as Tailscale, Docker/localhost, and public IP access should be automatically whitelisted for CSRF where appropriate, or clearly surfaced to the user when manual configuration is required.

Actual behavior

The preset selector looks clickable, but the change does not persist.

A direct save attempt returns:

{
  "error": "Origin 'http://71.175.221.189:7831' is not in the trusted list (CSRF_TRUSTED_ORIGINS).",
  "origin": "http://71.175.221.189:7831",
  "hint": "Add 'http://71.175.221.189:7831' to CSRF_TRUSTED_ORIGINS in your .env — comma-separated if you already have entries, e.g. CSRF_TRUSTED_ORIGINS=http://existing.example,http://71.175.221.189:7831. No restart needed (takes effect within ~2s)."
}

The chat remains preset-less, which can lead to very different roleplay output from the same preset in other apps.

Steps to reproduce

  1. Run Marinara 1.5.9 on Windows 11 in a self-hosted setup reachable through a non-localhost origin.
  2. Open a roleplay chat in Brave Browser.
  3. Open Chat Settings.
  4. Select Marinara's Universal Preset.
  5. Observe that the selector changes visually, but the value does not persist.
  6. Reload the chat or inspect the API.
  7. The chat still has promptPresetId: null.

Marinara Engine version

1.5.9

Install type

Other

Self-hosted / public-origin deployment.

OS + version

Windows 11

Browser or app shell

Brave Browser

Screenshots or video

Not a visual/UI issue.

Logs

Direct save attempt response:

{
  "error": "Origin 'http://71.175.221.189:7831' is not in the trusted list (CSRF_TRUSTED_ORIGINS).",
  "origin": "http://71.175.221.189:7831"
}

Observed chat state:

{
  "promptPresetId": null,
  "connectionId": null
}

Observed default preset:

{
  "name": "Marinara's Universal Preset",
  "isDefault": "true"

Additional context

Self-hosted setups may need more than one trusted origin at once, for example a public IP, a Tailscale hostname/IP, Docker/localhost, and LAN access.

The app should either automatically whitelist safe/common self-hosted origins where appropriate, or provide clear setup guidance for adding them to CSRF_TRUSTED_ORIGINS.

Most importantly, if any request fails CSRF, the UI should surface a clear error/toast instead of silently doing nothing. In this case, the failed save made the issue look like a prompt/model quality regression because the roleplay chat was not actually using the selected preset.

Template check

  • I provided the required summary, behavior, reproduction, and environment details.
  • If this is a visual/UI bug, blank screen, layout issue, mobile/responsive issue, incorrect image or sprite, broken animation, or unexpected error state, I attached screenshots or video.
Originally created by @cha1latte on GitHub (May 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/722 ## Summary On a self-hosted Marinara install, changing a chat's prompt preset appears to work in the UI, but the selection does not persist. In the reported case, the chat stayed `promptPresetId: null` even after selecting Marinara's Universal Preset. This affects setups that need multiple access origins, such as public IP, Tailscale, Docker, and localhost access. ## Expected behavior Selecting a prompt preset should save the chat's `promptPresetId`. If the current origin is not trusted, the UI should show a visible save error instead of silently leaving the chat unchanged. Common self-hosted origins such as Tailscale, Docker/localhost, and public IP access should be automatically whitelisted for CSRF where appropriate, or clearly surfaced to the user when manual configuration is required. ## Actual behavior The preset selector looks clickable, but the change does not persist. A direct save attempt returns: ```json { "error": "Origin 'http://71.175.221.189:7831' is not in the trusted list (CSRF_TRUSTED_ORIGINS).", "origin": "http://71.175.221.189:7831", "hint": "Add 'http://71.175.221.189:7831' to CSRF_TRUSTED_ORIGINS in your .env — comma-separated if you already have entries, e.g. CSRF_TRUSTED_ORIGINS=http://existing.example,http://71.175.221.189:7831. No restart needed (takes effect within ~2s)." } ``` The chat remains preset-less, which can lead to very different roleplay output from the same preset in other apps. ## Steps to reproduce 1. Run Marinara 1.5.9 on Windows 11 in a self-hosted setup reachable through a non-localhost origin. 2. Open a roleplay chat in Brave Browser. 3. Open Chat Settings. 4. Select `Marinara's Universal Preset`. 5. Observe that the selector changes visually, but the value does not persist. 6. Reload the chat or inspect the API. 7. The chat still has `promptPresetId: null`. ## Marinara Engine version 1.5.9 ## Install type Other Self-hosted / public-origin deployment. ## OS + version Windows 11 ## Browser or app shell Brave Browser ## Screenshots or video Not a visual/UI issue. ## Logs Direct save attempt response: ```json { "error": "Origin 'http://71.175.221.189:7831' is not in the trusted list (CSRF_TRUSTED_ORIGINS).", "origin": "http://71.175.221.189:7831" } ``` Observed chat state: ```json { "promptPresetId": null, "connectionId": null } ``` Observed default preset: ```json { "name": "Marinara's Universal Preset", "isDefault": "true" ``` ## Additional context Self-hosted setups may need more than one trusted origin at once, for example a public IP, a Tailscale hostname/IP, Docker/localhost, and LAN access. The app should either automatically whitelist safe/common self-hosted origins where appropriate, or provide clear setup guidance for adding them to `CSRF_TRUSTED_ORIGINS`. Most importantly, if any request fails CSRF, the UI should surface a clear error/toast instead of silently doing nothing. In this case, the failed save made the issue look like a prompt/model quality regression because the roleplay chat was not actually using the selected preset. ## Template check - [ ] I provided the required summary, behavior, reproduction, and environment details. - [ ] If this is a visual/UI bug, blank screen, layout issue, mobile/responsive issue, incorrect image or sprite, broken animation, or unexpected error state, I attached screenshots or video. ```
bsakaguchi 2026-10-20 17:27:50 +07:00
  • closed this issue
  • added the
    bug
    label
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#343
No description provided.