You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2016/03/31 01:07:25 UTC

[jira] [Comment Edited] (OAK-3412) Node name having non space whitspace chars should not be allowed

    [ https://issues.apache.org/jira/browse/OAK-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15219033#comment-15219033 ] 

Alexander Klimetschek edited comment on OAK-3412 at 3/30/16 11:06 PM:
----------------------------------------------------------------------

The JCR specification allows newline characters in node names:
* [local name is specified|http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.2%20Names] as {{ValidChar ::= XmlChar – InvalidChar}}
* with {{XmlChar}} pointing to the [XML spec's NT-Char|http://www.w3.org/TR/xml/#NT-Char] which allows newlines (#xA = carriage return, #xD = new line):
{noformat}
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]	/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
{noformat}

Is there a reason to not be spec compliant here?

Believe it or not, but you can have newlines in unix/mac filesystems, and uploading such files into the JCR then does not work without special, jcr implementation-specific escaping (that otherwise is not needed).


was (Author: alexander.klimetschek):
The JCR specification allows newline characters in node names:
* [local name is specified|http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.2%20Names] as {{ValidChar ::= XmlChar – InvalidChar}}
* with {{XmlChar}} pointing to the [XML spec's NT-Char|http://www.w3.org/TR/xml/#NT-Char] which allows newlines (#xA = carriage return, #xD = new line):
{noformat}
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]	/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
{noformat}

Is there a reason to not be spec compliant here?

Believe it or not, but you can have newlines in unix/mac filesystems, and uploading such files into the JCR then does not work without special escaping (that otherwise is not needed).

> Node name having non space whitspace chars should not be allowed
> ----------------------------------------------------------------
>
>                 Key: OAK-3412
>                 URL: https://issues.apache.org/jira/browse/OAK-3412
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.4, 1.3.7, 1.2.7, 1.0.22
>
>         Attachments: OAK-3412.patch
>
>
> Due to the changes done in OAK-1174 node with non space whitespace chars like '\n', '\r' etc can be created. This is not desirable and also JR2 does not allow such node to be created so check must be added to prevent such a name from getting created.
> As discussed in [1] this is regression due to usage of incorrect utility method as part of [2] the fix can be simply using a {{Character#isWhitespace}} instead of {{Character#isSpaceChar}}
> [1] http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201509.mbox/%3CCAHCW-mkkGtxkn%2B9xfXuvMTfgykewjMPsLwrVH%2B00%2BXaBQjA0sg%40mail.gmail.com%3E
> [2] https://github.com/apache/jackrabbit-oak/commit/342809f7f04221782ca6bbfbde9392ec4ff441c2



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)