Support automatic encryption in API Platform

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: API Platform
    • None
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      In API Platform, the listing is done using a $facet stage in order to get the results and the count in a single read command.

      https://github.com/api-platform/core/blob/510fa5523802f9c173d852c218317f95f9ef2d90/src/Doctrine/Odm/Extension/PaginationExtension.php#L70-L89

      Pipeline

      [
          {
              "$sort": {
                  "_id": 1
              }
          },
          {
              "$facet": {
                  "results": [
                      {
                          "$skip": 0
                      },
                      {
                          "$limit": 30
                      }
                  ],
                  "count": [
                      {
                          "$count": "count"
                      }
                  ]
              }
          },
          {
              "$addFields": {
                  "__api_first_result__": {
                      "$literal": 0
                  },
                  "__api_max_results__": {
                      "$literal": 30
                  }
              }
          }
      ]

      But mongocryptd does not support this stage.

      mongocryptd error: Aggregation stage $internalFacetTeeConsumer is not allowed or supported with automatic encryption.

      Similar error with lib mongo_crypt:

      csfle "analyze_query" failed: Aggregation stage $internalFacetTeeConsumer is not allowed or supported with automatic encryption. [Error 2, code 31011]

       

      Solutions:

      • Enable support for $facet stage in mongocryptd and libmongocrypt
      • Have an option to not use the $facet stage, maybe when using partial pagination without count.

            Assignee:
            Unassigned
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: