...

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

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

     1runOn:
     2  - minServerVersion: "4.1.10"
     3database_name: &database_name "default"
     4collection_name: &collection_name "default"
     5
     6data: []
     7key_vault_data: [{'status': 1, '_id': {'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}, 'masterKey': {'provider': 'aws', 'key': 'arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'region': 'us-east-1'}, 'updateDate': {'$date': {'$numberLong': '1552949630483'}}, 'keyMaterial': {'$binary': {'base64': 'AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO', 'subType': '00'}}, 'creationDate': {'$date': {'$numberLong': '1552949630483'}}, 'keyAltNames': ['altname', 'another_altname']}]
     8
     9tests:
    10  - description: "Schema with an encrypted field in an array"
    11    clientOptions:
    12      autoEncryptOpts:
    13        schemaMap:
    14          "default.default": {'properties': {'encrypted_string': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}}}, 'bsonType': 'array'}
    15        kmsProviders:
    16          aws: {} # Credentials filled in from environment.
    17    operations:
    18      - name: insertOne
    19        arguments:
    20          document: &doc0 { _id: 1, encrypted_string: "string0" }
    21        result:
    22          errorContains: "Invalid schema"
    23    outcome:
    24      collection:
    25        data: []
    26  - description: "Schema without specifying parent object types"
    27    clientOptions:
    28      autoEncryptOpts:
    29        schemaMap:
    30          "default.default": {'properties': {'foo': {'properties': {'bar': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}}}}}}
    31        kmsProviders:
    32          aws: {} # Credentials filled in from environment.
    33    operations:
    34      - name: insertOne
    35        arguments:
    36          document: *doc0
    37        result:
    38          errorContains: "Invalid schema"
    39    outcome:
    40      collection:
    41        data: []
    42  - description: "Schema with siblings of encrypt document"
    43    clientOptions:
    44      autoEncryptOpts:
    45        schemaMap:
    46          "default.default": {'properties': {'encrypted_string': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}, 'bsonType': 'object'}}}
    47        kmsProviders:
    48          aws: {} # Credentials filled in from environment.
    49    operations:
    50      - name: insertOne
    51        arguments:
    52          document: *doc0
    53        result:
    54          errorContains: "'encrypt' cannot be used in conjunction with 'bsonType'"
    55    outcome:
    56      collection:
    57        data: []
    58  - description: "Schema with logical keywords"
    59    clientOptions:
    60      autoEncryptOpts:
    61        schemaMap:
    62          "default.default": {'anyOf': [{'properties': {'encrypted_string': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}}}}]}
    63        kmsProviders:
    64          aws: {} # Credentials filled in from environment.
    65    operations:
    66      - name: insertOne
    67        arguments:
    68          document: *doc0
    69        result:
    70          errorContains: "Invalid schema"
    71    outcome:
    72      collection:
    73        data: []

View as plain text