🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #87444

Re: Multiple occurences of header fields

#87444
From: Julien ÉLIE
Date: Tue, 24 May 2016 19:36
115 lines
5785 bytes
Hi all,

>>>> So basically "X-#%-T`!" is a valid header field name. Has
>>>> anyone here already tried to send articles with that unusual
>>>> syntax?
>>
>> INN is far more liberal than that.  It will allow posts with field
>> names which fall outside the allowed range.  (It's not alone in
>> this respect.)
>
> Thanks for that bug report. I hope to fix it for the next release
> (INN 2.6.1).

I've just done a quick audit of how nnrpd enforces the global syntax 
(that is to say not header-specific) given in RFC 5536.  Here are my 
comments.  Do not hesitate to react if you have another point of view.


    o  All agents MUST generate header fields so that at least one space
       immediately follows the ':' separating the header field name and
       the header field body (for compatibility with deployed software,
       including NNTP [RFC3977] servers).

=> This space is currently automatically added by nnrpd, if not already 
present, for standard headers.  I think it is OK to keep that behaviour.
=> However, for non-standard headers, no checks are done.  We should add 
one (note that ":\t" is not allowed, but only ": ").



    o  Every line of a header field body (including the first and any
       that are subsequently folded) MUST contain at least one non-
       whitespace character.

=> This check is currently not done.  We should add it.



    o  Compliant software MUST NOT generate (but MAY accept) header field
       lines of more than 998 octets.  This is the only limit on the
       length of a header field line prescribed by this standard.
       However, specific rules to the contrary may apply in particular
       cases (for example, according to [RFC2047], lines of a header
       field containing encoded words are limited to 76 octets).

=> The check for 998 octets is already done, but not the one for 76 octets!
As INN does not generate such headers, I believe it is OK not to check 
the length of header fields containing encoded words (an injecting agent 
MAY accept them).



    o  The character set for header fields is US-ASCII.  Where the use of
       non-ASCII characters is required, they MUST be encoded using the
       MIME mechanisms defined in [RFC2047] and [RFC2231].

=> This check is currently not done.  I suggest to do nothing about it 
because it will otherwise probably do harm when receiving 
"internationalized" header fields (for instance encoded in UTF-8).



    The following header fields defined in this document do not allow
    <comment>s (i.e., they use FWS rather than CFWS).

    Control
    Distribution
    Followup-To
    Lines
    Newsgroups
    Path
    Supersedes
    Xref

=> I think nnrpd does not check that for Supersedes (and perhaps other 
of these fields).  We should enforce that check, and better, enforce the 
right syntax for these specific headers (Supersedes expects a valid 
message-ID for instance, whereas unstructured text can now be injected).



    An article is said to be conformant to this specification if it
    conforms to the format specified in Section 3 of [RFC5322] and to the
    additional requirements of this specification.

[RFC5322]
    Fields may appear in messages that are otherwise unspecified in this
    document.  They MUST conform to the syntax of an optional-field.
    This is a field name, made up of the printable US-ASCII characters
    except SP and colon, followed by a colon, followed by any text that
    conforms to the unstructured syntax.

    optional-field  =   field-name ":" unstructured CRLF

    field-name      =   1*ftext

    ftext           =   %d33-57 /      ; Printable US-ASCII
                        %d59-126       ; characters not including
                                       ; ":".

    unstructured    =  *WSP VCHAR *( [FWS] VCHAR ) *WSP

    VCHAR           =  %x21-7E         ; visible (printing) characters

=> This check is currently not done at injection time.  I suggest to 
enforce it.  It will fix the issues David reported.

-- 
Julien ÉLIE

« – Ce n'était pas ma question.
   – C'était p'têt pas vot'question, oui, mais c'est ma
     réponse ! » (Georges Marchais répondant à Alain Duhamel)

Technical Details
Message-ID: <ni2afm$96b$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
References: <2116899503.484444288.248931.dunno-dunno.dunno@news.mixmin.net> <ngqpe2$5cc$1@news.trigofacile.com> <1847732562.484552918.438596.dunno-dunno.dunno@news.mixmin.net> <ngtd3e$2e5$1@news.trigofacile.com> <87oa8djpeh.fsf@hope.eyrie.org> <alpine.OSX.2.20.1605111043570.14592@mako.ath.cx> <nhsd2n$mdi$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <ni2afm$96b$1@news.trigofacile.com>
Subject: Re: Multiple occurences of header fields
Date: Tue, 24 May 2016 21:36:22 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <2116899503.484444288.248931.dunno-dunno.dunno@news.mixmin.net> <ngqpe2$5cc$1@news.trigofacile.com> <1847732562.484552918.438596.dunno-dunno.dunno@news.mixmin.net> <ngtd3e$2e5$1@news.trigofacile.com> <87oa8djpeh.fsf@hope.eyrie.org> <alpine.OSX.2.20.1605111043570.14592@mako.ath.cx> <nhsd2n$mdi$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 24 May 2016 19:36:22 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="2a01cb0801180400ad90366b2684cbd9.ipv6.abo.wanadoo.fr:2a01:cb08:118:400:ad90:366b:2684:cbd9";
 logging-data="9419"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
 Gecko/20100101 Thunderbird/45.1.0
In-Reply-To: <nhsd2n$mdi$1@news.trigofacile.com>
X-Received-Body-CRC: 2914605661
X-Received-Bytes: 5759