Thread View: news.software.nntp
10 messages
10 total messages
Started by Matthew Vernon
Fri, 31 May 2019 14:50
Cleanfeed bug in yEnc handling
Author: Matthew Vernon
Date: Fri, 31 May 2019 14:50
Date: Fri, 31 May 2019 14:50
56 lines
2680 bytes
2680 bytes
Hi,
Cleanfeed's matching of yEnc lines is a little too strict, and this has
lead to spam with header lines like:
## =ybegin line=128 size=716800 name=a
(but without the ## ) getting through - Cleanfeed insists on an
extension on the failname in the name= parameter.
Ian Jackson provided the fix after I discovered the problem, because he
has Perl skills:
diff --git a/cleanfeed b/cleanfeed
index 5141379..02f0320 100644
--- a/cleanfeed
+++ b/cleanfeed
@@ -1562,13 +1562,19 @@ sub is_binary {
# =ybegin.
if ($hdr{__BODY__} =~ /(?:^|\n)=ybegin\s+(.+)/o) {
local $_ = $1;
- # Further confirmation that this is a yEnc message and extract
- # the file extension. Greedy is good in this instance.
- if (/line=/ and /size=/ and /name=.*\.(\w{2,4})/) {
- $file_extension = $1;
- $Cache_Is_Binary = "yEnc Encoded";
- return $Cache_Is_Binary;
- };
+ if (/line=/ and /size=/) {
+ # Further confirmation that this is a yEnc message and extract
+ # the file extension. Greedy is good in this instance.
+ if (/name=.*\.(\w{2,4})/) {
+ $file_extension = $1;
+ $Cache_Is_Binary = "yEnc Encoded";
+ return $Cache_Is_Binary;
+ } elsif (/name=/) {
+ $file_extension = '';
+ $Cache_Is_Binary = "yEnc Encoded (no extension)";
+ return $Cache_Is_Binary;
+ }
+ }
};
# uuEncoded check
HTH,
Matthew
--
`O'-----0 `O'---. `O'---. `O'---.
\___| | \___|0-/ \___|/ \___|
| | /\ | | \ | |\ | |
The Dangers of modern veterinary life
Re: Cleanfeed bug in yEnc handling
Author: Steve Crook
Date: Sat, 01 Jun 2019 15:26
Date: Sat, 01 Jun 2019 15:26
54 lines
2552 bytes
2552 bytes
On Fri, 31 May 2019 15:50:17 +0100, Matthew Vernon wrote in
Message-Id: <np3d0jyr846.fsf@sanger.ac.uk>:
> Hi,
>
> Cleanfeed's matching of yEnc lines is a little too strict, and this has
> lead to spam with header lines like:
>
> ## =ybegin line=128 size=716800 name=a
Hi Matthew,
Thanks for providing the patch. Unfortunately it appears to be against
a different version of cleanfeed to the one I maintain at:
https://github.com/crooks/cleanfeed
I've attempted to convert your patch into the current version (see
below) but I've nowhere currently to test it. Please give it a try and
let me know how it goes.
Cheers,
Steve
diff --git a/cleanfeed b/cleanfeed
index 9c4c8b5..3d36c7d 100644
--- a/cleanfeed
+++ b/cleanfeed
@@ -1614,12 +1614,14 @@ sub is_binary {
# =ybegin.
if ($body =~ /(?:^|\n)=ybegin$hws+(.+)/o) {
local $_ = $1;
- # Further confirmation that this is a yEnc message and extract
- # the file extension. Greedy is good in this instance.
- if (/line=/ and /size=/ and /name=.*\.(\w{2,4})/) {
- $state{file_extension} = $1;
- $state{cache_is_binary} = "yEnc Encoded";
- return $state{cache_is_binary};
+ if (/line=/ and /size=/) {
+ # Further confirmation that this is a yEnc message and extract the
+ # file extension. Greedy is good in this instance.
+ if (/name=.*\.(\w{2,4})/) {
+ $state{file_extension} = $1;
+ $state{cache_is_binary} = "yEnc Encoded";
+ return $state{cache_is_binary};
+ };
};
};
--
What shall we use
To fill the empty spaces
Where we used to talk?
Re: Cleanfeed bug in yEnc handling
Author: Julien ÉLIE
Date: Sat, 01 Jun 2019 19:31
Date: Sat, 01 Jun 2019 19:31
37 lines
2587 bytes
2587 bytes
Hi Steve,
>> Cleanfeed's matching of yEnc lines is a little too strict, and this has
>> lead to spam with header lines like:
>>
>> ## =ybegin line=128 size=716800 name=a
>
> @@ -1614,12 +1614,14 @@ sub is_binary {
> # =ybegin.
> if ($body =~ /(?:^|\n)=ybegin$hws+(.+)/o) {
> local $_ = $1;
> - # Further confirmation that this is a yEnc message and extract
> - # the file extension. Greedy is good in this instance.
> - if (/line=/ and /size=/ and /name=.*\.(\w{2,4})/) {
> - $state{file_extension} = $1;
> - $state{cache_is_binary} = "yEnc Encoded";
> - return $state{cache_is_binary};
> + if (/line=/ and /size=/) {
> + # Further confirmation that this is a yEnc message and extract the
> + # file extension. Greedy is good in this instance.
> + if (/name=.*\.(\w{2,4})/) {
> + $state{file_extension} = $1;
> + $state{cache_is_binary} = "yEnc Encoded";
> + return $state{cache_is_binary};
> + };
> };
> };
If we have "name=a" (without extension), like in "=ybegin line=128
size=716800 name=a", I think the if-statement won't catch it.
--
Julien ÉLIE
« Internet restera toujours un joujou pour les universitaires. »
(1991)
Re: Cleanfeed bug in yEnc handling
Author: Steve Crook
Date: Sat, 01 Jun 2019 20:05
Date: Sat, 01 Jun 2019 20:05
52 lines
3011 bytes
3011 bytes
On Sat, 1 Jun 2019 21:31:05 +0200, Julien ÉLIE wrote in
Message-Id: <qcujpu$n86$1@news.trigofacile.com>:
> Hi Steve,
>>> Cleanfeed's matching of yEnc lines is a little too strict, and this has
>>> lead to spam with header lines like:
>>>
>>> ## =ybegin line=128 size=716800 name=a
>>
>> @@ -1614,12 +1614,14 @@ sub is_binary {
>> # =ybegin.
>> if ($body =~ /(?:^|\n)=ybegin$hws+(.+)/o) {
>> local $_ = $1;
>> - # Further confirmation that this is a yEnc message and extract
>> - # the file extension. Greedy is good in this instance.
>> - if (/line=/ and /size=/ and /name=.*\.(\w{2,4})/) {
>> - $state{file_extension} = $1;
>> - $state{cache_is_binary} = "yEnc Encoded";
>> - return $state{cache_is_binary};
>> + if (/line=/ and /size=/) {
>> + # Further confirmation that this is a yEnc message and extract the
>> + # file extension. Greedy is good in this instance.
>> + if (/name=.*\.(\w{2,4})/) {
>> + $state{file_extension} = $1;
>> + $state{cache_is_binary} = "yEnc Encoded";
>> + return $state{cache_is_binary};
>> + };
>> };
>> };
>
> If we have "name=a" (without extension), like in "=ybegin line=128
> size=716800 name=a", I think the if-statement won't catch it.
Hi Julien,
I agree, the regex in both the original and the proposed patch won't
catch a filename without a period and an extension. It looks
like the intention was to enforce an extension of 2-4 ascii characters
but there's no termination on the regex it so it would match an
extension of anything over 2 chars.
I checked out the yEnc spec and it doesn't appear to enforce any
particular filename format. I think the best option would be to just
check for:-
/line=/ and /size=/ and /name=/ in a =ybegin line. Would you agree?
--
What shall we use
To fill the empty spaces
Where we used to talk?
Re: Cleanfeed bug in yEnc handling
Author: Julien ÉLIE
Date: Sat, 01 Jun 2019 22:13
Date: Sat, 01 Jun 2019 22:13
27 lines
2085 bytes
2085 bytes
Hi Steve,
>>>> ## =ybegin line=128 size=716800 name=a
>
> I checked out the yEnc spec and it doesn't appear to enforce any
> particular filename format. I think the best option would be to just
> check for:-
> /line=/ and /size=/ and /name=/ in a =ybegin line. Would you agree?
I see that it is what PyClean already does :-)
if 'line=' in l and 'size=' in l and 'name=' in l:
return 'yEnc'
PyClean is therefore performing pretty well against the current yEnc
spam! I am in favour of doing the same for Cleanfeed so that it matches
/name=/ only.
--
Julien ÉLIE
« – Du potage : c'est tout ce que le cuisinier a pu faire !
– Ce blocus devient très horripilant !
– Blocus, c'est ton cuisinier ? » (Astérix)
Re: Cleanfeed bug in yEnc handling
Author: Matthew Vernon
Date: Sat, 01 Jun 2019 23:53
Date: Sat, 01 Jun 2019 23:53
34 lines
2018 bytes
2018 bytes
Steve Crook <steve@mixmin.net> writes:
> On Fri, 31 May 2019 15:50:17 +0100, Matthew Vernon wrote in
> Message-Id: <np3d0jyr846.fsf@sanger.ac.uk>:
>
>> Hi,
>>
>> Cleanfeed's matching of yEnc lines is a little too strict, and this has
>> lead to spam with header lines like:
>>
>> ## =ybegin line=128 size=716800 name=a
>
> Hi Matthew,
>
> Thanks for providing the patch. Unfortunately it appears to be against
> a different version of cleanfeed to the one I maintain at:
> https://github.com/crooks/cleanfeed
We got our cleanfeed from what is I presume your website:
https://www.mixmin.net/cleanfeed/
....might be worth linking to your git repo there? :)
Regards,
Matthew
--
`O'-----0 `O'---. `O'---. `O'---.
\___| | \___|0-/ \___|/ \___|
| | /\ | | \ | |\ | |
The Dangers of modern veterinary life
Re: Cleanfeed bug in yEnc handling
Author: Julien ÉLIE
Date: Sun, 02 Jun 2019 07:50
Date: Sun, 02 Jun 2019 07:50
25 lines
2103 bytes
2103 bytes
Hi Matthew, >> Thanks for providing the patch. Unfortunately it appears to be against >> a different version of cleanfeed to the one I maintain at: >> https://github.com/crooks/cleanfeed > > We got our cleanfeed from what is I presume your website: > https://www.mixmin.net/cleanfeed/ > > ....might be worth linking to your git repo there? :) Oh yes, that would be great! (Like for PyClean.) I was still using the one at <http://www.mixmin.net/cleanfeed/cleanfeed> (which appears not to be up-to-date), following the upgrading instructions at <http://www.mixmin.net/cleanfeed/install.html>. It should then point to the Github repository :) -- Julien ÉLIE « – Du potage : c'est tout ce que le cuisinier a pu faire ! – Ce blocus devient très horripilant ! – Blocus, c'est ton cuisinier ? » (Astérix)
Re: Cleanfeed bug in yEnc handling
Author: Steve Crook
Date: Sun, 02 Jun 2019 10:32
Date: Sun, 02 Jun 2019 10:32
33 lines
2088 bytes
2088 bytes
On Sun, 2 Jun 2019 00:13:06 +0200, Julien ÉLIE wrote in Message-Id: <qcut9n$alb$1@news.trigofacile.com>: > Hi Steve, > >>>>> ## =ybegin line=128 size=716800 name=a >> >> I checked out the yEnc spec and it doesn't appear to enforce any >> particular filename format. I think the best option would be to just >> check for:- >> /line=/ and /size=/ and /name=/ in a =ybegin line. Would you agree? > > I see that it is what PyClean already does :-) > > if 'line=' in l and 'size=' in l and 'name=' in l: > return 'yEnc' > > > PyClean is therefore performing pretty well against the current yEnc > spam! I am in favour of doing the same for Cleanfeed so that it matches > /name=/ only. Yes, I'm seeing ~100 articles per day being rejected due to misplaced yEnc encoding. I probably decided about 8 years ago that a relaxed check was better in PyClean! I've changed cleanfeed to align with it now. -- What shall we use To fill the empty spaces Where we used to talk?
Re: Cleanfeed bug in yEnc handling
Author: Steve Crook
Date: Sun, 02 Jun 2019 10:39
Date: Sun, 02 Jun 2019 10:39
26 lines
1665 bytes
1665 bytes
On Sun, 02 Jun 2019 00:53:09 +0100, Matthew Vernon wrote in Message-Id: <np38sukrhga.fsf@sanger.ac.uk>: >> Hi Matthew, >> >> Thanks for providing the patch. Unfortunately it appears to be against >> a different version of cleanfeed to the one I maintain at: >> https://github.com/crooks/cleanfeed > > We got our cleanfeed from what is I presume your website: > https://www.mixmin.net/cleanfeed/ > > ...might be worth linking to your git repo there? :) Oops, sorry about that, I hadn't realised the website contained a hardcoded tarball. I've updated the links for installation and upgrading to point to the github repository. http://www.mixmin.net/cleanfeed/install.html -- What shall we use To fill the empty spaces Where we used to talk?
Re: Cleanfeed bug in yEnc handling
Author: Steve Crook
Date: Sun, 02 Jun 2019 10:40
Date: Sun, 02 Jun 2019 10:40
28 lines
1933 bytes
1933 bytes
On Sun, 2 Jun 2019 09:50:40 +0200, Julien ÉLIE wrote in Message-Id: <qcvv4g$tua$1@news.trigofacile.com>: > Hi Matthew, >>> Thanks for providing the patch. Unfortunately it appears to be against >>> a different version of cleanfeed to the one I maintain at: >>> https://github.com/crooks/cleanfeed >> >> We got our cleanfeed from what is I presume your website: >> https://www.mixmin.net/cleanfeed/ >> >> ....might be worth linking to your git repo there? :) > > Oh yes, that would be great! (Like for PyClean.) > > I was still using the one at <http://www.mixmin.net/cleanfeed/cleanfeed> > (which appears not to be up-to-date), following the upgrading > instructions at <http://www.mixmin.net/cleanfeed/install.html>. > It should then point to the Github repository :) Indeed it should! Now it does. :) -- What shall we use To fill the empty spaces Where we used to talk?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads