[PR #6861] [MERGED] fix: address staging security and quality findings #7356

Closed
opened 2026-10-23 04:18:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6861
Author: @SpicyMarinara
Created: 9/29/2026
Status: ✅ Merged
Merged: 9/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/staging-security-quality


📝 Commits (4)

  • 1a9e517 chore: track staging security and quality fixes
  • 05889d8 fix: harden shared inputs and address quality findings
  • 0161a8a Merge staging and preserve both changelog entries
  • 50967a7 docs: scope provider detection claim to hosted APIs

📊 Changes

18 files changed (+198 additions, -66 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/client/src/components/characters/CharacterLibraryView.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+2 -2)
📝 packages/client/src/components/panels/CharactersPanel.tsx (+1 -1)
📝 packages/server/src/routes/generate.routes.ts (+1 -1)
📝 packages/shared/src/constants/model-lists.ts (+24 -20)
📝 packages/shared/src/features/rulesets/sheet-prompt.ts (+7 -3)
📝 packages/shared/src/features/tactical-combat/grid-gen.ts (+2 -1)
📝 scripts/regressions/capability-gm-verb-runtime.regression.ts (+0 -2)
📝 scripts/regressions/fixtures/posix-terminal-shutdown.py (+2 -0)
📝 scripts/regressions/gallery-file-lifecycle.regression.ts (+1 -1)
📝 scripts/regressions/mari-polish.regression.ts (+0 -1)
➕ scripts/regressions/model-source-hosts.regression.ts (+56 -0)
📝 scripts/regressions/one-request-dice-pool.regression.ts (+0 -1)
📝 scripts/regressions/open-issues.regression.ts (+1 -4)
📝 scripts/regressions/prompt.regression.ts (+28 -26)
➕ scripts/regressions/shared-game-input-security.regression.ts (+68 -0)
📝 scripts/run-server.mjs (+2 -2)

📄 Description

Linked issue

Addresses #6860

Why this change

Provider names embedded in unrelated URLs could select the wrong image/video API. Malformed direct-library inputs could also enter a Game command hint or coerce a tactical-grid property key. This fixes those boundaries and removes the valid small issues in the current quality backlog.

What changed

  • Match hosted providers against the parsed hostname and its domain boundary, preserving explicit model choices and local-tool detection.
  • Restrict scaled pool hints to complete valid identifiers; require integer tactical-grid coordinates before writing terrain.
  • Address 17 quality findings with redundant-condition/import cleanup, declaration ordering and two explanatory fixture comments. No UI layout or copy changes.
  • Preserve eight confirmed false positives; their reasons are recorded below instead of weakening working safeguards.

Validation

Merged to staging as ff59af37eeb110ca6e8be767b733f444b55f33c7 after every required GitHub check and CodeRabbit passed on final head 50967a738b6c78997d29b5ee32de5746a49937ae. Both review threads are resolved. Human checkboxes remain unchecked.

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated evidence:

  • pnpm check passed, including localization, formatting, lint, types and production build.
  • pnpm audit --json: zero vulnerabilities at all severities. The five Dependabot patches already exist on staging via #6830; no redundant dependency bump is included here.
  • New provider-host and shared Game boundary regressions failed before the respective fixes and pass afterward. Positive provider/model/local-tool behavior is retained. The Game proofs exercise public shared-library APIs; no browser or JSON-network exploit is claimed.
  • Focused prompt, attachments/context-fit, gallery lifecycle, media, dice pool, GM verbs, restart/shutdown, terrain, ruleset and provider regressions passed.
  • Browser smoke: 7/7. Focused character-library, settings, media-picker and fixture checks: 11 passed across desktop Chromium/mobile Chromium/mobile WebKit; four existing desktop-only cases skipped on mobile. Production smoke: 3/3. The first browser attempt stopped during guest-asset startup; the clean rerun on dedicated ports after the Node checks passed.
  • Docker image sha256:3179e67716684e9b751b6a195ade7c219d2fa226846b0bc1746ff0adf68cb1f6 built and ran: health, production shell/assets, multiplayer gates and inert guest document verified. Temporary containers removed.
  • After staging advanced through #6864, the changelog-only conflict was resolved by preserving both entries. pnpm check and the shared Game security proof passed again on the integrated branch.
  • GitHub CodeRabbit's changelog-scope finding was fixed in 50967a738; the final hosted review passed.
  • Local CodeRabbit completed with no findings on this 18-file patch. No remote alert is claimed closed merely because this local review passed.

Finding dispositions

Security #520, #532 and #535 have landed source fixes and runnable regression proof. After verifying the staging merge, these alerts were dismissed as mitigated at the maintainer's request, with the merge and pending main release noted. The refreshed staging alert query returns zero open findings. The follow-up #580 is a confirmed false positive: CodeQL 2.27.1 does not model Number.isInteger as a number guard. The reported public placeSpawns path rejects coercible objects and passes the regression; the evidence is recorded in the resolved review thread and the alert was dismissed.

Quality fixes: #2569–2570, #2576–2590 (17 findings).

Confirmed quality false positives:

Findings Why the code stays
#2571–2574 Each promise is already awaited. The later identity comparison releases only the currently owned in-flight entry. Awaiting the operands would compare results and weaken that guard.
#2575 The unreachable block deliberately typechecks invalid fixture payloads with @ts-expect-error without executing them.
#2591–2592 Canvas ignores invalid/unsupported fillStyle assignments, so the first assignment is a necessary fallback. Verified with native Chromium and WebKit probes.
#2593 StorageEvent consumes its supported second init argument. Native Chromium and WebKit probes preserve key/newValue/oldValue.

Dependabot and the standard Code Quality backlog track default main, not staging. The maintainer explicitly deferred main changes to the next release and requested dismissal once remediation is verified on staging. Dependabot #48–52 are now dismissed as fix_started, with comments naming #6830, the patched versions, and the pending main release. Main remains unchanged. A final API refresh confirms zero open Dependabot alerts and 25 still-open Code Quality findings. Code Quality dismissals require the GitHub website; the documented API has no dismissal endpoint and browser access is unavailable in this session. Its 17 valid findings have staging fixes and eight false positives have evidence above. No query suppression or security-check configuration changes are included.

Manual verification notes

No new manual UI path: the client edits remove redundant operands without changing rendering. Browser regressions exercise the affected existing surfaces. Physical-device testing was not performed for this internal cleanup.

Docs and release impact

One Unreleased changelog entry. No user-facing documentation, app version or storage-format change. No main promotion or release included.

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No visible interface change; screenshot evidence is not applicable to these equivalent-expression cleanups.


🔄 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/6861 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/29/2026 **Status:** ✅ Merged **Merged:** 9/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/staging-security-quality` --- ### 📝 Commits (4) - [`1a9e517`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a9e517134adf67c0199b096b3fa3aabb4e0d9c8) chore: track staging security and quality fixes - [`05889d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/05889d85e8da1b0ec39c377a36b542e5ef524bbb) fix: harden shared inputs and address quality findings - [`0161a8a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0161a8ae6265fdd84b46a5d8960ac73791d2ef76) Merge staging and preserve both changelog entries - [`50967a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/50967a738b6c78997d29b5ee32de5746a49937ae) docs: scope provider detection claim to hosted APIs ### 📊 Changes **18 files changed** (+198 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/client/src/components/characters/CharacterLibraryView.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+2 -2) 📝 `packages/client/src/components/panels/CharactersPanel.tsx` (+1 -1) 📝 `packages/server/src/routes/generate.routes.ts` (+1 -1) 📝 `packages/shared/src/constants/model-lists.ts` (+24 -20) 📝 `packages/shared/src/features/rulesets/sheet-prompt.ts` (+7 -3) 📝 `packages/shared/src/features/tactical-combat/grid-gen.ts` (+2 -1) 📝 `scripts/regressions/capability-gm-verb-runtime.regression.ts` (+0 -2) 📝 `scripts/regressions/fixtures/posix-terminal-shutdown.py` (+2 -0) 📝 `scripts/regressions/gallery-file-lifecycle.regression.ts` (+1 -1) 📝 `scripts/regressions/mari-polish.regression.ts` (+0 -1) ➕ `scripts/regressions/model-source-hosts.regression.ts` (+56 -0) 📝 `scripts/regressions/one-request-dice-pool.regression.ts` (+0 -1) 📝 `scripts/regressions/open-issues.regression.ts` (+1 -4) 📝 `scripts/regressions/prompt.regression.ts` (+28 -26) ➕ `scripts/regressions/shared-game-input-security.regression.ts` (+68 -0) 📝 `scripts/run-server.mjs` (+2 -2) </details> ### 📄 Description ## Linked issue Addresses #6860 ## Why this change Provider names embedded in unrelated URLs could select the wrong image/video API. Malformed direct-library inputs could also enter a Game command hint or coerce a tactical-grid property key. This fixes those boundaries and removes the valid small issues in the current quality backlog. ## What changed - Match hosted providers against the parsed hostname and its domain boundary, preserving explicit model choices and local-tool detection. - Restrict scaled pool hints to complete valid identifiers; require integer tactical-grid coordinates before writing terrain. - Address 17 quality findings with redundant-condition/import cleanup, declaration ordering and two explanatory fixture comments. No UI layout or copy changes. - Preserve eight confirmed false positives; their reasons are recorded below instead of weakening working safeguards. ## Validation Merged to staging as `ff59af37eeb110ca6e8be767b733f444b55f33c7` after every required GitHub check and CodeRabbit passed on final head `50967a738b6c78997d29b5ee32de5746a49937ae`. Both review threads are resolved. Human checkboxes remain unchecked. - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated evidence: - `pnpm check` passed, including localization, formatting, lint, types and production build. - `pnpm audit --json`: zero vulnerabilities at all severities. The five Dependabot patches already exist on staging via #6830; no redundant dependency bump is included here. - New provider-host and shared Game boundary regressions failed before the respective fixes and pass afterward. Positive provider/model/local-tool behavior is retained. The Game proofs exercise public shared-library APIs; no browser or JSON-network exploit is claimed. - Focused prompt, attachments/context-fit, gallery lifecycle, media, dice pool, GM verbs, restart/shutdown, terrain, ruleset and provider regressions passed. - Browser smoke: 7/7. Focused character-library, settings, media-picker and fixture checks: 11 passed across desktop Chromium/mobile Chromium/mobile WebKit; four existing desktop-only cases skipped on mobile. Production smoke: 3/3. The first browser attempt stopped during guest-asset startup; the clean rerun on dedicated ports after the Node checks passed. - Docker image `sha256:3179e67716684e9b751b6a195ade7c219d2fa226846b0bc1746ff0adf68cb1f6` built and ran: health, production shell/assets, multiplayer gates and inert guest document verified. Temporary containers removed. - After staging advanced through #6864, the changelog-only conflict was resolved by preserving both entries. `pnpm check` and the shared Game security proof passed again on the integrated branch. - GitHub CodeRabbit's changelog-scope finding was fixed in `50967a738`; the final hosted review passed. - Local CodeRabbit completed with no findings on this 18-file patch. No remote alert is claimed closed merely because this local review passed. ### Finding dispositions Security #520, #532 and #535 have landed source fixes and runnable regression proof. After verifying the staging merge, these alerts were dismissed as `mitigated` at the maintainer's request, with the merge and pending main release noted. The refreshed staging alert query returns zero open findings. The follow-up #580 is a confirmed false positive: CodeQL 2.27.1 does not model `Number.isInteger` as a number guard. The reported public `placeSpawns` path rejects coercible objects and passes the regression; the evidence is recorded in the resolved review thread and the alert was dismissed. Quality fixes: #2569–2570, #2576–2590 (17 findings). Confirmed quality false positives: | Findings | Why the code stays | | --- | --- | | #2571–2574 | Each promise is already awaited. The later identity comparison releases only the currently owned in-flight entry. Awaiting the operands would compare results and weaken that guard. | | #2575 | The unreachable block deliberately typechecks invalid fixture payloads with `@ts-expect-error` without executing them. | | #2591–2592 | Canvas ignores invalid/unsupported fillStyle assignments, so the first assignment is a necessary fallback. Verified with native Chromium and WebKit probes. | | #2593 | StorageEvent consumes its supported second init argument. Native Chromium and WebKit probes preserve key/newValue/oldValue. | Dependabot and the standard Code Quality backlog track default `main`, not staging. The maintainer explicitly deferred main changes to the next release and requested dismissal once remediation is verified on staging. Dependabot #48–52 are now dismissed as `fix_started`, with comments naming #6830, the patched versions, and the pending main release. Main remains unchanged. A final API refresh confirms zero open Dependabot alerts and 25 still-open Code Quality findings. Code Quality dismissals require the GitHub website; the documented API has no dismissal endpoint and browser access is unavailable in this session. Its 17 valid findings have staging fixes and eight false positives have evidence above. No query suppression or security-check configuration changes are included. ### Manual verification notes No new manual UI path: the client edits remove redundant operands without changing rendering. Browser regressions exercise the affected existing surfaces. Physical-device testing was not performed for this internal cleanup. ## Docs and release impact One Unreleased changelog entry. No user-facing documentation, app version or storage-format change. No main promotion or release included. - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No visible interface change; screenshot evidence is not applicable to these equivalent-expression cleanups. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:58 +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#7356
No description provided.