...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/validatorAndPartialFieldExpression.json

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy

     1{
     2  "runOn": [
     3    {
     4      "minServerVersion": "6.0.0"
     5    }
     6  ],
     7  "database_name": "default",
     8  "collection_name": "default",
     9  "data": [],
    10  "tests": [
    11    {
    12      "description": "create with a validator on an unencrypted field is OK",
    13      "clientOptions": {
    14        "autoEncryptOpts": {
    15          "kmsProviders": {
    16            "local": {
    17              "key": {
    18                "$binary": {
    19                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
    20                  "subType": "00"
    21                }
    22              }
    23            }
    24          },
    25          "schemaMap": {
    26            "default.encryptedCollection": {
    27              "properties": {
    28                "encrypted_w_altname": {
    29                  "encrypt": {
    30                    "keyId": "/altname",
    31                    "bsonType": "string",
    32                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
    33                  }
    34                },
    35                "encrypted_string": {
    36                  "encrypt": {
    37                    "keyId": [
    38                      {
    39                        "$binary": {
    40                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
    41                          "subType": "04"
    42                        }
    43                      }
    44                    ],
    45                    "bsonType": "string",
    46                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
    47                  }
    48                },
    49                "random": {
    50                  "encrypt": {
    51                    "keyId": [
    52                      {
    53                        "$binary": {
    54                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
    55                          "subType": "04"
    56                        }
    57                      }
    58                    ],
    59                    "bsonType": "string",
    60                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
    61                  }
    62                },
    63                "encrypted_string_equivalent": {
    64                  "encrypt": {
    65                    "keyId": [
    66                      {
    67                        "$binary": {
    68                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
    69                          "subType": "04"
    70                        }
    71                      }
    72                    ],
    73                    "bsonType": "string",
    74                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
    75                  }
    76                }
    77              },
    78              "bsonType": "object"
    79            }
    80          }
    81        }
    82      },
    83      "operations": [
    84        {
    85          "name": "dropCollection",
    86          "object": "database",
    87          "arguments": {
    88            "collection": "encryptedCollection"
    89          }
    90        },
    91        {
    92          "name": "createCollection",
    93          "object": "database",
    94          "arguments": {
    95            "collection": "encryptedCollection",
    96            "validator": {
    97              "unencrypted_string": "foo"
    98            }
    99          }
   100        },
   101        {
   102          "name": "assertCollectionExists",
   103          "object": "testRunner",
   104          "arguments": {
   105            "database": "default",
   106            "collection": "encryptedCollection"
   107          }
   108        }
   109      ]
   110    },
   111    {
   112      "description": "create with a validator on an encrypted field is an error",
   113      "clientOptions": {
   114        "autoEncryptOpts": {
   115          "kmsProviders": {
   116            "local": {
   117              "key": {
   118                "$binary": {
   119                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   120                  "subType": "00"
   121                }
   122              }
   123            }
   124          },
   125          "schemaMap": {
   126            "default.encryptedCollection": {
   127              "properties": {
   128                "encrypted_w_altname": {
   129                  "encrypt": {
   130                    "keyId": "/altname",
   131                    "bsonType": "string",
   132                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   133                  }
   134                },
   135                "encrypted_string": {
   136                  "encrypt": {
   137                    "keyId": [
   138                      {
   139                        "$binary": {
   140                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   141                          "subType": "04"
   142                        }
   143                      }
   144                    ],
   145                    "bsonType": "string",
   146                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   147                  }
   148                },
   149                "random": {
   150                  "encrypt": {
   151                    "keyId": [
   152                      {
   153                        "$binary": {
   154                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   155                          "subType": "04"
   156                        }
   157                      }
   158                    ],
   159                    "bsonType": "string",
   160                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   161                  }
   162                },
   163                "encrypted_string_equivalent": {
   164                  "encrypt": {
   165                    "keyId": [
   166                      {
   167                        "$binary": {
   168                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   169                          "subType": "04"
   170                        }
   171                      }
   172                    ],
   173                    "bsonType": "string",
   174                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   175                  }
   176                }
   177              },
   178              "bsonType": "object"
   179            }
   180          }
   181        }
   182      },
   183      "operations": [
   184        {
   185          "name": "dropCollection",
   186          "object": "database",
   187          "arguments": {
   188            "collection": "encryptedCollection"
   189          }
   190        },
   191        {
   192          "name": "createCollection",
   193          "object": "database",
   194          "arguments": {
   195            "collection": "encryptedCollection",
   196            "validator": {
   197              "encrypted_string": "foo"
   198            }
   199          },
   200          "result": {
   201            "errorContains": "Comparison to encrypted fields not supported"
   202          }
   203        }
   204      ]
   205    },
   206    {
   207      "description": "collMod with a validator on an unencrypted field is OK",
   208      "clientOptions": {
   209        "autoEncryptOpts": {
   210          "kmsProviders": {
   211            "local": {
   212              "key": {
   213                "$binary": {
   214                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   215                  "subType": "00"
   216                }
   217              }
   218            }
   219          },
   220          "schemaMap": {
   221            "default.encryptedCollection": {
   222              "properties": {
   223                "encrypted_w_altname": {
   224                  "encrypt": {
   225                    "keyId": "/altname",
   226                    "bsonType": "string",
   227                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   228                  }
   229                },
   230                "encrypted_string": {
   231                  "encrypt": {
   232                    "keyId": [
   233                      {
   234                        "$binary": {
   235                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   236                          "subType": "04"
   237                        }
   238                      }
   239                    ],
   240                    "bsonType": "string",
   241                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   242                  }
   243                },
   244                "random": {
   245                  "encrypt": {
   246                    "keyId": [
   247                      {
   248                        "$binary": {
   249                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   250                          "subType": "04"
   251                        }
   252                      }
   253                    ],
   254                    "bsonType": "string",
   255                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   256                  }
   257                },
   258                "encrypted_string_equivalent": {
   259                  "encrypt": {
   260                    "keyId": [
   261                      {
   262                        "$binary": {
   263                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   264                          "subType": "04"
   265                        }
   266                      }
   267                    ],
   268                    "bsonType": "string",
   269                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   270                  }
   271                }
   272              },
   273              "bsonType": "object"
   274            }
   275          }
   276        }
   277      },
   278      "operations": [
   279        {
   280          "name": "dropCollection",
   281          "object": "database",
   282          "arguments": {
   283            "collection": "encryptedCollection"
   284          }
   285        },
   286        {
   287          "name": "createCollection",
   288          "object": "database",
   289          "arguments": {
   290            "collection": "encryptedCollection"
   291          }
   292        },
   293        {
   294          "name": "runCommand",
   295          "object": "database",
   296          "arguments": {
   297            "command": {
   298              "collMod": "encryptedCollection",
   299              "validator": {
   300                "unencrypted_string": "foo"
   301              }
   302            }
   303          }
   304        }
   305      ]
   306    },
   307    {
   308      "description": "collMod with a validator on an encrypted field is an error",
   309      "clientOptions": {
   310        "autoEncryptOpts": {
   311          "kmsProviders": {
   312            "local": {
   313              "key": {
   314                "$binary": {
   315                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   316                  "subType": "00"
   317                }
   318              }
   319            }
   320          },
   321          "schemaMap": {
   322            "default.encryptedCollection": {
   323              "properties": {
   324                "encrypted_w_altname": {
   325                  "encrypt": {
   326                    "keyId": "/altname",
   327                    "bsonType": "string",
   328                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   329                  }
   330                },
   331                "encrypted_string": {
   332                  "encrypt": {
   333                    "keyId": [
   334                      {
   335                        "$binary": {
   336                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   337                          "subType": "04"
   338                        }
   339                      }
   340                    ],
   341                    "bsonType": "string",
   342                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   343                  }
   344                },
   345                "random": {
   346                  "encrypt": {
   347                    "keyId": [
   348                      {
   349                        "$binary": {
   350                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   351                          "subType": "04"
   352                        }
   353                      }
   354                    ],
   355                    "bsonType": "string",
   356                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   357                  }
   358                },
   359                "encrypted_string_equivalent": {
   360                  "encrypt": {
   361                    "keyId": [
   362                      {
   363                        "$binary": {
   364                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   365                          "subType": "04"
   366                        }
   367                      }
   368                    ],
   369                    "bsonType": "string",
   370                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   371                  }
   372                }
   373              },
   374              "bsonType": "object"
   375            }
   376          }
   377        }
   378      },
   379      "operations": [
   380        {
   381          "name": "dropCollection",
   382          "object": "database",
   383          "arguments": {
   384            "collection": "encryptedCollection"
   385          }
   386        },
   387        {
   388          "name": "createCollection",
   389          "object": "database",
   390          "arguments": {
   391            "collection": "encryptedCollection"
   392          }
   393        },
   394        {
   395          "name": "runCommand",
   396          "object": "database",
   397          "arguments": {
   398            "command": {
   399              "collMod": "encryptedCollection",
   400              "validator": {
   401                "encrypted_string": "foo"
   402              }
   403            }
   404          },
   405          "result": {
   406            "errorContains": "Comparison to encrypted fields not supported"
   407          }
   408        }
   409      ]
   410    },
   411    {
   412      "description": "createIndexes with a partialFilterExpression on an unencrypted field is OK",
   413      "clientOptions": {
   414        "autoEncryptOpts": {
   415          "kmsProviders": {
   416            "local": {
   417              "key": {
   418                "$binary": {
   419                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   420                  "subType": "00"
   421                }
   422              }
   423            }
   424          },
   425          "schemaMap": {
   426            "default.encryptedCollection": {
   427              "properties": {
   428                "encrypted_w_altname": {
   429                  "encrypt": {
   430                    "keyId": "/altname",
   431                    "bsonType": "string",
   432                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   433                  }
   434                },
   435                "encrypted_string": {
   436                  "encrypt": {
   437                    "keyId": [
   438                      {
   439                        "$binary": {
   440                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   441                          "subType": "04"
   442                        }
   443                      }
   444                    ],
   445                    "bsonType": "string",
   446                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   447                  }
   448                },
   449                "random": {
   450                  "encrypt": {
   451                    "keyId": [
   452                      {
   453                        "$binary": {
   454                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   455                          "subType": "04"
   456                        }
   457                      }
   458                    ],
   459                    "bsonType": "string",
   460                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   461                  }
   462                },
   463                "encrypted_string_equivalent": {
   464                  "encrypt": {
   465                    "keyId": [
   466                      {
   467                        "$binary": {
   468                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   469                          "subType": "04"
   470                        }
   471                      }
   472                    ],
   473                    "bsonType": "string",
   474                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   475                  }
   476                }
   477              },
   478              "bsonType": "object"
   479            }
   480          }
   481        }
   482      },
   483      "operations": [
   484        {
   485          "name": "dropCollection",
   486          "object": "database",
   487          "arguments": {
   488            "collection": "encryptedCollection"
   489          }
   490        },
   491        {
   492          "name": "createCollection",
   493          "object": "database",
   494          "arguments": {
   495            "collection": "encryptedCollection"
   496          }
   497        },
   498        {
   499          "name": "runCommand",
   500          "object": "database",
   501          "arguments": {
   502            "command": {
   503              "createIndexes": "encryptedCollection",
   504              "indexes": [
   505                {
   506                  "name": "name",
   507                  "key": {
   508                    "name": 1
   509                  },
   510                  "partialFilterExpression": {
   511                    "unencrypted_string": "foo"
   512                  }
   513                }
   514              ]
   515            }
   516          }
   517        },
   518        {
   519          "name": "assertIndexExists",
   520          "object": "testRunner",
   521          "arguments": {
   522            "database": "default",
   523            "collection": "encryptedCollection",
   524            "index": "name"
   525          }
   526        }
   527      ]
   528    },
   529    {
   530      "description": "createIndexes with a partialFilterExpression on an encrypted field is an error",
   531      "clientOptions": {
   532        "autoEncryptOpts": {
   533          "kmsProviders": {
   534            "local": {
   535              "key": {
   536                "$binary": {
   537                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   538                  "subType": "00"
   539                }
   540              }
   541            }
   542          },
   543          "schemaMap": {
   544            "default.encryptedCollection": {
   545              "properties": {
   546                "encrypted_w_altname": {
   547                  "encrypt": {
   548                    "keyId": "/altname",
   549                    "bsonType": "string",
   550                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   551                  }
   552                },
   553                "encrypted_string": {
   554                  "encrypt": {
   555                    "keyId": [
   556                      {
   557                        "$binary": {
   558                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   559                          "subType": "04"
   560                        }
   561                      }
   562                    ],
   563                    "bsonType": "string",
   564                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   565                  }
   566                },
   567                "random": {
   568                  "encrypt": {
   569                    "keyId": [
   570                      {
   571                        "$binary": {
   572                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   573                          "subType": "04"
   574                        }
   575                      }
   576                    ],
   577                    "bsonType": "string",
   578                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
   579                  }
   580                },
   581                "encrypted_string_equivalent": {
   582                  "encrypt": {
   583                    "keyId": [
   584                      {
   585                        "$binary": {
   586                          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
   587                          "subType": "04"
   588                        }
   589                      }
   590                    ],
   591                    "bsonType": "string",
   592                    "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
   593                  }
   594                }
   595              },
   596              "bsonType": "object"
   597            }
   598          }
   599        }
   600      },
   601      "operations": [
   602        {
   603          "name": "dropCollection",
   604          "object": "database",
   605          "arguments": {
   606            "collection": "encryptedCollection"
   607          }
   608        },
   609        {
   610          "name": "createCollection",
   611          "object": "database",
   612          "arguments": {
   613            "collection": "encryptedCollection"
   614          }
   615        },
   616        {
   617          "name": "runCommand",
   618          "object": "database",
   619          "arguments": {
   620            "command": {
   621              "createIndexes": "encryptedCollection",
   622              "indexes": [
   623                {
   624                  "name": "name",
   625                  "key": {
   626                    "name": 1
   627                  },
   628                  "partialFilterExpression": {
   629                    "encrypted_string": "foo"
   630                  }
   631                }
   632              ]
   633            }
   634          },
   635          "result": {
   636            "errorContains": "Comparison to encrypted fields not supported"
   637          }
   638        }
   639      ]
   640    }
   641  ]
   642}

View as plain text