Apply $$SEARCH_META scoping rules to $facet sub-pipelines

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      $facet does not enforce the $$SEARCH_META scoping rules that $lookup and $unionWith implement. Its addVariableRefs does not filter Variables::kSearchMetaId out of sub-pipeline references, and its getSubPipeline returns nullptr because it has multiple independent sub-pipelines, so search_helpers::assertSearchMetaAccessValidHelper never recurses into any branch.

      As a result, a pipeline like

      [
          {$drm: {source: ..., metadata: {as: "SEARCH_META"}}},
          {$facet: {result: [{$project: {meta: "$$SEARCH_META"}}]}}
      ]
      

      passes validation and silently reads the out-of-scope variable instead of erroring-out.

            Assignee:
            Daniel Segel
            Reporter:
            Daniel Segel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: