openflagr/flagr

Flagr UI: unquoted string constraints with / as the first character do not get caught by parsing error "tok=ILLEGAL"

ajbogh opened this issue · 1 comments

If a string constraint starting with the slash character (/) is entered without quotes, then string can be submitted to the API and the flagr service gets stuck in an infinite loop.

Expected Behavior

A string starting with a '/' should either error with the same parsing error or should automatically convert to a string and create the constraint successfully.

Current Behavior

The constraints API request is allowed to go through, however the response never completes and the flagr service gets stuck processing the request.

Possible Solution

Option 1: Expand the regex for the parsing error to catch strings that start with / but don't have a closing / (assuming it's attempting to identify regex patterns from other strings.

Option 2: If the string is not a regex pattern, do not require quotes. Automatically convert strings.

Steps to Reproduce (for bugs)

  1. Create a new constraint
  2. Add a property, operator, and set the value to /test (without quotes)
  3. Save the constraint.
  4. Notice the network request doesn't complete and the processor starts to heat up.

Your Environment

Version used (flagr version): v1.1.4
Server type and version: Docker ghcr.io/openflagr/flagr using Mysql8

Stale issue message