diff options
author | Eric Wong <e@yhbt.net> | 2020-04-20 22:55:37 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-04-21 20:13:47 +0000 |
commit | fb8e7dbd1b711d25d1033c3f5f540ce47f6c0849 (patch) | |
tree | 9560834162cdb04fbc95d5bc0bac3669cd9eaea5 /t/admin.t | |
parent | e700c37c0186915253d639462cfa403fd9fc964f (diff) | |
download | public-inbox-fb8e7dbd1b711d25d1033c3f5f540ce47f6c0849.tar.gz |
In normal mail paths, we can rely on MTAs being configured with reasonable limits in the -watch and -mda mail injection paths. However, the MTA is bypassed in a git-only delivery path, a BOFH could inject a large message and DoS users attempting to mirror a public-inbox. This doesn't protect unindexed WWW interfaces from Email::MIME memory explosions on v1 inboxes. Probably nobody cares about unindexed WWW interfaces anymore, especially now that Xapian is optional for indexing.
Diffstat (limited to 't/admin.t')
-rw-r--r-- | t/admin.t | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -78,4 +78,24 @@ SKIP: { } chdir '/'; + +my @pairs = ( + '1g' => 1024 ** 3, + 666 => 666, + '1500K' => 1500 * 1024, + '15m' => 15 * (1024 ** 2), +); + +while (@pairs) { + my ($in, $out) = splice(@pairs, 0, 2); + my $orig = $in; + ok(PublicInbox::Admin::parse_unsigned(\$in), "parse_unsigned $orig"); + is($in, $out, "got $orig => ($in == $out)"); +} + +for my $v ('', 'bogus', '1p', '1gig') { + ok(!PublicInbox::Admin::parse_unsigned(\$v), + "parse_unsigned rejects $v"); +} + done_testing(); |