...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/redacted-commands.json

Documentation: go.mongodb.org/mongo-driver/testdata/command-monitoring

     1{
     2  "description": "redacted-commands",
     3  "schemaVersion": "1.5",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "5.0",
     7      "auth": false
     8    }
     9  ],
    10  "createEntities": [
    11    {
    12      "client": {
    13        "id": "client",
    14        "observeEvents": [
    15          "commandStartedEvent",
    16          "commandSucceededEvent"
    17        ],
    18        "observeSensitiveCommands": true
    19      }
    20    },
    21    {
    22      "database": {
    23        "id": "database",
    24        "client": "client",
    25        "databaseName": "command-monitoring-tests"
    26      }
    27    }
    28  ],
    29  "tests": [
    30    {
    31      "description": "authenticate",
    32      "operations": [
    33        {
    34          "name": "runCommand",
    35          "object": "database",
    36          "arguments": {
    37            "commandName": "authenticate",
    38            "command": {
    39              "authenticate": 1,
    40              "mechanism": "MONGODB-X509",
    41              "user": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
    42              "db": "$external"
    43            }
    44          },
    45          "expectError": {
    46            "isError": true
    47          }
    48        }
    49      ],
    50      "expectEvents": [
    51        {
    52          "client": "client",
    53          "events": [
    54            {
    55              "commandStartedEvent": {
    56                "commandName": "authenticate",
    57                "command": {
    58                  "authenticate": {
    59                    "$$exists": false
    60                  },
    61                  "mechanism": {
    62                    "$$exists": false
    63                  },
    64                  "user": {
    65                    "$$exists": false
    66                  },
    67                  "db": {
    68                    "$$exists": false
    69                  }
    70                }
    71              }
    72            }
    73          ]
    74        }
    75      ]
    76    },
    77    {
    78      "description": "saslStart",
    79      "operations": [
    80        {
    81          "name": "runCommand",
    82          "object": "database",
    83          "arguments": {
    84            "commandName": "saslStart",
    85            "command": {
    86              "saslStart": 1,
    87              "payload": "definitely-invalid-payload",
    88              "db": "admin"
    89            }
    90          },
    91          "expectError": {
    92            "isError": true
    93          }
    94        }
    95      ],
    96      "expectEvents": [
    97        {
    98          "client": "client",
    99          "events": [
   100            {
   101              "commandStartedEvent": {
   102                "commandName": "saslStart",
   103                "command": {
   104                  "saslStart": {
   105                    "$$exists": false
   106                  },
   107                  "payload": {
   108                    "$$exists": false
   109                  },
   110                  "db": {
   111                    "$$exists": false
   112                  }
   113                }
   114              }
   115            }
   116          ]
   117        }
   118      ]
   119    },
   120    {
   121      "description": "saslContinue",
   122      "operations": [
   123        {
   124          "name": "runCommand",
   125          "object": "database",
   126          "arguments": {
   127            "commandName": "saslContinue",
   128            "command": {
   129              "saslContinue": 1,
   130              "conversationId": 0,
   131              "payload": "definitely-invalid-payload"
   132            }
   133          },
   134          "expectError": {
   135            "isError": true
   136          }
   137        }
   138      ],
   139      "expectEvents": [
   140        {
   141          "client": "client",
   142          "events": [
   143            {
   144              "commandStartedEvent": {
   145                "commandName": "saslContinue",
   146                "command": {
   147                  "saslContinue": {
   148                    "$$exists": false
   149                  },
   150                  "conversationId": {
   151                    "$$exists": false
   152                  },
   153                  "payload": {
   154                    "$$exists": false
   155                  }
   156                }
   157              }
   158            }
   159          ]
   160        }
   161      ]
   162    },
   163    {
   164      "description": "getnonce",
   165      "runOnRequirements": [
   166        {
   167          "maxServerVersion": "6.1.99"
   168        }
   169      ],
   170      "operations": [
   171        {
   172          "name": "runCommand",
   173          "object": "database",
   174          "arguments": {
   175            "commandName": "getnonce",
   176            "command": {
   177              "getnonce": 1
   178            }
   179          }
   180        }
   181      ],
   182      "expectEvents": [
   183        {
   184          "client": "client",
   185          "events": [
   186            {
   187              "commandStartedEvent": {
   188                "commandName": "getnonce",
   189                "command": {
   190                  "getnonce": {
   191                    "$$exists": false
   192                  }
   193                }
   194              }
   195            },
   196            {
   197              "commandSucceededEvent": {
   198                "commandName": "getnonce",
   199                "reply": {
   200                  "ok": {
   201                    "$$exists": false
   202                  },
   203                  "nonce": {
   204                    "$$exists": false
   205                  }
   206                }
   207              }
   208            }
   209          ]
   210        }
   211      ]
   212    },
   213    {
   214      "description": "createUser",
   215      "operations": [
   216        {
   217          "name": "runCommand",
   218          "object": "database",
   219          "arguments": {
   220            "commandName": "createUser",
   221            "command": {
   222              "createUser": "private",
   223              "pwd": {},
   224              "roles": []
   225            }
   226          },
   227          "expectError": {
   228            "isError": true
   229          }
   230        }
   231      ],
   232      "expectEvents": [
   233        {
   234          "client": "client",
   235          "events": [
   236            {
   237              "commandStartedEvent": {
   238                "commandName": "createUser",
   239                "command": {
   240                  "createUser": {
   241                    "$$exists": false
   242                  },
   243                  "pwd": {
   244                    "$$exists": false
   245                  },
   246                  "roles": {
   247                    "$$exists": false
   248                  }
   249                }
   250              }
   251            }
   252          ]
   253        }
   254      ]
   255    },
   256    {
   257      "description": "updateUser",
   258      "operations": [
   259        {
   260          "name": "runCommand",
   261          "object": "database",
   262          "arguments": {
   263            "commandName": "updateUser",
   264            "command": {
   265              "updateUser": "private",
   266              "pwd": {},
   267              "roles": []
   268            }
   269          },
   270          "expectError": {
   271            "isError": true
   272          }
   273        }
   274      ],
   275      "expectEvents": [
   276        {
   277          "client": "client",
   278          "events": [
   279            {
   280              "commandStartedEvent": {
   281                "commandName": "updateUser",
   282                "command": {
   283                  "updateUser": {
   284                    "$$exists": false
   285                  },
   286                  "pwd": {
   287                    "$$exists": false
   288                  },
   289                  "roles": {
   290                    "$$exists": false
   291                  }
   292                }
   293              }
   294            }
   295          ]
   296        }
   297      ]
   298    },
   299    {
   300      "description": "copydbgetnonce",
   301      "runOnRequirements": [
   302        {
   303          "maxServerVersion": "3.6.99"
   304        }
   305      ],
   306      "operations": [
   307        {
   308          "name": "runCommand",
   309          "object": "database",
   310          "arguments": {
   311            "commandName": "copydbgetnonce",
   312            "command": {
   313              "copydbgetnonce": "private"
   314            }
   315          },
   316          "expectError": {
   317            "isError": true
   318          }
   319        }
   320      ],
   321      "expectEvents": [
   322        {
   323          "client": "client",
   324          "events": [
   325            {
   326              "commandStartedEvent": {
   327                "commandName": "copydbgetnonce",
   328                "command": {
   329                  "copydbgetnonce": {
   330                    "$$exists": false
   331                  }
   332                }
   333              }
   334            }
   335          ]
   336        }
   337      ]
   338    },
   339    {
   340      "description": "copydbsaslstart",
   341      "runOnRequirements": [
   342        {
   343          "maxServerVersion": "4.0.99"
   344        }
   345      ],
   346      "operations": [
   347        {
   348          "name": "runCommand",
   349          "object": "database",
   350          "arguments": {
   351            "commandName": "copydbsaslstart",
   352            "command": {
   353              "copydbsaslstart": "private"
   354            }
   355          },
   356          "expectError": {
   357            "isError": true
   358          }
   359        }
   360      ],
   361      "expectEvents": [
   362        {
   363          "client": "client",
   364          "events": [
   365            {
   366              "commandStartedEvent": {
   367                "commandName": "copydbsaslstart",
   368                "command": {
   369                  "copydbsaslstart": {
   370                    "$$exists": false
   371                  }
   372                }
   373              }
   374            }
   375          ]
   376        }
   377      ]
   378    },
   379    {
   380      "description": "copydb",
   381      "runOnRequirements": [
   382        {
   383          "maxServerVersion": "4.0.99"
   384        }
   385      ],
   386      "operations": [
   387        {
   388          "name": "runCommand",
   389          "object": "database",
   390          "arguments": {
   391            "commandName": "copydb",
   392            "command": {
   393              "copydb": "private"
   394            }
   395          },
   396          "expectError": {
   397            "isError": true
   398          }
   399        }
   400      ],
   401      "expectEvents": [
   402        {
   403          "client": "client",
   404          "events": [
   405            {
   406              "commandStartedEvent": {
   407                "commandName": "copydb",
   408                "command": {
   409                  "copydb": {
   410                    "$$exists": false
   411                  }
   412                }
   413              }
   414            }
   415          ]
   416        }
   417      ]
   418    },
   419    {
   420      "description": "hello with speculative authenticate",
   421      "runOnRequirements": [
   422        {
   423          "minServerVersion": "4.9"
   424        }
   425      ],
   426      "operations": [
   427        {
   428          "name": "runCommand",
   429          "object": "database",
   430          "arguments": {
   431            "commandName": "hello",
   432            "command": {
   433              "hello": 1,
   434              "speculativeAuthenticate": {
   435                "saslStart": 1
   436              }
   437            }
   438          }
   439        }
   440      ],
   441      "expectEvents": [
   442        {
   443          "client": "client",
   444          "events": [
   445            {
   446              "commandStartedEvent": {
   447                "commandName": "hello",
   448                "command": {
   449                  "hello": {
   450                    "$$exists": false
   451                  },
   452                  "speculativeAuthenticate": {
   453                    "$$exists": false
   454                  }
   455                }
   456              }
   457            },
   458            {
   459              "commandSucceededEvent": {
   460                "commandName": "hello",
   461                "reply": {
   462                  "isWritablePrimary": {
   463                    "$$exists": false
   464                  },
   465                  "speculativeAuthenticate": {
   466                    "$$exists": false
   467                  }
   468                }
   469              }
   470            }
   471          ]
   472        }
   473      ]
   474    },
   475    {
   476      "description": "legacy hello with speculative authenticate",
   477      "operations": [
   478        {
   479          "name": "runCommand",
   480          "object": "database",
   481          "arguments": {
   482            "commandName": "ismaster",
   483            "command": {
   484              "ismaster": 1,
   485              "speculativeAuthenticate": {
   486                "saslStart": 1
   487              }
   488            }
   489          }
   490        },
   491        {
   492          "name": "runCommand",
   493          "object": "database",
   494          "arguments": {
   495            "commandName": "isMaster",
   496            "command": {
   497              "isMaster": 1,
   498              "speculativeAuthenticate": {
   499                "saslStart": 1
   500              }
   501            }
   502          }
   503        }
   504      ],
   505      "expectEvents": [
   506        {
   507          "client": "client",
   508          "events": [
   509            {
   510              "commandStartedEvent": {
   511                "commandName": "ismaster",
   512                "command": {
   513                  "ismaster": {
   514                    "$$exists": false
   515                  },
   516                  "speculativeAuthenticate": {
   517                    "$$exists": false
   518                  }
   519                }
   520              }
   521            },
   522            {
   523              "commandSucceededEvent": {
   524                "commandName": "ismaster",
   525                "reply": {
   526                  "ismaster": {
   527                    "$$exists": false
   528                  },
   529                  "speculativeAuthenticate": {
   530                    "$$exists": false
   531                  }
   532                }
   533              }
   534            },
   535            {
   536              "commandStartedEvent": {
   537                "commandName": "isMaster",
   538                "command": {
   539                  "isMaster": {
   540                    "$$exists": false
   541                  },
   542                  "speculativeAuthenticate": {
   543                    "$$exists": false
   544                  }
   545                }
   546              }
   547            },
   548            {
   549              "commandSucceededEvent": {
   550                "commandName": "isMaster",
   551                "reply": {
   552                  "ismaster": {
   553                    "$$exists": false
   554                  },
   555                  "speculativeAuthenticate": {
   556                    "$$exists": false
   557                  }
   558                }
   559              }
   560            }
   561          ]
   562        }
   563      ]
   564    },
   565    {
   566      "description": "hello without speculative authenticate is not redacted",
   567      "runOnRequirements": [
   568        {
   569          "minServerVersion": "4.9"
   570        }
   571      ],
   572      "operations": [
   573        {
   574          "name": "runCommand",
   575          "object": "database",
   576          "arguments": {
   577            "commandName": "hello",
   578            "command": {
   579              "hello": 1
   580            }
   581          }
   582        }
   583      ],
   584      "expectEvents": [
   585        {
   586          "client": "client",
   587          "events": [
   588            {
   589              "commandStartedEvent": {
   590                "commandName": "hello",
   591                "command": {
   592                  "hello": 1
   593                }
   594              }
   595            },
   596            {
   597              "commandSucceededEvent": {
   598                "commandName": "hello",
   599                "reply": {
   600                  "isWritablePrimary": {
   601                    "$$exists": true
   602                  }
   603                }
   604              }
   605            }
   606          ]
   607        }
   608      ]
   609    },
   610    {
   611      "description": "legacy hello without speculative authenticate is not redacted",
   612      "operations": [
   613        {
   614          "name": "runCommand",
   615          "object": "database",
   616          "arguments": {
   617            "commandName": "ismaster",
   618            "command": {
   619              "ismaster": 1
   620            }
   621          }
   622        },
   623        {
   624          "name": "runCommand",
   625          "object": "database",
   626          "arguments": {
   627            "commandName": "isMaster",
   628            "command": {
   629              "isMaster": 1
   630            }
   631          }
   632        }
   633      ],
   634      "expectEvents": [
   635        {
   636          "client": "client",
   637          "events": [
   638            {
   639              "commandStartedEvent": {
   640                "commandName": "ismaster",
   641                "command": {
   642                  "ismaster": 1
   643                }
   644              }
   645            },
   646            {
   647              "commandSucceededEvent": {
   648                "commandName": "ismaster",
   649                "reply": {
   650                  "ismaster": {
   651                    "$$exists": true
   652                  }
   653                }
   654              }
   655            },
   656            {
   657              "commandStartedEvent": {
   658                "commandName": "isMaster",
   659                "command": {
   660                  "isMaster": 1
   661                }
   662              }
   663            },
   664            {
   665              "commandSucceededEvent": {
   666                "commandName": "isMaster",
   667                "reply": {
   668                  "ismaster": {
   669                    "$$exists": true
   670                  }
   671                }
   672              }
   673            }
   674          ]
   675        }
   676      ]
   677    }
   678  ]
   679}

View as plain text