commit d9fdf50e7263eefa4425e746cfb6a39f66e77ac4
parent 3bb7be6cb8a25984ee6bff2f991690b6a6a08220
Author: Florian Dold <dold@taler.net>
Date: Mon, 27 Jul 2026 20:43:48 +0200
exchange: add a confidence floor for sanction investigations
Diffstat:
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/exchange/taler-exchange-sanctionscheck.c b/src/exchange/taler-exchange-sanctionscheck.c
@@ -174,12 +174,23 @@ static float freeze_rating_limit = 0.9;
static float freeze_confidence_limit = 0.9;
/**
- * Rating/confidence threshold that must be passed to begin
- * an investigation.
+ * Threshold on rating/confidence that must be exceeded to begin an
+ * investigation (when the account is not automatically frozen). A low
+ * confidence relative to the rating raises the ratio, which is intentional:
+ * the less sure the automated match is, the more a human should look.
*/
static float investigation_limit = 0.9;
/**
+ * Minimum match confidence for an investigation. This gates the ratio test
+ * above so that near-zero-confidence noise (e.g. a fuzzy match against an
+ * attribute that is not a name at all) does not, via its large ratio, flag
+ * every account. Optional; defaults to 0 to preserve the historic behaviour
+ * of having no confidence floor.
+ */
+static float investigation_confidence_limit = 0.0;
+
+/**
* Write @a min_row_id to @a min_row_fd.
*/
static void
@@ -310,7 +321,8 @@ sanction_cb (void *cls,
freeze = true;
investigate = true;
}
- else if (rating > (double) investigation_limit * confidence)
+ else if ( (rating > (double) investigation_limit * confidence) &&
+ (confidence > (double) investigation_confidence_limit) )
{
investigate = true;
}
@@ -674,6 +686,18 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_float (cfg,
+ "exchange-sanctionscheck",
+ "INVESTIGATION_CONFIDENCE_LIMIT",
+ &investigation_confidence_limit))
+ {
+ /* Optional; absence restores the historic no-floor behaviour. It gates
+ every investigation, so say which value is in force. */
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "INVESTIGATION_CONFIDENCE_LIMIT not configured, using %f\n",
+ (double) investigation_confidence_limit);
+ }
if (! init_freeze ())
return;
{