Skip to content

bug(markup): exponential backtracking in reference-name validation #447

Open

Description

@Wenjix

Security review finding (medium, CWE-1333).

packages/markup/src/syntax.ts validates dotted reference names with ^[A-Za-z_][A-Za-z0-9_.:-]*(?:\.[A-Za-z_][A-Za-z0-9_.:-]*)*$. . appears both inside the segment character class and as the separator, so on a malformed dotted name the regex engine tries exponentially many partitions — ~330 ms at 25 trailing dots, doubling per dot; ~40 dots is effectively a parse-thread hang. Reachable from any authored .svml file.

The same ambiguity means the pattern also accepts a., a..b and x.y., which the strict grammar rejects.

Proposed fix: strict ident(.ident)* — . becomes separator-only so matching is linear.

Fix: #439

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions