[Mailman-Developers] [Bug 985149] Add List-Post value to permalink hash input

Barry Warsaw barry at list.org
Fri Apr 20 19:43:45 CEST 2012


On Apr 20, 2012, at 12:09 PM, Richard Wackerbarth wrote:

>As for the "opaque" hash, the order is not important. The order of the inputs
>is arbitrary. It needs to be fixed and published so that multiple encoders
>will derive the same hash as that generated by another encoder.

Right.  I've updated the description of bug 985149 to be explicit about the
proposal.  I like Permalink-Hash as the header name.

https://bugs.launchpad.net/mailman/+bug/985149

>If the List ID made a visible part of the message identifier, then it is
>creating a separate namespace for each list. Here the order may have
>implications when viewed in the context of other uses.
>
>Here, we might be wish to be able to have only one copy of the message in the
>archive and/or the distribution channels even when that message gets
>cross-posted to multiple lists.

Note that RFC 5064 defines the Archived-At header.  IMO, this would be the
appropriate place to add any list-specific namespace discriminator.  Also, RFC
2369 defines the List-Archive header, which could contain the base URL to the
archiver, including the List-ID information.

>The one thing that does need to be visible is the designation of the revision
>of the hashing algorithm. Otherwise, without that visible indicator, there is
>no way to recreate a "stable" value if a rehashing needs to be performed.

Yep, see the bug for details.  Below is an example in Python code.

Cheers,
-Barry

>>> from email import message_from_string as mfs
>>> msg = mfs("""\
... To: mylist at example.com
... Message-ID: <foo>
... 
... """)
>>> from hashlib import sha1
>>> from base64 import b32encode
>>> bare_msgid = msg['message-id'][1:-1]
>>> bare_msgid
'foo'
>>> msg['List-ID'] = '<mylist.example.com>'
>>> bare_listid = msg['list-id'][1:-1]
>>> bare_listid
'mylist.example.com'
>>> h = sha1(bare_msgid)
>>> h.update(bare_listid)
>>> permalink_hash = b32encode(h.digest())
>>> permalink_hash
'FW7VLQIZV3P6O64PL7OGLM5Y3RUBQZ4F'
>>> msg.add_header('Permalink-Hash', permalink_hash, version='1')
>>> msg['permalink-hash']
'FW7VLQIZV3P6O64PL7OGLM5Y3RUBQZ4F; version="1"'
>>> msg['List-Archive'] = 'http://list.example.com/{}'.format(bare_listid)
>>> msg['list-archive']
'http://list.example.com/mylist.example.com'
>>> msg['Archived-At'] = '{}/{}'.format(msg['list-archive'], permalink_hash)
>>> msg['archived-at']
'http://list.example.com/mylist.example.com/FW7VLQIZV3P6O64PL7OGLM5Y3RUBQZ4F'


More information about the Mailman-Developers mailing list