[COMPASS-4901] Compass overwrites appname field in connection string Created: 24/Jun/21  Updated: 10/Jan/24  Resolved: 14/Jul/21

Status: Closed
Project: Compass
Component/s: Connectivity
Affects Version/s: 1.26.1
Fix Version/s: 1.28.4

Type: Bug Priority: Minor - P4
Reporter: Nabil Boutemeur Assignee: Sergey Petushkov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Story Points: 1
Documentation Changes: Not Needed
Sprint: Iteration Firenze, Iteration Geneva

 Description   

Problem Statement/Rationale

Compass overwrites the appName field in connection string even when explicitly specified.

Steps to Reproduce

  • Open Compass
  • Connect to an instance with a connection string (doesn't need to specify) with or without an appname field
  • Disconnect to check the settings that were actually used
  • Note "&appname=MongoDB%20Compass" appears in the connection string, even if that field was specified with another value

Expected Results

I expect appname to keep its explicitly set value.

Actual Results

The appname field is added when omited, or overwritten with a value of "MongoDB%20Compass"

Additional Notes

Issue seems to come from https://github.com/mongodb-js/compass/blob/fe5fc2925a2621b2a69c9dc835de68da1a393be5/packages/compass/src/app/migrations/legacy-connection.js#L686

I suggest either removing these lines, or using the default value only if it wasn't specified explicitly in the connection string.



 Comments   
Comment by Nabil Boutemeur [ 28/Jun/21 ]

Hi Sergey Petushkov, thank you for the prompt reply.

Our use case is that in our company we have a software that uses the appname field to authenticate users (kind of as it's shown in this page, for realm) and provide additional features on top (mainly monitoring, but extensible to do just about anything).

However this issue makes Compass incompatible with this software and forces us to maintain an internal fork with a two-line patch.

I personally do not understand why the decision of not allowing this field to be overwritten when explicitly set was made, maybe you can bring us some light on this issue? I'm sorry as this probably comes out as an oddly specific edge-case that'd possibly only be convenient for our specific needs.

Thank you.

 

Comment by Sergey Petushkov [ 28/Jun/21 ]

Hey nabil.boutemeur@gmail.com, thanks for reporting the issue! This is currently "working as expected", but we would like to learn more why it might be important for you to override the appname argument with your own one. Can you share your use-case with us, please?

Comment by Nabil Boutemeur [ 25/Jun/21 ]

https://github.com/mongodb-js/compass/blob/0a0117d495043b291a14bc40aaae6f81ab50ff80/packages/compass-connect/src/stores/index.js#L995

Is actually the line that overwrites the appname field.

Generated at Wed Feb 07 22:37:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.