[COMPASS-4989] FLE Schema Validation in Compass Gives Warning/Error Created: 04/Aug/21  Updated: 09/Aug/22

Status: Open
Project: Compass
Component/s: Field Level Encryption, Schema
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Emre Ucal Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Story Points: 3
Sprint: Iteration Johannesburg

 Description   

I’m creating the following schema server side:

db.getSiblingDB("testdb").runCommand(
  {
    "collMod" : "testcol",
    "validator" : {
      "$jsonSchema" : {
        "bsonType" : "object",
        "properties" : {
          "subscriber_ssn_nbr" : {
            "encrypt" : {
              "keyId" : [UUID("1618bad4-936d-4a9e-aa30-06629f1ee001")],
              "algorithm" : "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
            }
          },
          "claimArray": {
            "bsonType": "array",
            "items": {
              "bsonType" : "object",
              "properties": {
                "claimId": {
                  "encrypt" : {
                    "keyId" : [UUID("1618bad4-936d-4a9e-aa30-06629f1ee001")],
                    "algorithm" : "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
)

From Mongo Shell it’s executed and I get an ok: 1. It does enforcement properly as well (we’re using manual encryption). But from Compass I get a warning/error “Array elements must have type BinData, found object” I think this is worth investigating (or could be a potential bug?)



 Comments   
Comment by Anna Henningsen [ 04/Aug/21 ]

Fwiw, this appears to be happening because after successfully installing the validator, the original code for it gets converted into EJSON, which then isn't valid when transmitted to the server as-is for fetching samples of passing/invalid documents.

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