Skip to content

Commit 0dd6b16

Browse files
bartlomiejuclaude
andcommitted
fix: validate context-specific tag class in X509 GeneralName URI decoding
Properly check that the ASN.1 tag class is ContextSpecific (not just tag number 6) when decoding uniformResourceIdentifier in AIA extensions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 183b0e8 commit 0dd6b16

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/node_crypto/x509.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,8 @@ fn get_info_access_object(
727727
let (_, any) =
728728
x509_parser::der_parser::asn1_rs::Any::from_der(general_name_data)
729729
.ok()?;
730-
if any.tag().0 == 6
730+
if any.class() == x509_parser::der_parser::asn1_rs::Class::ContextSpecific
731+
&& any.tag().0 == 6
731732
&& let Ok(uri) = std::str::from_utf8(any.data)
732733
{
733734
result
@@ -1272,8 +1273,8 @@ pub fn op_node_x509_get_info_access(
12721273
let (_, any) =
12731274
x509_parser::der_parser::asn1_rs::Any::from_der(general_name_data)
12741275
.ok()?;
1275-
// Tag 6 is context-specific for URI in GeneralName
1276-
if any.tag().0 == 6
1276+
if any.class() == x509_parser::der_parser::asn1_rs::Class::ContextSpecific
1277+
&& any.tag().0 == 6
12771278
&& let Ok(uri) = std::str::from_utf8(any.data)
12781279
{
12791280
entries.push(format!("{}:{}", method_name, uri));

0 commit comments

Comments
 (0)