commit 5f4ec315e3914ea2155f6ce4f4284d1bef67efe7
parent 12d8ac1dc7d9b2601375d20e955509ba599bfaf1
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 4 Aug 2026 17:06:12 +0200
make not getting client address fatal instead of allowing client to pay in vain (and then not get access anyway)
Diffstat:
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/backend/paivana-httpd_pay.c b/src/backend/paivana-httpd_pay.c
@@ -285,11 +285,27 @@ order_status_cb (struct PayRequest *ph,
if (! check_contract (ph,
osr->details.ok.details.paid.contract_terms))
return;
- /* If we cannot get the client address, we just
- use 0/NULL and log an error. */
- GNUNET_break (PAIVANA_HTTPD_get_client_address (ph->connection,
- &ca,
- &ca_len));
+ /* The client address is bound into the cookie MAC; computing
+ the cookie over an empty address would produce a cookie that
+ PAIVANA_HTTPD_check_cookie can never match, silently denying
+ the access the client just paid for. Treat failure to obtain
+ it as a hard error instead.
+
+ Note: This should become conditional once we add a
+ configuration option to not include the client address in the
+ cookie hash to allow one payment to be used from any IP
+ address. */
+ if (! PAIVANA_HTTPD_get_client_address (ph->connection,
+ &ca,
+ &ca_len))
+ {
+ GNUNET_break (0);
+ ph->response = TALER_MHD_make_error (
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ ph->order_id);
+ ph->response_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
+ break;
+ }
cookie = PAIVANA_HTTPD_compute_cookie (ph->cur_time,
ph->website,
ca_len,