Skip to content

Commit 41206d1

Browse files
committed
Handle GnuPG 2.4.9
GnuPG 2.4.9 fixes possible memory corruption in armor parsing[0] it appears that this has also changed the warnings emitted. This test now fails: t/seecurity/CVE-2012-4735-incoming-encryption-header.t .. # GnuPG --homedir /tmp/xqR91djkdB ok 1 - created a ticket ok 2 - loaded ticket ok 3 - Found the right attachment ok 4 - Incoming encryption header is removed ok 5 - Incoming signature header is removed ok 6 - created a ticket ok 7 - GnuPG warning ok 8 - GnuPG warning not ok 9 - GnuPG warning # Failed test 'GnuPG warning' # at t/security/CVE-2012-4735-incoming-encryption-header.t line 65. # 'Failure during GnuPG gpg-exit: Failed to gpg-exit # ' # doesn't match '(?^:Failure during GnuPG data: No data has been found\. The reason is 'No armored data')' ok 10 - loaded ticket ok 11 - Found the right attachment ok 12 - Incoming encryption header is removed ok 13 - Incoming signature header is removed ok 14 - no warnings 1..14 These are the warnings emitted: $VAR1 = [ 'gpg: keybox \'/tmp/rRZPP1xcq3/pubring.kbx\' created gpg: invalid radix64 character 5F skipped gpg: invalid radix64 character 5F skipped gpg: invalid radix64 character 2E skipped gpg: [don\'t know]: invalid packet (ctb=4e) ', 'Failure during GnuPG data: No data has been found. The reason is \'Invalid packet found\' ', 'Failure during GnuPG gpg-exit: Failed to gpg-exit ' ]; Let's only look for the 'No armored data' on < 2.4.9. Reported in Debian as part of our regular QA processes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1130943 [0] https://github.com/gpg/gnupg/blob/6cd241007f390a4be8f18982783e79e7cfb42c5f/NEWS#L1
1 parent 78c1b95 commit 41206d1

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

lib/RT/Test/Crypt.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use 5.010;
6161
our @EXPORT =
6262
qw(create_a_ticket update_ticket cleanup_headers set_queue_crypt_options
6363
check_text_emails send_email_and_check_transaction
64-
create_and_test_outgoing_emails
64+
create_and_test_outgoing_emails gnupg_version
6565
);
6666

6767
our $UsingGnuPG = 0;

t/security/CVE-2012-4735-incoming-encryption-header.t

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use strict;
22
use warnings;
3+
use version;
34

45
use RT::Test::Crypt GnuPG => 1, tests => undef;
56
use Test::Warn;
@@ -60,13 +61,19 @@ EOF
6061
($status, $id) = RT::Test->send_via_mailgate($mail);
6162
ok $id, "created a ticket";
6263

63-
like($warnings[0], qr/(?:keyring|keybox) .* created/, 'GnuPG warning');
64-
like($warnings[1], qr/Failure during GnuPG data: No data has been found\. The reason is 'Invalid packet found'/, 'GnuPG warning');
65-
like($warnings[2], qr/Failure during GnuPG data: No data has been found\. The reason is 'No armored data'/, 'GnuPG warning');
64+
like($warnings[0], qr/(?:keyring|keybox) .* created/, 'GnuPG warning (created)');
65+
like($warnings[1], qr/Failure during GnuPG data: No data has been found\. The reason is 'Invalid packet found'/, 'GnuPG warning (invalid packet)');
6666

67-
# GnuPG 2.4.5+ issues another warning for gpg-exit
68-
if ( $warnings[3] ) {
69-
like($warnings[3], qr/Failure during GnuPG gpg-exit: Failed to gpg-exit/, 'GnuPG warning');
67+
my $gnupg_version = RT::Test::Crypt->gnupg_version;
68+
69+
# GnuPG 2.4.9+ removes the "No armored data" warning.
70+
if ($gnupg_version < version->parse('2.4.9')) {
71+
like($warnings[2], qr/Failure during GnuPG data: No data has been found\. The reason is 'No armored data'/, 'GnuPG warning (no armored data)');
72+
}
73+
74+
# GnuPG 2.4.5+ issues a final warning for gpg-exit
75+
if ($gnupg_version >= version->parse('2.4.5')) {
76+
like($warnings[-1], qr/Failure during GnuPG gpg-exit: Failed to gpg-exit/, 'GnuPG warning (gpg-exit)');
7077
}
7178
}
7279

0 commit comments

Comments
 (0)