commit 172bccd5fe19f3a25142537301aed3987e89af56
parent 30d176988c42fcde417e99532efe260cb0a93e40
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 2 Aug 2026 23:01:46 +0200
ensure client's cur_time is within a reasonable timeframe of 'now'
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/backend/paivana-httpd_pay.c b/src/backend/paivana-httpd_pay.c
@@ -35,6 +35,14 @@ struct PayRequest;
#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE struct PayRequest
#include "taler/merchant/get-private-orders-ORDER_ID.h"
+/**
+ * How much do we allow the client clock to be off and still
+ * accept the client's timestamp? This basically allows a
+ * client to extend the lifetime of their purchase by putting
+ * the payment date into the future.
+ */
+#define CLIENT_PAY_TIME_TOLERANCE \
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90)
/**
* Handle for processing actual payment.
@@ -368,6 +376,18 @@ PAIVANA_HTTPD_payment_handle (struct PayRequest *ph,
spec);
if (GNUNET_YES != ret)
return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
+ if (GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_remaining (ph->cur_time.abs_time),
+ >,
+ CLIENT_PAY_TIME_TOLERANCE))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (
+ ph->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "cur_time");
+ }
}
GNUNET_assert (NULL == ph->co);
ph->co = TALER_MERCHANT_get_private_order_create (PH_ctx,