Support timeoutMS on ClientEncryption

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: CSOT
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The CSOT specification requires ClientEncryptionOpts to support a timeoutMS option covering all operations on the object. PyMongo does not implement it, so explicit encryption establishes no CSOT deadline and KMS requests always use the default connect timeout. Automatic encryption is unaffected and remains conformant.

      • Introduced by DRIVERS-555 (specifications commit 6dc6f800, 2022-01-19), which split to PYTHON-2550; that ticket closed as Released without the option, and nothing has tracked the gap since.
      • The client-side-encryption specification's own ClientEncryptionOpts interface has never listed timeoutMS, which is the likeliest reason it was missed.
      • Node implements it: resolved from the key vault client, overridable per instance, applied to every operation, and marked experimental.
      • Found under PYTHON-5805, whose prose case 5 asserts a non-zero callback timeout that cannot fail here; that case is skipped rather than left passing vacuously.

      Definition of done

      • ClientEncryption and AsyncClientEncryption accept timeout_ms, matching key_expiration_ms rather than the specification's camelCase.
      • It defaults to the key vault client's timeoutMS, and an explicit value takes precedence.
      • It applies to every operation on the object, including key vault commands, mongocryptd commands, and KMS requests.
      • It is marked *(Provisional)* with a backwards-compatibility note, as pymongo.timeout is.
      • Prose case 5 of section 28 is un-skipped, and a configured timeout demonstrably tightens the timeout the callback receives.
      • The known-deviation note on KMSConnectContext.timeout is removed.

      Pitfalls

      • CSOT is under revision: DRIVERS-555 is Execution Blocked behind DRIVERS-3580, and DRIVERS-3259 (CSOT GA) is backlogged. Confirm the semantics before implementing.
      • No _csot.apply exists in either encryption.py, so there is no deadline plumbing to extend.
      • This changes the PYTHON-5805 callback contract: KMSConnectContext.timeout would start varying rather than always reporting the default.

            Assignee:
            Unassigned
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: