[SERVER-50266] Unfriendly formatting for setParameter help Created: 12/Aug/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Shell
Affects Version/s: 4.0.19, 4.2.8, 4.4.0
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Ramon Fernandez Marina Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Sprint: Security 2020-09-21
Participants:

 Description   

Reproduces in 4.4.0:

replset:PRIMARY> db.runCommand({setParameter:1, help:true})
{
        "help" : "help for: setParameter set administrative option(s)\n{ setParameter:1, <param>:<value> }\nsupported:\n  AlwaysRecordTraffic\n  KeysRotationIntervalSec\n  ShardingTaskExecutorPoolHostTimeoutMS\n  ShardingTaskExecutorPoolMaxConnecting\n  ShardingTaskExecutorPoolMaxSize\n  ShardingTaskExecutorPoolMinSize\n  ShardingTaskExecutorPoolRefreshRequirementMS\n  ShardingTaskExecutorPoolRefreshTimeoutMS\n  ShardingTaskExecutorPoolReplicaSetMatching\n  TransactionRecordMinimumLifetimeMinutes\n  adaptiveServiceExecutorIdlePctThreshold\n  adaptiveServiceExecutorMaxQueueLatencyMicros\n  adaptiveServiceExecutorRecursionLimit\n  adaptiveServiceExecutorReservedThreads\n  adaptiveServiceExecutorRunTimeJitterMillis\n  adaptiveServiceExecutorRunTimeMillis\n  adaptiveServiceExecutorStuckThreadTimeoutMillis\n  allowRolesFromX509Certificates\n  allowSecondaryReadsDuringBatchApplication\n  assertStableTimestampEqualsAppliedThroughOnRecovery\n  authSchemaVersion\n  authenticationMechanisms\n  authorizationManagerCacheSize\n  authorizationManagerPinnedUsers\n  authorizationManagerPinnedUsersRefreshIntervalMillis\n  automationServiceDescriptor\n  awsEC2InstanceMetadataUrl\n  awsECSInstanceMetadataUrl\n  bgSyncOplogFetcherBatchSize\n  cachePressureThreshold\n  checkCachePressurePeriodSeconds\n  clientCursorMonitorFrequencySecs\n  cloudFreeMonitoringEndpointURL\n  clusterAuthMode\n  collectionBulkLoaderBatchSizeInBytes\n  collectionClonerBatchSize\n  collectionClonerUsesExhaust\n  connPoolMaxConnsPerHost\n  connPoolMaxInUseConnsPerHost\n  connPoolMaxShardedConnsPerHost\n  connPoolMaxShardedInUseConnsPerHost\n  connectTimeoutMs\n  createRollbackDataFiles\n  cursorTimeoutMillis\n  diagnosticDataCollectionDirectoryPath\n  diagnosticDataCollectionDirectorySizeMB\n  diagnosticDataCollectionEnableLatencyHistograms\n  diagnosticDataCollectionEnabled\n  diagnosticDataCollectionFileSizeMB\n  diagnosticDataCollectionPeriodMillis\n  diagnosticDataCollectionSamplesPerChunk\n  diagnosticDataCollectionSamplesPerInterimUpdate\n  disableJavaScriptJIT\n  disableLogicalSessionCacheRefresh\n  disableNonSSLConnectionLogging\n  disableNonTLSConnectionLogging\n  disableResumableRangeDeleter\n  disabledSecureAllocatorDomains\n  enableElectionHandoff\n  enableFinerGrainedCatalogCacheRefresh\n  enableFlowControl\n  enableHybridIndexBuilds\n  enableIndexBuildCommitQuorum\n  enableLocalhostAuthBypass\n  enableSafeReplicaSetReconfig\n  enableShardedIndexConsistencyCheck\n  enableTestCommands\n  enableTwoPhaseIndexBuild\n  featureCompatibilityVersion\n  flowControlDecayConstant\n  flowControlFudgeFactor\n  flowControlMaxSamples\n  flowControlMinTicketsPerSecond\n  flowControlSamplePeriod\n  flowControlTargetLagSeconds\n  flowControlThresholdLagPercentage\n  flowControlTicketAdderConstant\n  flowControlTicketMultiplierConstant\n  flowControlWarnThresholdSeconds\n  forceRollbackViaRefetch\n  globalConnPoolIdleTimeoutMinutes\n  heartBeatFrequencyMs\n  honorSystemUmask\n  initialSyncOplogBuffer\n  initialSyncOplogBufferPeekCacheSize\n  initialSyncOplogFetcherBatchSize\n  initialSyncSourceReadPreference\n  initialSyncTransientErrorRetryPeriodSeconds\n  internalDocumentSourceCursorBatchSizeBytes\n  internalDocumentSourceGroupMaxMemoryBytes\n  internalDocumentSourceLookupCacheSizeBytes\n  internalGeoNearQuery2DMaxCoveringCells\n  internalGeoPredicateQuery2DMaxCoveringCells\n  internalInsertMaxBatchSize\n  internalLookupStageIntermediateDocumentMaxSizeBytes\n  internalProhibitShardOperationRetry\n  internalQueryAllowShardedLookup\n  internalQueryAlwaysMergeOnPrimaryShard\n  internalQueryCacheDisableInactiveEntries\n  internalQueryCacheEvictionRatio\n  internalQueryCacheFeedbacksStored\n  internalQueryCacheSize\n  internalQueryCacheWorksGrowthCoefficient\n  internalQueryDesugarWhereToFunction\n  internalQueryDisableExchange\n  internalQueryEnumerationMaxIntersectPerAnd\n  internalQueryEnumerationMaxOrSolutions\n  internalQueryExecYieldIterations\n  internalQueryExecYieldPeriodMS\n  internalQueryFacetBufferSizeBytes\n  internalQueryForceIntersectionPlans\n  internalQueryIgnoreUnknownJSONSchemaKeywords\n  internalQueryJavaScriptFnTimeoutMillis\n  internalQueryJavaScriptHeapSizeLimitMB\n  internalQueryMaxAddToSetBytes\n  internalQueryMaxBlockingSortMemoryUsageBytes\n  internalQueryMaxJsEmitBytes\n  internalQueryMaxPushBytes\n  internalQueryMaxScansToExplode\n  internalQueryPlanEvaluationCollFraction\n  internalQueryPlanEvaluationMaxResults\n  internalQueryPlanEvaluationWorks\n  internalQueryPlanOrChildrenIndependently\n  internalQueryPlannerEnableHashIntersection\n  internalQueryPlannerEnableIndexIntersection\n  internalQueryPlannerGenerateCoveredWholeIndexScans\n  internalQueryPlannerMaxIndexedSolutions\n  internalQueryProhibitBlockingMergeOnMongoS\n  internalQueryProhibitMergingOnMongoS\n  internalQueryS2GeoCoarsestLevel\n  internalQueryS2GeoFinestLevel\n  internalQueryS2GeoMaxCells\n  internalValidateFeaturesAsMaster\n  javascriptProtection\n  journalCommitInterval\n  jsHeapLimitMB\n  loadRoutingTableOnStartup\n  localLogicalSessionTimeoutMinutes\n  localThresholdMs\n  logComponentVerbosity\n  logLevel\n  logicalSessionRefreshMillis\n  maxAcceptableLogicalClockDriftSecs\n  maxBSONDepth\n  maxIndexBuildDrainBatchSize\n  maxIndexBuildDrainMemoryUsageMegabytes\n  maxIndexBuildMemoryUsageMegabytes\n  maxLogSizeKB\n  maxNumActiveUserIndexBuilds\n  maxNumberOfTransactionOperationsInSingleOplogEntry\n  maxOplogTruncationPointsAfterStartup\n  maxOplogTruncationPointsDuringStartup\n  maxSessions\n  maxSyncSourceLagSecs\n  maxTargetSnapshotHistoryWindowInSeconds\n  maxTimeMSForHedgedReads\n  maxTransactionLockRequestTimeoutMillis\n  maxValidateMBperSec\n  migrateCloneInsertionBatchDelayMS\n  migrateCloneInsertionBatchSize\n  migrationLockAcquisitionMaxWaitMS\n  minMillisBetweenSnapshotWindowDec\n  minMillisBetweenSnapshotWindowInc\n  minNumChunksForSessionsCollection\n  minOplogTruncationPoints\n  mirrorReads\n  notablescan\n  numInitialSyncAttempts\n  numInitialSyncConnectAttempts\n  numInitialSyncOplogFindAttempts\n  ocspCacheSize\n  ocspEnabled\n  ocspValidationRefreshPeriodSecs\n  opensslCipherConfig\n  opensslDiffieHellmanParameters\n  oplogFetcherInitialSyncMaxFetcherRestarts\n  oplogFetcherSteadyStateMaxFetcherRestarts\n  oplogFetcherUsesExhaust\n  oplogInitialFindMaxSeconds\n  oplogNetworkTimeoutBufferSeconds\n  oplogRetriedFindMaxSeconds\n  oplogSamplingLogIntervalSeconds\n  oplogTruncationPointSizeMB\n  orphanCleanupDelaySecs\n  periodicNoopIntervalSecs\n  priorityTakeoverFreshnessWindowSeconds\n  processUmask\n  quiet\n  rangeDeleterBatchDelayMS\n  rangeDeleterBatchSize\n  readHedgingMode\n  recoverFromOplogAsStandalone\n  recoverToOplogTimestamp\n  replBatchLimitBytes\n  replBatchLimitOperations\n  replElectionTimeoutOffsetLimitFraction\n  replWriterThreadCount\n  replicaSetMonitorProtocol\n  reportOpWriteConcernCountersInServerStatus\n  reservedServiceExecutorRecursionLimit\n  roleGraphInvalidationIsFatal\n  rollbackRemoteOplogQueryBatchSize\n  rollbackTimeLimitSecs\n  saslHostName\n  saslServiceName\n  saslauthdPath\n  scramIterationCount\n  scramSHA256IterationCount\n  scriptingEngineInterruptIntervalMS\n  shardedConnPoolIdleTimeoutMinutes\n  shardedIndexConsistencyCheckIntervalMS\n  shouldMultiDocTxnCreateCollectionAndIndexes\n  skipCorruptDocumentsWhenCloning\n  skipShardingConfigurationChecks\n  skipShellCursorFinalize\n  snapshotWindowAdditiveIncreaseSeconds\n  snapshotWindowMultiplicativeDecrease\n  sslMode\n  sslWithholdClientCertificate\n  startupAuthSchemaValidation\n  suppressNoTLSPeerCertificateWarning\n  syncdelay\n  synchronousServiceExecutorRecursionLimit\n  takeUnstableCheckpointOnShutdown\n  taskExecutorPoolSize\n  tcpFastOpenClient\n  tcpFastOpenQueueSize\n  tcpFastOpenServer\n  testingSnapshotBehaviorInIsolation\n  tlsMode\n  tlsOCSPStaplingTimeoutSecs\n  tlsOCSPVerifyTimeoutSecs\n  tlsWithholdClientCertificate\n  tlsX509ClusterAuthDNOverride\n  tlsX509ExpirationWarningThresholdDays\n  traceExceptions\n  traceWriteConflictExceptions\n  trafficRecordingDirectory\n  transactionLifetimeLimitSeconds\n  transactionSizeLimitBytes\n  ttlMonitorEnabled\n  ttlMonitorSleepSecs\n  useReadOnceCursorsForIndexBuilds\n  waitForSecondaryBeforeNoopWriteMS\n  waitForStepDownOnNonCommandShutdown\n  warmMinConnectionsInShardingTaskExecutorPoolOnStartup\n  warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS\n  watchdogPeriodSeconds\n  wiredTigerConcurrentReadTransactions\n  wiredTigerConcurrentWriteTransactions\n  wiredTigerCursorCacheSize\n  wiredTigerEngineRuntimeConfig\n  wiredTigerFileHandleCloseIdleTime\n  wiredTigerFileHandleCloseMinimum\n  wiredTigerFileHandleCloseScanInterval\n  wiredTigerMaxCacheOverflowSizeGB\n  wiredTigerSessionCloseIdleTimeSecs\n  writePeriodicNoops\n",
        "ok" : 1
}



 Comments   
