LiteParsedDocument for extensions must be able to participate in AuthorizationChecks

XMLWordPrintableJSON

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

      Authorization checks happen in https://github.com/10gen/mongo/blob/86a11c7674731b59104647934ea1b345dbbb0341/src/mongo/db/auth/authorization_checks.cpp#L362-L377 and rely on the LiteParsedDocument source representation of a pipeline stage to determine which privileges are applicable to the query execution.

      Currently, extension stages only register a default LiteParsedDocumentSource, which does not accurately describe the stages.

      The pertinent calls for authorization checks are LiteParsedDocumentSource::
      isInitialSource() and LiteParsedDocumentSource::requiredPrivileges().

      In this project:

      Stage Type Requires Privileges on a collection namespace
      SourceĀ  No. Unless a source stage needs to reference a collection namespace, a source stage does not require any additional privileges.
      Transform No, transform stages can't reference a collection, and only receive a document stream.
      Desugar This one is tricky. A desugar stage may desugar into multiple stages, which may require privileges on the collection namespace.

      Because this piece of code is reliant on a non-parsed document source, we can't rely on the behaviours of a post-desugared Desugar stage (i.e $vectorSearch->$pluginSearch + $_internalSearchLookupId).

      One solution, is to implement a new type of LiteParsedDocumentSource, perhaps LiteParsedDocumentSourceExtension.

      Unfortunately, the current interface for LiteParsedDocumentSource: : parse() returns a single std::unique_ptr<LiteParsedDocumentSource>, so it won't be possible to have the LiteParsed extension source desugar at parse time into its constituent parts.

      Instead, LiteParsedDocumentSourceExtension will have to keep a pointer to the static descriptor, and we will have to introduce a property on the static descriptor to indicate whether or not this stage requires privileges on the main collection namespace.

            Assignee:
            Finley Lau
            Reporter:
            Santiago Roche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: