Skip to content

fix(security): avoid retaining dynamic regexes - #145

Merged
alxxjohn merged 1 commit into
mainfrom
alexj/fix-unbounded-typescript-regex-cache-vulnerability
Aug 19, 2026
Merged

fix(security): avoid retaining dynamic regexes#145
alxxjohn merged 1 commit into
mainfrom
alexj/fix-unbounded-typescript-regex-cache-vulnerability

Conversation

@alxxjohn

Copy link
Copy Markdown
Contributor

Motivation

  • Prevent unbounded process-wide growth of compiled regular expressions originating from attacker-controlled TypeScript aliases and namespaces in long-lived SDK/MCP processes by removing a package-global cache.

Description

  • Remove the package-level dynamicPatternCache and change compileDynamicPattern to directly call regexp.MustCompile so dynamic expressions are not retained across scans and can be garbage-collected.

Testing

  • Ran go test ./internal/codeguard/checks/security ./internal/codeguard/runner/... and go test ./..., and all test packages executed successfully (no failures).

Codex Task

@alxxjohn
alxxjohn merged commit 3b6aa51 into main Aug 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant