Skip to content

security: [LOW] Potential ReDoS in markdown table regex #3199

@louisgv

Description

@louisgv

Summary

The markdown table parsing regex in the Slack bot helper uses nested quantifiers that could cause catastrophic backtracking (ReDoS) on malicious input.

Location

.claude/skills/setup-spa/helpers.ts:668MARKDOWN_TABLE_RE

Vulnerability

export const MARKDOWN_TABLE_RE = /\|.+\|\n\|[-: |]+\|\n(?:\|.+\|\n?)*/g;

The .+ and (?:...)* nested quantifiers can cause exponential backtracking if a Slack user sends a crafted markdown payload with thousands of pipe characters but no valid table structure.

Risk

  • Severity: LOW
  • Impact: CPU exhaustion / denial of service (bot hangs)
  • Probability: Low (requires malicious crafted input in Slack messages)
  • Exploitability: Medium (publicly reachable via Slack)

Recommendation

  1. Add input length limit before regex matching:
    if (raw.length > 50000) return { clean: raw, tables: [] };
  2. Or replace with a linear-time parser that doesn't use nested quantifiers

Context

Filed by automated security scan (2026-04-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingsecuritySecurity vulnerabilities and concerns

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions