From 867f99fe1d593dd543b076600dbf864ceec7cee5 Mon Sep 17 00:00:00 2001 From: Marc Lasson Date: Wed, 8 May 2019 22:52:57 +0200 Subject: [PATCH] Forbid cookie name with '=' Signed-off-by: Marc Lasson --- src/lib_kind.ml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib_kind.ml b/src/lib_kind.ml index 0a319465d030..51811009536e 100644 --- a/src/lib_kind.ml +++ b/src/lib_kind.ml @@ -9,9 +9,17 @@ module Ppx_args = struct let open Stanza.Decoder in let* () = Syntax.since Stanza.syntax (1, 10) in enter - (let+ name = string - and+ value = String_with_vars.decode in - { name; value }) + ( + let+ name = plain_string + (fun loc str -> + if String.contains str '=' then + Errors.fail loc "Character '=' is not allowed in cookie names" + else + str + ) + and+ value = String_with_vars.decode in + { name; value } + ) let encode { name; value } = let open Dune_lang in