Bug 8128 - spamassassin --lint doesn't detect bogus rule modifier format
Summary: spamassassin --lint doesn't detect bogus rule modifier format
Status: RESOLVED WONTFIX
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamassassin (show other bugs)
Version: 3.4.0
Hardware: All All
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-11 20:44 UTC by Loren Wilton
Modified: 2023-05-12 09:11 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Loren Wilton 2023-05-11 20:44:26 UTC
This works as expected:

    From: kun0000 <from@xylass.com>
    header LW_FROM_NAME_NUMS From::name =~ /\b[\w_\.-]+\d{3,}\b/

This doesn't work, doesn't give a lint error, and is a hard-to-spot error.

    header LW_FROM_NAME_NUMS From:name =~ /\b[\w_\.-]+\d{3,}\b/
Comment 1 Henrik Krohns 2023-05-12 04:20:30 UTC
Hard to spot indeed, as I can't spot the error?

If you are referring to "From::name", it does output lint error?
Comment 2 Loren Wilton 2023-05-12 06:32:54 UTC
(In reply to Henrik Krohns from comment #1)
> Hard to spot indeed, as I can't spot the error?
> 
> If you are referring to "From::name", it does output lint error?

"From::name" works, with 2 colons.

"From:name", with 1 colon, does not work (gets no hits on the regex) and does not give a lint error. It should do one or the other, in my opinion.
Comment 3 Henrik Krohns 2023-05-12 06:39:59 UTC
(In reply to Loren Wilton from comment #2)
> (In reply to Henrik Krohns from comment #1)
> > Hard to spot indeed, as I can't spot the error?
> > 
> > If you are referring to "From::name", it does output lint error?
> 
> "From::name" works, with 2 colons.

It's not possible for it to work as parse does not accept it.

$ spamassassin --lint --cf 'header LW_FROM_NAME_NUMS From::name =~ /\b[\w_\.-]+\d{3,}\b/'

May 12 09:37:41.247 [1138651] warn: config: invalid head test LW_FROM_NAME_NUMS: From::name =~ /\\b[\\w_\\.-]+\\d{3,}\\b/
May 12 09:37:42.150 [1138651] warn: lint: 1 issues detected, please rerun with debug enabled for more information


> "From:name", with 1 colon, does not work (gets no hits on the regex) and
> does not give a lint error. It should do one or the other, in my opinion.

Works just fine, you are doing something wrong.

$ echo 'From: kun0000 <from@xylass.com>' | spamassassin -t -D all --cf 'header LW_FROM_NAME_NUMS From:name =~ /\b[\w_\.-]+\d{3,}\b/' 2>&1 | grep LW_FROM_NAME_NUMS

May 12 09:39:14.969 [1138814] dbg: config: no description set for rule LW_FROM_NAME_NUMS
May 12 09:39:16.030 [1138814] dbg: rules: ran header rule LW_FROM_NAME_NUMS ======> got hit: "kun0000"
Comment 4 Loren Wilton 2023-05-12 09:05:04 UTC
Ah, ok. It must have been a change between 3.4 and trunk. In 3.4 2 colons works, 1 colon doesn't, neither give a lint error.

[wilton@thursday ~]$ spamassassin --lint --cf 'header LW_FROM_NAME_NUMS From::name =~ /\b[\w_\.-]+\d{2,}\b/'
[wilton@thursday ~]$ spamassassin --lint --cf 'header LW_FROM_NAME_NUMS From:name =~ /\b[\w_\.-]+\d{2,}\b/'
[wilton@thursday ~]$ spamassassin --version
SpamAssassin version 3.4.0
  running on Perl version 5.16.3
Comment 5 Henrik Krohns 2023-05-12 09:11:41 UTC
As you know 3.4 is not maintained anymore, this is too trivial to bother.