[PATCH FOLLOWUP STABLE] commitextras: make sure keys contains ascii letters, numbers, '_' and '-' only
Yuya Nishihara
yuya at tcha.org
Sat Jul 29 13:04:26 UTC 2017
On Fri, 28 Jul 2017 08:37:33 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> On Fri, Jul 28, 2017 at 7:20 AM, Pulkit Goyal <7895pulkit at gmail.com> wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pulkit at gmail.com>
> > # Date 1501207975 -19800
> > # Fri Jul 28 07:42:55 2017 +0530
> > # Branch stable
> > # Node ID 2545b963f05a731d51f632bdb0572a755e80eca5
> > # Parent 850d2ec2cf6a266987a401752c909f95dd8c4c53
> > commitextras: make sure keys contains ascii letters, numbers, '_' and '-' only
>
> Why is that important? Are stored as is in the changeset data so they
> can make it unparseable?
':' and 8-bit characters have a real problem. ':' is a key-value separator,
and extras are stored without encoding conversion. The other characters are
probably okay, but I don't think it's good idea to allow free-form keys.
We can relax the restriction later, but tightening it wouldn't be easy.
> > + if re.match('[\w-]+', k).group() != k:
Common regex idiom is finding bad characters.
re.search('[^\w-]', k)
More information about the Mercurial-devel
mailing list