Re: xmlconcat (was 9.0 release notes done)

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: xmlconcat (was 9.0 release notes done)
Date: 2010-03-22 23:38:45
Message-ID: 4BA7FF85.5000301@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut wrote:
> On sön, 2010-03-21 at 13:07 -0400, Andrew Dunstan wrote:
>
>> Yeah, maybe. According to
>> <http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html> the only
>> legal child of an XML Document node that is not also a legal child of a
>> DocumentFragment node is a DocumentType node. So we could probably just
>> look for one of those in each argument node and strip it out. That
>> should be fairly lightweight in the common case where it's not present -
>> we'd just be searching for a fixed string. Removing it if found would be
>> more complex. We'd have to parse the node to remove it, since a legal
>> DocumentType node string could appear legally inside a CDATA node.
>>
>
> According to the SQL/XML standard, the document type declaration should
> apparently be stripped when doing a concatenation. (This makes sense
> because the result of a concatenation can never be valid according to a
> DTD.)
>
> But if we are not comfortable about being able to do that safely, I
> would be OK with just raising an error if a concatenation is attempted
> where one value contains a DTD. The impact in practice should be low.
>

Right. Can you find a way to do that using the libxml API? I haven't
managed to, and I'm pretty sure I can construct XML that fails every
simple string search test I can think of, either with a false negative
or a false positive.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-03-22 23:39:27 Re: 9.0 release notes done
Previous Message Tom Lane 2010-03-22 23:29:53 Re: Re: [COMMITTERS] pgsql: Prevent the injection of invalidly encoded strings by PL/Python