Comment by Judah Schvimer [ 01/Jun/21 ]

Thanks kelsey.schubert! This behavior is not intended, but also is in the Server, not the Shell, so mongosh is not the appropriate home. We're putting this back on the backlog as a future minor improvement.

Comment by Kelsey Schubert [ 26/May/21 ]

Reopening to get clarity around whether this behavior is intended? I think so, but then I would expected this ticket to be closed as "Works as Designed"

If it is intended, it probably make make sense to move this ticket to mongosh to be considered against their backlog since that shell is the one we are focusing efforts on making more user-friendly.

Comment by Ramon Fernandez Marina [ 12/Aug/20 ]

var runCommandHelp = function(doc) {
    doc.help = true;
    output = db.runCommand(doc);
    print(output.help);
}

Problem solved – I can now run runCommandHelp({setParameter:1}).

Comment by Eric Sedor [ 12/Aug/20 ]

A workaround is:

> db.runCommand({setParameter:1,help:1}).help

Perhaps the right behavior is for the runCommand wrapper to return .help when help:true is included in the command body?

Comment by Ramon Fernandez Marina [ 12/Aug/20 ]

No, not a regression – I just tested with 2.6.0 and the behavior is the same. I get the part of it being proper json, but it would be nice if there was a way to display help in the shell nicely. Maybe the answer is not to change this in any way, but to have a shell helper? I'd be surprised if there was not one hanging around somewhere that I can put on my .mongorc.js and close this as WaD...

Comment by Bruce Lucas (Inactive) [ 12/Aug/20 ]

Is this a regression? Quick test seems to show similar behavior in 4.2, or am I mistaken?

Is help:true intended be used in raw form like that, or is it meant to be used from the shell via db.help() or the like?

Comment by Eric Sedor [ 12/Aug/20 ]

Thanks ramon.fernandez;

Other less verbose help is still technically impacted by this; for example:

replset:PRIMARY> db.runCommand({isMaster:1,help:true})
{
	"help" : "help for: isMaster Check if this server is primary for a replica set\n{ isMaster : 1 }",
	"ok" : 1
}

This is probably the right behavior when logging response json in the shell, so we may need to explore how help is formatted for shell purposes.

Generated at Thu Feb 08 05:22:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.