Skip to content

Commit 41ec7eb

Browse files
committed
In filemode, add extra check for the filename extension contained in the EE cert
OK tb@
1 parent 0522604 commit 41ec7eb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

regress/usr.sbin/rpki-client/test-seqnum.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: test-seqnum.c,v 1.1 2024/10/07 12:27:27 tb Exp $ */
1+
/* $OpenBSD: test-seqnum.c,v 1.2 2025/06/19 08:21:56 job Exp $ */
22

33
/*
44
* Copyright (c) 2024 Theo Buehler <[email protected]>
@@ -27,6 +27,12 @@
2727

2828
#define MAX_DER 25
2929

30+
enum rtype
31+
rtype_from_file_extension(const char *fn)
32+
{
33+
return RTYPE_INVALID;
34+
}
35+
3036
static const struct seqnum {
3137
const char *descr;
3238
const unsigned char der[MAX_DER];

usr.sbin/rpki-client/x509.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: x509.c,v 1.106 2025/06/19 06:46:56 tb Exp $ */
1+
/* $OpenBSD: x509.c,v 1.107 2025/06/19 08:21:56 job Exp $ */
22
/*
33
* Copyright (c) 2022 Theo Buehler <[email protected]>
44
* Copyright (c) 2021 Claudio Jeker <[email protected]>
@@ -646,6 +646,13 @@ x509_get_sia(X509 *x, const char *fn, char **out_sia)
646646
size_t fnlen, plen;
647647

648648
if (filemode) {
649+
if (rtype_from_file_extension(sia) !=
650+
rtype_from_file_extension(fn)) {
651+
warnx("%s: SIA signedObject contains "
652+
"unexpected filename extension",
653+
fn);
654+
goto out;
655+
}
649656
*out_sia = sia;
650657
continue;
651658
}

0 commit comments

Comments
 (0)