Skip to content

[MEDIUM] find_objects builds unbounded Regex from user-supplied name #119

Description

@Daliys

Problem

find_objects constructs a regular expression directly from the caller-supplied name filter with no parse handling and no match timeout.

Evidence

  • Editor/MCPServerMethods.Search.cs:85-88 creates new Regex(name, RegexOptions.IgnoreCase) and applies it to GameObject names.
  • Invalid patterns throw regex parse exceptions instead of clear validation errors.
  • There is no match timeout, so pathological patterns can consume the Unity main thread during matching.

Impact

A malformed name like Player (1) used as a literal search can fail unexpectedly if interpreted as regex, and catastrophic regex patterns can hang editor automation.

Suggested fix

Either treat name as a literal by default with Regex.Escape, or add an explicit regex mode. If regex remains supported, catch parse errors and use a bounded match timeout.

Source report

Imported from audit report item: Editor/MCPServerMethods.Search.cs:87.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageImported or reported issue awaiting owner reviewpriority: mediumImportant defect or workflow gap with workaroundsurface: json-rpcRaw JSON-RPC methods, schemas, or dispatch surfacesurface: unity-editorUnity Editor package, windows, menus, or C# server surfacetype: correctnessIncorrect result, bad validation, or misleading success/failure behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions