From 0f9d966a1f43d7adb792b00064a8afdc56636cb4 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 16 Mar 2023 22:49:06 -0500 Subject: [PATCH] Remove scaffolding that guessed email addresses from signatures The key index is now queried for email addresses associated with the key used to sign the directive. --- gatekeeper.pl | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 036d879..514bb97 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1797,41 +1797,6 @@ sub interpret_directive { return \@ops; } -# temporary scaffolding; last piece of read_directive_file that does not -# really fit elsewhere and will be removed when the new key index is -# implemented to directly map long key IDs to email addresses -sub verify_clearsigned_message; # declaration; permitted but not required -sub guess_email_address_from_signature { - my $directive_file_contents = shift; - - my @addresses; - - # If we don't know whose project this file belongs to, because the - # 'directory:' line is messed up or not there, we'd still like to let the - # uploader know something went wrong. So let's see if we can match the - # directive file signature against one of our public keyrings. - { - my @tmp_keyrings; - open(TMP,"/usr/bin/find $package_config_base -name pubring.gpg|"); - while() { - chomp; - m,^(/?${RE_filename_relative})$, or next; - push @tmp_keyrings, $1; - } - close(TMP); - - my $tmp_result = verify_clearsigned_message - ($directive_file_contents, @tmp_keyrings); - - unless ($tmp_result->{exitcode} != 0 || defined $tmp_result->{TILT}) { - if (($tmp_result->{raw_log} =~ /Good signature from .*?<(.*?)>/)) - { push @addresses, $1 } - } - } - - return @addresses; -} - =item validate_directive ( $packet, $oplist ) Validate the commands in OPLIST as applicable to PACKET. PACKET is an @@ -2880,9 +2845,6 @@ foreach my $packet (@packets) { # each list element is an array reference my $directive_file = $packet->[0]; my $upload_file = ''; my $sig_file = ''; - # temporary scaffolding until the "any known key" issue is resolved - my $have_any_directive_signature = 0; - unless ($directive_only) { foreach (@{$packet}[1..$#$packet]) { if (m/[.]sig$/) { $sig_file =$_ } else { $upload_file = $_ } @@ -2905,12 +2867,6 @@ foreach my $packet (@packets) { # each list element is an array reference $directive = read_directive_from_string($directive_text); - # TODO: also store the keyring containing a key in the key index and - # check for a valid but inappropriate signature during RP phase - push @email_addresses, - guess_email_address_from_signature($directive_text); - $have_any_directive_signature = scalar @email_addresses; - $oplist = interpret_directive($directive); $op_header = $oplist->[0][1]; @@ -3058,6 +3014,7 @@ foreach my $packet (@packets) { # each list element is an array reference my $E = $@; # preserve the exception, since many functions use eval + my $have_any_directive_signature = 0; { my @fprs; # scratchpad for key fingerprints of valid signatures last unless $directive_text; # skip if no signature at all -- 2.25.1