[GH-ISSUE #7221] [Issue]: Add user-triggered local image baking for greetings #4032

Closed
opened 2026-10-21 06:09:43 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7221

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Add an explicit option to download remote images used in character greetings and store them as Marinara Engine-managed local assets. Optionally support the same workflow for lorebooks.

Expected behavior

Users should be able to manually bake a remote greeting image into local storage, associate or replace its URL with an app-controlled asset reference, and continue viewing it if the remote file changes, is deleted, or the user is offline.

Actual behavior

Greeting images remain dependent on external URLs and can become unavailable when the remote content changes, is deleted, or cannot be reached.

Steps to reproduce

  1. Use a character greeting containing an image hosted at a remote URL.
  2. Load the greeting and confirm that the image is fetched from the remote host.
  3. Remove access to the remote image or go offline.
  4. Observe that the greeting image is no longer available and there is no described option to preserve it locally.

Environment

  • Marinara Engine version: Not provided
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

No logs, screenshots, or video were provided.

Additional context

Requested benefits include archival and preservation, offline access, reduced network traffic, protection against changed remote content, and potentially faster loading. The download should be explicitly user-triggered rather than automatic. Security considerations include SSRF protection, redirect and DNS validation, blocking private/link-local addresses and unsafe URL schemes, app-generated asset paths, file type and magic-byte validation, rejecting or sanitizing SVG/HTML, size and pixel limits, timeouts, rate limits, and avoiding forwarding cookies or authorization headers. Preserve the source URL and allow users to replace or delete the local copy. Lorebook image baking was suggested as an optional extension, without automatic fetching during trigger scanning.

Discord thread: Feature Request - "Bake" the messages / Saving messages in greetings.
Discord thread link: https://discord.com/channels/1417099416812392641/1557271453261504512
Requested by: gunterlie (gunterlie, Discord ID 282074442962829312)

Discord thread transcript (11 messages)
[2026-10-07T06:00:47.162Z] Kakekay: Not sure what other term to use so I am just yanking a term from gamedev/modelling/whatever.
Many bots use images in their greetings, however links do not last forever. They may be deleted intentionally, deleted due to inactivity or just bad luck— Which sucks since some bots are amazing and rely on the images produced! 
So how about a feature that lets ME download the image and save it locally, replacing the link with the path to the (now saved) image?
(Bonus points if this is also added to lorebooks)
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271453261504512]

[2026-10-07T06:00:47.748Z] Professor Mari [bot]: Howdy!

Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.**

**Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab:

`Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.`

If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here:

`Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version`

Thank you, this will help tremendously.

This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case.

Cheers!
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271455719493645]

[2026-10-07T06:01:12.057Z] Kakekay: Feature Request - "Bake" the messages / Saving messages in greetings.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271557678563390]

[2026-10-07T06:07:41.474Z] gunterlie: @Professor Mari Before I think harder about this, any surface Security Issues with this?

Obvs gonna take a deeper look later.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273191012110367]

[2026-10-07T06:09:47.963Z] Professor Mari [bot]: Yes—the biggest security surface is **fetching arbitrary image URLs**, not saving the resulting file.

Main things I’d flag:

- **SSRF:** A backend fetcher could be pointed at `localhost`, LAN devices, `127.0.0.1`, cloud metadata endpoints, or internal admin panels. Re-check redirects and DNS resolution; allow only `http`/`https`, block private/link-local ranges, and never accept `file:`, `data:`, or `javascript:` URLs.
- **Path traversal/overwrite:** Don’t let the URL or character name choose the filesystem path. Generate an ID, use an ME-managed media directory, and prevent writes outside it.
- **Malicious image formats:** SVG can contain scripts or external references. Consider rejecting SVG/HTML entirely or sanitizing/rasterizing it. Validate magic bytes, MIME type, file size, and pixel dimensions.
- **DoS:** Enforce connection timeouts, response-size limits, decompression/pixel limits, and perhaps a per-bake rate limit. “Image” URLs can return multi-gigabyte files or image bombs.
- **Privacy:** Make the download explicitly user-triggered and avoid forwarding cookies, authorization headers, or other app secrets to third-party hosts.
- **Stale/malicious content:** Show the source URL and let users replace/delete the local copy. Don’t silently download merely because a lorebook entry or greeting was displayed.

For lorebooks, I’d apply the same rules and avoid auto-fetching URLs during trigger scanning. The current snippets prove ME already has an “import/bake embedded lorebook into an editable linked lorebook” flow, with changes syncing back to the card (`packages/client/src/components/characters/CharacterEditor.tsx:5477-5479`, `packages/client/src/localization/locales/en.json:2215-2219`), but they do **not** establish how remote images are or would be fetched.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273721545302077]

