<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:29 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-325] MongoDatabase.ValidateDatabaseName() check for invalid characters is too soft.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-325</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;That is what it uses as invalid characters:&lt;br/&gt;
if (name.IndexOfAny(new char[] &lt;/p&gt;
{ &apos;\0&apos;, &apos; &apos;, &apos;.&apos;, &apos;$&apos;, &apos;/&apos;, &apos;\\&apos; }
&lt;p&gt;) != -1) { ...&lt;/p&gt;

&lt;p&gt;Apparently this is not enough. For example it allowed me to create a database &quot;*&quot; and even add a collection and some data. Nothing was found on my disk, indeed, and no exceptions were thrown.&lt;/p&gt;

&lt;p&gt;As far as database names are used as parts of file system names, more characters should be added to invalid. Perhaps System.IO.Path.GetInvalidFileNameChars() is too much but at least some of them like &amp;lt;&amp;gt;?*|&quot;: are candidates.&lt;/p&gt;</description>
                <environment></environment>
        <key id="22420">CSHARP-325</key>
            <summary>MongoDatabase.ValidateDatabaseName() check for invalid characters is too soft.</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="nightroman">Roman Kuzmin</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Sep 2011 22:55:33 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:07 +0000</updated>
                            <resolved>Thu, 29 Sep 2011 20:45:11 +0000</resolved>
                                    <version>1.2</version>
                                    <fixVersion>1.3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="57908" author="nightroman" created="Fri, 30 Sep 2011 15:34:01 +0000"  >&lt;p&gt;After your remarks and on the second thought I think you are right. I forgot that it opens existing or &lt;b&gt;creates&lt;/b&gt; a new database... &lt;/p&gt;</comment>
                            <comment id="57895" author="rstam" created="Fri, 30 Sep 2011 15:05:18 +0000"  >&lt;p&gt;While it is true that a &quot;database&quot; is only created once on the server, on the client side a &quot;MongoDatabase&quot; instance is always created, and as part of the creation of that client side proxy the name is validated. So I think the caching is valid as it will always be used at least once (and more than once if your program accesses multiple databases).&lt;/p&gt;

&lt;p&gt;While it could be lazily initialized, in the end it will &lt;b&gt;always&lt;/b&gt; be created, so it&apos;s just easier to initialize it up front. The only way it wouldn&apos;t be needed is if you write a program that doesn&apos;t access a database, but that seems unlikely... &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="57888" author="nightroman" created="Fri, 30 Sep 2011 14:54:16 +0000"  >&lt;p&gt;Robert,&lt;br/&gt;
I think you made the best decision. Thank you.&lt;/p&gt;

&lt;p&gt;I would not cache `invalidDatabaseNameChars` in a way it is done. It is now&lt;br/&gt;
always created. In any session, because any session requires a database. But&lt;br/&gt;
how many sessions actually *&lt;b&gt;create&lt;/b&gt;* databases? If it is not testing or&lt;br/&gt;
development scenario then basically 0 in most cases or a little in some other&lt;br/&gt;
cases. Still, we make this cache of invalid characters *&lt;b&gt;always&lt;/b&gt;*.&lt;/p&gt;

&lt;p&gt;I would not use this cache at all. But if this cache makes sense then it is&lt;br/&gt;
better be created only on demand when it is really needed (lazy), not always.&lt;/p&gt;

&lt;p&gt;(sorry for been a boring perfectionist, just in case &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;)&lt;/p&gt;</comment>
                            <comment id="57689" author="rstam" created="Thu, 29 Sep 2011 20:45:11 +0000"  >&lt;p&gt;None of the characters in Path.GetInvalidPathChars or Path.GetInvalidFileNameChars should be allowed in database names because database names end up being used as directory and/or file names. In addition MongoDB itself specifies that &apos;\0&apos;, &apos; &apos;, &apos;.&apos;, &apos;$&apos;, &apos;/&apos; and &apos;&lt;br class=&quot;atl-forced-newline&quot; /&gt;&apos; are not allowed.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh8dz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14158</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>