Skip to content

Commit dce81fb

Browse files
committed
offers: enforce restrictions in incoming bip353 name fields.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 47206b9 commit dce81fb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: plugins/offers_invreq_hook.c

+15
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,21 @@ struct command_result *handle_invoice_request(struct command *cmd,
10351035
bad_feature);
10361036
}
10371037

1038+
/* BOLT #12:
1039+
* - if `invreq_bip_353_name` is present:
1040+
* - MUST reject the invoice request if `name` or `domain`
1041+
* contain any bytes which are not `0`-`9`, `a`-`z`,
1042+
* `A`-`Z`, `-`, `_` or `.`.
1043+
*/
1044+
if (ir->invreq->invreq_bip_353_name) {
1045+
if (!bolt12_bip353_valid_string(ir->invreq->invreq_bip_353_name->name,
1046+
tal_bytelen(ir->invreq->invreq_bip_353_name->name))
1047+
|| !bolt12_bip353_valid_string(ir->invreq->invreq_bip_353_name->domain,
1048+
tal_bytelen(ir->invreq->invreq_bip_353_name->domain))) {
1049+
return fail_invreq(cmd, ir, "invalid bip353 name fields");
1050+
}
1051+
}
1052+
10381053
/* BOLT-offers #12:
10391054
*
10401055
* The reader:

0 commit comments

Comments
 (0)