[2026-10-07T06:09:48.320Z] Professor Mari [bot]: So: perfectly reasonable feature, but “download and store under an app-controlled asset ID” is much safer than “replace the link with an arbitrary local path.” I’d have a maintainer review the actual file-fetch and media-serving code before calling the design safe. I can still be wrong—I’m an LLM, so don’t trust my security judgment blindly.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273723042660392]

[2026-10-07T06:11:31.028Z] gunterlie: How is that different from fetching web images while chat, as some Cards do?
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557274153831108659]

[2026-10-07T06:12:28.652Z] Professor Mari [bot]: The difference is **persistence**, not the image format:

- **Fetching while chatting:** ME keeps the web URL and requests the image when the card/message is rendered or used. If the host deletes it, the image can stop working later.
- **Baking:** ME would download the image once, store it in ME-managed local storage, and replace or associate the original URL with that local copy. Future chats would no longer depend on the remote link.

For lorebooks, the same idea would mean materializing embedded/remote assets instead of resolving them from the web each time. The current checkout does confirm that importing an embedded lorebook can “bake” it into an editable linked lorebook (`packages/client/src/components/characters/CharacterEditor.tsx:5477-5479`), but I don’t have evidence from the retrieved snippets that image fetching currently performs any durable caching or URL replacement.

So: runtime fetching is a temporary dependency; baking is an explicit archival/import operation. The exact current image pipeline still needs maintainer confirmation, especially for security controls like size/type limits and blocking private-network URLs. I can make mistakes—I’m still an LLM, so don’t trust my judgment too blindly.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557274395523944520]

[2026-10-07T06:16:02.302Z] Kakekay: There *are* security risks obviously (which is why it shouldnt be automated) but if the image is loaded in chat then it is already GG- I propose letting the user download and embed the image (so if the content of the link changes, the image will not.)
bonuses of this are of course: 
1: marginally faster greeting loading (0.0001ms stacks up, trust)
2: archival and preservation.
3: reducing network traffic to and from the site.
4: being able to see these images while offline.
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275291636731995]

[2026-10-07T06:17:04.037Z] gunterlie: Yes I do this so Prof. Mari has the Context to write this into the Issue itself 🙂
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275550572216321]

[2026-10-07T06:17:25.194Z] Kakekay: oop
my b :PepeTin:
[Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275639311106119]

Template check

