commit 6983e57aca28fcc9c358510bc5e2e0b79821859a
parent 9f89147e2f5d8f1af7106b8eae2326cec38d0c96
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 9 Oct 2026 22:53:23 +0200
check editable_defaults and templates are objects (input validation)
Diffstat:
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_patch-private-templates-TEMPLATE_ID.c b/src/backend/taler-merchant-httpd_patch-private-templates-TEMPLATE_ID.c
@@ -54,11 +54,11 @@ TMH_private_patch_templates_ID (const struct TMH_RequestHandler *rh,
TALER_JSON_spec_slug ("otp_id",
(const char **) &tp.otp_id),
NULL),
- GNUNET_JSON_spec_json ("template_contract",
- &tp.template_contract),
+ GNUNET_JSON_spec_object_copy ("template_contract",
+ &tp.template_contract),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("editable_defaults",
- &tp.editable_defaults),
+ GNUNET_JSON_spec_object_copy ("editable_defaults",
+ &tp.editable_defaults),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -76,7 +76,6 @@ TMH_private_patch_templates_ID (const struct TMH_RequestHandler *rh,
? MHD_YES
: MHD_NO;
}
-
if (! TALER_MERCHANT_template_contract_valid (tp.template_contract))
{
GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_post-private-templates.c b/src/backend/taler-merchant-httpd_post-private-templates.c
@@ -79,11 +79,11 @@ TMH_private_post_templates (const struct TMH_RequestHandler *rh,
TALER_JSON_spec_slug ("otp_id",
(const char **) &tp.otp_id),
NULL),
- GNUNET_JSON_spec_json ("template_contract",
- &tp.template_contract),
+ GNUNET_JSON_spec_object_copy ("template_contract",
+ &tp.template_contract),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("editable_defaults",
- &tp.editable_defaults),
+ GNUNET_JSON_spec_object_copy ("editable_defaults",
+ &tp.editable_defaults),
NULL),
GNUNET_JSON_spec_end ()
};