[GH-ISSUE #4984] Fix residual polynomial parsing paths found by CodeQL #2764

Closed
opened 2026-10-21 05:54:48 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

CodeQL still reports two polynomial-time parsing paths on staging after the broader security cleanup: inline VN dialogue normalization and bracketed character-macro detection.

Expected behavior

Malformed or very large user/model-authored text should be parsed in linear time while all valid VN dialogue tags and character macros continue to work unchanged.

Scope

Replace the two ambiguous regex paths with narrowly bounded parsing, add adversarial timing and behavior regressions, and do not add content-size caps or remove supported imports/features.

Findings

  • Code scanning alert #463: packages/server/src/services/game/segment-edits.ts
  • Code scanning alert #464: packages/shared/src/utils/macro-engine.ts
Originally created by @SpicyMarinara on GitHub (Aug 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4984 Originally assigned to: @SpicyMarinara on GitHub. ## Summary CodeQL still reports two polynomial-time parsing paths on staging after the broader security cleanup: inline VN dialogue normalization and bracketed character-macro detection. ## Expected behavior Malformed or very large user/model-authored text should be parsed in linear time while all valid VN dialogue tags and character macros continue to work unchanged. ## Scope Replace the two ambiguous regex paths with narrowly bounded parsing, add adversarial timing and behavior regressions, and do not add content-size caps or remove supported imports/features. ## Findings - Code scanning alert #463: packages/server/src/services/game/segment-edits.ts - Code scanning alert #464: packages/shared/src/utils/macro-engine.ts
bsakaguchi 2026-10-21 05:54:48 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 13, 2026):

Ownership: @SpicyMarinara is implementing this on agent/code-scanning-residuals. A draft PR will be opened as soon as the focused patch is present.

<!-- gh-comment-id:5286232256 --> @SpicyMarinara commented on GitHub (Aug 13, 2026): Ownership: @SpicyMarinara is implementing this on `agent/code-scanning-residuals`. A draft PR will be opened as soon as the focused patch is present.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 13, 2026):

Fixed and merged into staging by #4985. The fresh JavaScript CodeQL scan, validation, container build, focused security regressions, and CodeRabbit review all passed.

<!-- gh-comment-id:5286911181 --> @SpicyMarinara commented on GitHub (Aug 13, 2026): Fixed and merged into `staging` by #4985. The fresh JavaScript CodeQL scan, validation, container build, focused security regressions, and CodeRabbit review all passed.
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#2764
No description provided.