commit 61180377ff0d1e654530ffe2fd272468d314529b
parent f2a3983b327813376ac4cecf788f70aa52f67607
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Thu, 9 Jul 2026 20:42:05 +0200
check expiration time
Diffstat:
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/challengerdb/validation_get_pkce.c b/src/challengerdb/validation_get_pkce.c
@@ -27,18 +27,22 @@
#include "pg_helper.h"
enum GNUNET_DB_QueryStatus
-CHALLENGERDB_validation_get_pkce (struct CHALLENGERDB_PostgresContext *ctx,
- const struct CHALLENGER_ValidationNonceP *nonce,
- char **client_secret,
- json_t **address,
- char **client_scope,
- char **client_state,
- char **client_redirect_uri,
- char **code_challenge,
- uint32_t *code_challenge_method)
+CHALLENGERDB_validation_get_pkce (
+ struct CHALLENGERDB_PostgresContext *ctx,
+ const struct CHALLENGER_ValidationNonceP *nonce,
+ char **client_secret,
+ json_t **address,
+ char **client_scope,
+ char **client_state,
+ char **client_redirect_uri,
+ char **code_challenge,
+ uint32_t *code_challenge_method)
{
+ struct GNUNET_TIME_Absolute now
+ = GNUNET_TIME_absolute_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (nonce),
+ GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -85,7 +89,8 @@ CHALLENGERDB_validation_get_pkce (struct CHALLENGERDB_PostgresContext *ctx,
" FROM validations"
" JOIN clients "
" USING (client_serial_id)"
- " WHERE nonce=$1");
+ " WHERE nonce=$1"
+ " AND expiration_time > $2");
return GNUNET_PQ_eval_prepared_singleton_select (ctx->conn,
"validation_get_pkce",
params,