[GH-ISSUE #7074] [Issue]: Harden the Bot Browser's Pygmalion token login #3956

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

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

A security review of the Bot Browser's Pygmalion login (a pasted auth token kept in server memory) found it mostly sound. The token only goes to Pygmalion, never to disk, and never back to the browser. A few things should still be tightened.

Expected behavior

  • A pasted token with characters a token can't contain (line breaks, control characters, spaces) is rejected with a clear message.
  • Error messages from failed Pygmalion requests never contain the token.
  • The token is stored only after Pygmalion accepts it, and it's cleared when Pygmalion later rejects it.
  • Pygmalion requests go only to Pygmalion's own hosts, through Marinara's protected fetch.
  • The login field is masked, and one plain sentence explains what logging in means.

Actual behavior

  • A token containing a carriage return or NUL is accepted. Later requests then fail with an error whose text includes the whole token. That error is written to the error log and returned to the login toast.
  • A failed validation for reasons other than 401/403 leaves the token stored and in use, while the UI says the login failed.
  • Pygmalion search, character and validate calls use plain fetch, with no host pin, no size cap, and redirects followed.
  • The avatar proxy fetches any https address, though never with the token.
  • The token field isn't masked, and spellcheck is on.

Steps to reproduce

  1. Open the Bot Browser and choose Pygmalion, then Log In.
  2. Paste a value containing a carriage return and save.
  3. Browse Pygmalion. Requests fail, and the error log contains the pasted value.

Environment

  • Marinara Engine version: staging (6234adaf2)
  • Install type: any
  • OS + version: any
  • Browser or app shell: any

Logs, screenshots, or video

Found in a code review with a stubbed harness. No real Pygmalion requests were made.

Additional context

Pygmalion's login stays; this hardens it. CharacterTavern's login is being removed separately with #7072.

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 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7074 Originally assigned to: @SpicyMarinara on GitHub. ## Summary A security review of the Bot Browser's Pygmalion login (a pasted auth token kept in server memory) found it mostly sound. The token only goes to Pygmalion, never to disk, and never back to the browser. A few things should still be tightened. ## Expected behavior - A pasted token with characters a token can't contain (line breaks, control characters, spaces) is rejected with a clear message. - Error messages from failed Pygmalion requests never contain the token. - The token is stored only after Pygmalion accepts it, and it's cleared when Pygmalion later rejects it. - Pygmalion requests go only to Pygmalion's own hosts, through Marinara's protected fetch. - The login field is masked, and one plain sentence explains what logging in means. ## Actual behavior - A token containing a carriage return or NUL is accepted. Later requests then fail with an error whose text includes the whole token. That error is written to the error log and returned to the login toast. - A failed validation for reasons other than 401/403 leaves the token stored and in use, while the UI says the login failed. - Pygmalion search, character and validate calls use plain `fetch`, with no host pin, no size cap, and redirects followed. - The avatar proxy fetches any https address, though never with the token. - The token field isn't masked, and spellcheck is on. ## Steps to reproduce 1. Open the Bot Browser and choose Pygmalion, then Log In. 2. Paste a value containing a carriage return and save. 3. Browse Pygmalion. Requests fail, and the error log contains the pasted value. ## Environment - Marinara Engine version: staging (6234adaf2) - Install type: any - OS + version: any - Browser or app shell: any ## Logs, screenshots, or video Found in a code review with a stubbed harness. No real Pygmalion requests were made. ## Additional context Pygmalion's login stays; this hardens it. CharacterTavern's login is being removed separately with #7072. ## 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:02 +07:00
Author
Owner

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

Fixed on staging by #7086. The Card Browser's Pygmalion login is tightened:

  • Pasting a token: it must look like a token (no spaces or line breaks), and it's kept only after Pygmalion accepts it.
  • Errors and logs: they never contain the token. Messages are fixed and plain: couldn't reach Pygmalion, Pygmalion rejected the token, or Pygmalion is busy.
  • Requests: they go only to Pygmalion's own server, with no redirects and size limits. The avatar proxy only fetches Pygmalion images.
  • Expired sessions: if Pygmalion stops accepting the token, Marinara logs you out and asks you to log in again, including from Import and Download.
  • Token field: it's masked, and the window says the login stays in memory until restart or Log Out.
<!-- gh-comment-id:5986106067 --> @SpicyMarinara commented on GitHub (Oct 5, 2026): Fixed on staging by #7086. The Card Browser's Pygmalion login is tightened: - **Pasting a token:** it must look like a token (no spaces or line breaks), and it's kept only after Pygmalion accepts it. - **Errors and logs:** they never contain the token. Messages are fixed and plain: couldn't reach Pygmalion, Pygmalion rejected the token, or Pygmalion is busy. - **Requests:** they go only to Pygmalion's own server, with no redirects and size limits. The avatar proxy only fetches Pygmalion images. - **Expired sessions:** if Pygmalion stops accepting the token, Marinara logs you out and asks you to log in again, including from Import and Download. - **Token field:** it's masked, and the window says the login stays in memory until restart or Log Out.
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#3956
No description provided.