Skip to content

Panicking .expect() on regex compilation from user configuration #403

Closed

Description

@aram356

Summary

Configuration-derived regex patterns use .expect() which will panic at runtime if the pattern is invalid. If handler.path or integration config contains invalid regex metacharacters and validation is bypassed (env override, manual TOML edit), the service crashes on first matching request.

Refs

  • crates/common/src/settings.rs line 255 — Regex::new(&self.path).expect(...)
  • crates/common/src/integrations/nextjs/script_rewriter.rs line 125 — Regex::new(&pattern).expect(...)
  • crates/common/src/integrations/nextjs/script_rewriter.rs line 141 — Regex::new(&pattern).expect(...)
  • crates/common/src/integrations/nextjs/shared.rs line 83 — Regex::new(...).expect(...)

Recommendation

Return Result from these constructors; catch at startup with a descriptive error message.

Context

Production readiness audit — see #396

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions