Skip to content

Commit

Permalink
only allow | to be used once in keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Aug 31, 2022
1 parent 6278f38 commit 913ff46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mpcontribs-api/mpcontribs/api/__init__.py
Expand Up @@ -31,7 +31,7 @@


delimiter, max_depth = ".", 7 # = MAX_NESTING + 2 from client
invalidChars = set(punctuation.replace("*", "") + whitespace)
invalidChars = set(punctuation.replace("*", "").replace("|", "") + whitespace)
is_gunicorn = "gunicorn" in os.environ.get("SERVER_SOFTWARE", "")
SMTP_HOST, SMTP_PORT = os.environ.get("SMTP_SERVER", "localhost:587").split(":")

Expand Down Expand Up @@ -83,6 +83,9 @@ def valid_key(key):
if char in invalidChars:
raise ValidationError(f"invalid character {char} in {key}")

if key.count("|") > 1:
raise ValidationError(f"Only one `|` allowed in {key}. Consider nesting.")


def visit(path, key, value):
key = key.strip()
Expand Down

0 comments on commit 913ff46

Please sign in to comment.