From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D2B331F601 for ; Mon, 8 Aug 2022 23:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1660000608; bh=nfh31BPwF0O6bFl2qKMPVpJ50ZjAvlC6GOH4xEqv9wo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nQWNLIH5WaZEe9t7ELPh5BWTpkxnT2XSn6WPaujEFWeSlQ5efA6Ln7BcdmnoMa1RB ap5ZiLqO6Awzt40b5H/tEvGbGKcjGzp92mbfKq/GMohjtwozhpXSq4OHWeBR3+JK1O nwjO2BycRWFtCl0UQ3P90C4YDHlSvSE6+/hxwdSQ= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] imap: only give AUTH=ANONYMOUS clients prefetch Date: Mon, 8 Aug 2022 23:16:46 +0000 Message-Id: <20220808231648.1954885-3-e@80x24.org> In-Reply-To: <20220808231648.1954885-1-e@80x24.org> References: <20220808231648.1954885-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Looking at IMAP traffic on public-inbox.org, it seems there is a fair amount of traffic coming from malicious clients assuming the IMAP server is compromised and searching for private information. Since AUTH=ANONYMOUS clients are more likely to be legitimate clients looking for publicly-archived mail, give them priority. --- lib/PublicInbox/IMAP.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index bed633e5..4ef5252b 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -138,6 +138,7 @@ sub login_success ($$) { sub auth_challenge_ok ($) { my ($self) = @_; my $tag = delete($self->{-login_tag}) or return; + $self->{anon} = 1; login_success($self, $tag); } @@ -588,10 +589,9 @@ sub fetch_blob_cb { # called by git->cat_async via ibx_async_cat $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid"; } my $pre; - if (!$self->{wbuf} && (my $nxt = $msgs->[0])) { - $pre = ibx_async_prefetch($ibx, $nxt->{blob}, + ($self->{anon} && !$self->{wbuf} && $msgs->[0]) and + $pre = ibx_async_prefetch($ibx, $msgs->[0]->{blob}, \&fetch_blob_cb, $fetch_arg); - } fetch_run_ops($self, $smsg, $bref, $ops, $partial); $pre ? $self->dflush : $self->requeue_once; }