[CDRIVER-2141] Do not allow appname URI option to be set by mongoc_uri_set_option_as_utf8() Created: 24/Apr/17  Updated: 28/Oct/23  Resolved: 24/Apr/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.5.0, 1.6.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: Hannes Magnusson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-1388 Warn on unsupported URI options Closed
is related to CDRIVER-1392 Add support for appname in connection... Closed

 Description   

Since mongoc_uri_option_is_utf8() returns true for "appname", a value may be assigned through mongoc_uri_set_option_as_utf8(), which will bypass the length validation done in mongoc_uri_set_appname(). This seems like an edge case that should be closed.

I'm not sure if this poses a BC break, since previous versions of libmongoc (1.5 and 1.6) would default to return true from mongoc_uri_option_is_utf8() unless the option was a boolean, integer, or appeared in a blacklist. For 1.7, the function was changed to use a whitelist of known options, which included "appname" (16d03dc).



 Comments   
Comment by Githook User [ 25/Apr/17 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'hannes.magnusson@gmail.com'}

Message: Merge pull request #435 from jmikola/cdriver-2142

CDRIVER-2141: Set error if authSource is invalid GSSAPI and X509
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ea6d8eea992fc0209a97377f02138ffc85dce585

Comment by Githook User [ 25/Apr/17 ]

Author:

{u'username': u'jmikola', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'}

Message: CDRIVER-2141: Set error if authSource is invalid GSSAPI and X509
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5beb35b31f630d1c23b6127e5df8d4fb65fa135f

Comment by Githook User [ 24/Apr/17 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-2141 Fix appname set through mongoc_uri_set_option_as_utf8

Validation logic for appname isn't enforced when setting through _as_utf8
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/baaf3dff5d8fc55dcc3483072e92d9f66fd94a9c

Generated at Wed Feb 07 21:14:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.