Please uncheck (untick) 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 @SpicyMarinara on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7221 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Add an explicit option to download remote images used in character greetings and store them as Marinara Engine-managed local assets. Optionally support the same workflow for lorebooks. ## Expected behavior Users should be able to manually bake a remote greeting image into local storage, associate or replace its URL with an app-controlled asset reference, and continue viewing it if the remote file changes, is deleted, or the user is offline. ## Actual behavior Greeting images remain dependent on external URLs and can become unavailable when the remote content changes, is deleted, or cannot be reached. ## Steps to reproduce 1. Use a character greeting containing an image hosted at a remote URL. 2. Load the greeting and confirm that the image is fetched from the remote host. 3. Remove access to the remote image or go offline. 4. Observe that the greeting image is no longer available and there is no described option to preserve it locally. ## Environment - Marinara Engine version: Not provided - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video No logs, screenshots, or video were provided. ## Additional context Requested benefits include archival and preservation, offline access, reduced network traffic, protection against changed remote content, and potentially faster loading. The download should be explicitly user-triggered rather than automatic. Security considerations include SSRF protection, redirect and DNS validation, blocking private/link-local addresses and unsafe URL schemes, app-generated asset paths, file type and magic-byte validation, rejecting or sanitizing SVG/HTML, size and pixel limits, timeouts, rate limits, and avoiding forwarding cookies or authorization headers. Preserve the source URL and allow users to replace or delete the local copy. Lorebook image baking was suggested as an optional extension, without automatic fetching during trigger scanning. Discord thread: Feature Request - "Bake" the messages / Saving messages in greetings. Discord thread link: https://discord.com/channels/1417099416812392641/1557271453261504512 Requested by: gunterlie (gunterlie, Discord ID 282074442962829312) <details> <summary>Discord thread transcript (11 messages)</summary> ```text [2026-10-07T06:00:47.162Z] Kakekay: Not sure what other term to use so I am just yanking a term from gamedev/modelling/whatever. Many bots use images in their greetings, however links do not last forever. They may be deleted intentionally, deleted due to inactivity or just bad luck— Which sucks since some bots are amazing and rely on the images produced! So how about a feature that lets ME download the image and save it locally, replacing the link with the path to the (now saved) image? (Bonus points if this is also added to lorebooks) [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271453261504512] [2026-10-07T06:00:47.748Z] Professor Mari [bot]: Howdy! Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.** **Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab: `Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.` If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here: `Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version` Thank you, this will help tremendously. This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case. Cheers! [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271455719493645] [2026-10-07T06:01:12.057Z] Kakekay: Feature Request - "Bake" the messages / Saving messages in greetings. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557271557678563390] [2026-10-07T06:07:41.474Z] gunterlie: @Professor Mari Before I think harder about this, any surface Security Issues with this? Obvs gonna take a deeper look later. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273191012110367] [2026-10-07T06:09:47.963Z] Professor Mari [bot]: Yes—the biggest security surface is **fetching arbitrary image URLs**, not saving the resulting file. Main things I’d flag: - **SSRF:** A backend fetcher could be pointed at `localhost`, LAN devices, `127.0.0.1`, cloud metadata endpoints, or internal admin panels. Re-check redirects and DNS resolution; allow only `http`/`https`, block private/link-local ranges, and never accept `file:`, `data:`, or `javascript:` URLs. - **Path traversal/overwrite:** Don’t let the URL or character name choose the filesystem path. Generate an ID, use an ME-managed media directory, and prevent writes outside it. - **Malicious image formats:** SVG can contain scripts or external references. Consider rejecting SVG/HTML entirely or sanitizing/rasterizing it. Validate magic bytes, MIME type, file size, and pixel dimensions. - **DoS:** Enforce connection timeouts, response-size limits, decompression/pixel limits, and perhaps a per-bake rate limit. “Image” URLs can return multi-gigabyte files or image bombs. - **Privacy:** Make the download explicitly user-triggered and avoid forwarding cookies, authorization headers, or other app secrets to third-party hosts. - **Stale/malicious content:** Show the source URL and let users replace/delete the local copy. Don’t silently download merely because a lorebook entry or greeting was displayed. For lorebooks, I’d apply the same rules and avoid auto-fetching URLs during trigger scanning. The current snippets prove ME already has an “import/bake embedded lorebook into an editable linked lorebook” flow, with changes syncing back to the card (`packages/client/src/components/characters/CharacterEditor.tsx:5477-5479`, `packages/client/src/localization/locales/en.json:2215-2219`), but they do **not** establish how remote images are or would be fetched. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273721545302077] [2026-10-07T06:09:48.320Z] Professor Mari [bot]: So: perfectly reasonable feature, but “download and store under an app-controlled asset ID” is much safer than “replace the link with an arbitrary local path.” I’d have a maintainer review the actual file-fetch and media-serving code before calling the design safe. I can still be wrong—I’m an LLM, so don’t trust my security judgment blindly. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557273723042660392] [2026-10-07T06:11:31.028Z] gunterlie: How is that different from fetching web images while chat, as some Cards do? [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557274153831108659] [2026-10-07T06:12:28.652Z] Professor Mari [bot]: The difference is **persistence**, not the image format: - **Fetching while chatting:** ME keeps the web URL and requests the image when the card/message is rendered or used. If the host deletes it, the image can stop working later. - **Baking:** ME would download the image once, store it in ME-managed local storage, and replace or associate the original URL with that local copy. Future chats would no longer depend on the remote link. For lorebooks, the same idea would mean materializing embedded/remote assets instead of resolving them from the web each time. The current checkout does confirm that importing an embedded lorebook can “bake” it into an editable linked lorebook (`packages/client/src/components/characters/CharacterEditor.tsx:5477-5479`), but I don’t have evidence from the retrieved snippets that image fetching currently performs any durable caching or URL replacement. So: runtime fetching is a temporary dependency; baking is an explicit archival/import operation. The exact current image pipeline still needs maintainer confirmation, especially for security controls like size/type limits and blocking private-network URLs. I can make mistakes—I’m still an LLM, so don’t trust my judgment too blindly. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557274395523944520] [2026-10-07T06:16:02.302Z] Kakekay: There *are* security risks obviously (which is why it shouldnt be automated) but if the image is loaded in chat then it is already GG- I propose letting the user download and embed the image (so if the content of the link changes, the image will not.) bonuses of this are of course: 1: marginally faster greeting loading (0.0001ms stacks up, trust) 2: archival and preservation. 3: reducing network traffic to and from the site. 4: being able to see these images while offline. [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275291636731995] [2026-10-07T06:17:04.037Z] gunterlie: Yes I do this so Prof. Mari has the Context to write this into the Issue itself 🙂 [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275550572216321] [2026-10-07T06:17:25.194Z] Kakekay: oop my b :PepeTin: [Discord message: https://discord.com/channels/1417099416812392641/1557271453261504512/1557275639311106119] ``` </details> ## Template check Please **uncheck (untick)** 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 06:09:43 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Oct 9, 2026):

Fixed on staging by #7346.

<!-- gh-comment-id:6079329492 --> @SpicyMarinara commented on GitHub (Oct 9, 2026): Fixed on staging by #7346.
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#4032
No description provided.