<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:44:35 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>[SERVER-36962] ViewCatalog::resolveView() may return invalid resolved view on encountering invalid namespace in view definition</title>
                <link>https://jira.mongodb.org/browse/SERVER-36962</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c5088b0a184ed6993735ffdb37de5025b57a456/src/mongo/db/views/view_catalog.cpp#L392&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ViewCatalog::_lookup_inlock()&lt;/a&gt; method will return a null shared_ptr if&#160;either:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;A view definition is not found for the given namespace&lt;/li&gt;
	&lt;li&gt;A view catalog reload is needed and the given namespace is not a valid collection name&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c5088b0a184ed6993735ffdb37de5025b57a456/src/mongo/db/views/view_catalog.cpp#L421&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ViewCatalog::resolveView()&lt;/a&gt; however interprets the null shared_ptr as an indication that the namespace is a collection and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c5088b0a184ed6993735ffdb37de5025b57a456/src/mongo/db/views/view_catalog.cpp#L469&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;returns the resolved view&lt;/a&gt;. This is incorrect in the case that ViewCatalog::_lookup_inlock() returns due to invalid collection name&lt;/p&gt;
</description>
                <environment></environment>
        <key id="598171">SERVER-36962</key>
            <summary>ViewCatalog::resolveView() may return invalid resolved view on encountering invalid namespace in view definition</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13203">Gone away</resolution>
                                        <assignee username="haley.connelly@mongodb.com">Haley Connelly</assignee>
                                    <reporter username="james.wahlin@mongodb.com">James Wahlin</reporter>
                        <labels>
                            <label>query-44-grooming</label>
                            <label>read-only-views</label>
                    </labels>
                <created>Fri, 31 Aug 2018 17:42:31 +0000</created>
                <updated>Fri, 27 Oct 2023 20:43:17 +0000</updated>
                            <resolved>Fri, 27 Sep 2019 17:00:54 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="2436791" author="haley.connelly" created="Fri, 27 Sep 2019 16:59:23 +0000"  >&lt;p&gt;The current version of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e2875bb82ff99ffb27ccbcd68d596941a427f151/src/mongo/db/views/view_catalog.cpp#L544&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ViewCatalog::resolveView()&lt;/a&gt;  calls &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e2875bb82ff99ffb27ccbcd68d596941a427f151/src/mongo/db/views/view_catalog.cpp#L501&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;_lookup()&lt;/a&gt;, which no longer checks to see if the namespace is a valid collection name. Due to changes in the code, and since we still allow for views to be created on nonexistent collection namespaces, we believe this is no longer an issue and are closing the ticket. &lt;/p&gt;</comment>
                            <comment id="1992895" author="kyle.suarez" created="Tue, 4 Sep 2018 19:04:17 +0000"  >&lt;p&gt;James and I had an in-person conversation about this and threw around a few ideas:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;We thought about changing the statement in &lt;tt&gt;ViewCatalog::&amp;#95;lookup_inlock()&lt;/tt&gt; from &lt;tt&gt;if (!NamespaceString::validCollectionName(ns))&lt;/tt&gt; to &lt;tt&gt;invariant(NamespaceString::validCollectionName(ns)&lt;/tt&gt;. However, that probably won&apos;t be acceptable because it might cause the server to fail to start up in the presence of invalid views. CRUD commands like &lt;tt&gt;find&lt;/tt&gt; and &lt;tt&gt;aggregate&lt;/tt&gt; only perform namespace validation on the namespace of the originating command; they will &lt;em&gt;not&lt;/em&gt; validate any other namespaces encountered by the ViewCatalog.&lt;/li&gt;
	&lt;li&gt;A more &quot;correct&quot; fix might be to have &lt;tt&gt;ViewCatalog::&amp;#95;lookup_inlock()&lt;/tt&gt; return &lt;tt&gt;nullptr&lt;/tt&gt; &lt;b&gt;iff&lt;/b&gt; the name is not found in the &lt;tt&gt;ViewCatalog&lt;/tt&gt;. If the namespace is invalid, we throw with a special error code that callers can handle on a case-by-case basis. However, that will probably involve lots of changes to the &lt;tt&gt;AutoGet*&lt;/tt&gt; helpers and might not be worth the time.&lt;/li&gt;
	&lt;li&gt;My suggestion in the comment above to throw if the namespace is invalid &lt;b&gt;and&lt;/b&gt; the request came from a user connection seems a little hacky but should work for most purposes.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Since we haven&apos;t seen this code result in an actual bug for users or in our CI system, I would say it&apos;s best to not spend too much time on this if at all.&lt;/p&gt;</comment>
                            <comment id="1992779" author="kyle.suarez" created="Tue, 4 Sep 2018 17:49:29 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=james.wahlin&quot; class=&quot;user-hover&quot; rel=&quot;james.wahlin&quot;&gt;james.wahlin&lt;/a&gt;, I believe that view resolution only happens as part of user commands (that is, I don&apos;t think &lt;tt&gt;ViewCatalog::resolveView()&lt;/tt&gt; is ever called during the server startup path). Do you think it would be sufficient for &lt;tt&gt;ViewCatalog::_lookup_inlock()&lt;/tt&gt; to throw if the namespace is invalid &lt;b&gt;and&lt;/b&gt; the OperationContext indicates that the request comes from a user connection?&lt;/p&gt;</comment>
                            <comment id="1991062" author="james.wahlin@10gen.com" created="Fri, 31 Aug 2018 17:46:30 +0000"  >&lt;p&gt;As part of this we should audit other callers of ViewCatalog::_lookup_inlock() for potential issues.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 4 Sep 2018 17:49:29 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 19 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 19 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>haley.connelly@mongodb.com</customfieldvalue>
            <customfieldvalue>james.wahlin@mongodb.com</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu6wnr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huiatz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3212">Execution Team 2019-10-07</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Discovered via code inspection. Not sure if this can be reproduced externally.&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu6ix3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>