mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8055] [MERGED] fix(regex): keep imported pattern safety analysis static #8078
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8078
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8055
Author: @SpicyMarinara
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/regex-scanning-659-660📝 Commits (5)
8db7c03test: reproduce regex safety checker scanning findings95ffbeafix(regex): analyze character sets without evaluating patterns0fb298dfix(regex): keep Unicode surrogate analysis conservative7f8367bfix(regex): compare only guaranteed alternative prefixes3bd90a4fix(regex): preserve optional alternative suffixes📊 Changes
2 files changed (+317 additions, -23 deletions)
View changed files
📝
packages/shared/src/utils/regex-safety.ts(+159 -23)➕
scripts/regressions/regex-safety-security.regression.ts(+158 -0)📄 Description
Linked issue
Closes #8053
Addresses code-scanning alerts #659 and #660.
Why this change
Imported card regex scripts pass through a shared safety checker before import and display processing. The checker executed an interpolated pattern fragment while inspecting a character class, and it compared repeated alternatives by spelling rather than by the characters they match. Bounded probes reproduced a server-side checker stall and a synchronous client-processing stall on main and staging.
What changed
[]and[^]classes.Validation
pnpm checkpasses locallyCONTRIBUTING.mdFinal implementation:
3bd90a4edeb9cc14f1b9d46fef7e70d18d76eb26.pnpm checkpassed on this source, including formatting, localization, TypeScript, ESLint and production builds. Only the pre-existingHomeProfessorMariChat.tsxhook warning remains.regex-safety-securityregression passed, with bounded child processes and a proxy proving the checker never dynamically compiles source fragments. The exact regression against immutable7f8367b7fails as expected on leading-optional compatibility.7f8367b7accepted only 20/29 safe controls. No repeated hostile regex was executed by these probes.pnpm smoke:uipassed 7/7 desktop Chromium tests on isolated ports 7870/7871.git diff --checkpassed. Fresh hosted CI and final-head Dottore Review remain merge gates and are tracked on GitHub.Earlier hosted CI on
7f8367b7completed all four workflows successfully, including native platform/container checks and both CodeQL analyses with zero results. Those earlier results are not substituted for checks on the final head.Review dispositions and claim boundary
The previous body-wide surrogate refusal and leading-optional compatibility regression are repaired. Full suffixes now remain present during optional alignment; unsupported-width atoms still stop proof. Null/surrogate and complement handling retain their conservative semantics. The default source-length guard runs before analysis; production callers use its default options. ST conversion calls
isPatternSafebefore retaining imported scripts.The checker remains a static heuristic. Some safe complex patterns can be refused when their syntax cannot be modeled, and this change does not claim exhaustive safety for every JavaScript regex or add a browser worker timeout. Existing server execution timeouts remain in place. The prior naming/allocation nitpicks were not correctness defects and were left scoped to the existing discriminator and bounded lookup.
Docs and release impact
No user-facing copy, installation/update flow, docs, changelog or release metadata changes.
UI evidence (if applicable)
No visual change.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.