[MONGOCRYPT-570] Do not apply default to min/max values for int/long/date Created: 12/Apr/23  Updated: 28/Oct/23  Resolved: 24/Apr/23

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0, 1.8.0-alpha1

Type: Improvement Priority: Unknown
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Binding Changes: Not Needed

 Description   

Scope

  • Do not apply default to min/max values for explicit encryption with int/long/date.
  • Return an error if explicit encryption is attempted on int/long/date without min or max set.

Background & Motivation

libmongocrypt applies a default min/max to int/long/date.

Requiring min/max for int/long/date matches the server behavior: https://github.com/mongodb/mongo/blob/ce9ae383244dc01c8961e3052ca9f48a0008c80d/src/mongo/crypto/encryption_fields_validation.cpp#L147-L155

Not requiring a min/max may be a convenience to users. But, requiring the values may reduce risk of users unintentionally omitting min or max. Encrypting with an incorrect min or max may result in incorrect query results. Adding a default value to min and max can be considered in the future without making a backwards breaking change.



 Comments   
Comment by Githook User [ 24/Apr/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: MONGOCRYPT-570 require `min` and `max` for `int`, `long`, and `date` (#624)

  • test min and max are required for int type
  • require min and max for int, long, and date
  • remove int32 nominmax tests

They were incorrectly testing double.
Branch: master
https://github.com/mongodb/libmongocrypt/commit/9f51624d658840991877543076676f8fc427a85b

Comment by Cloud GitHub Webhooks [ 24/Apr/23 ]

kevinAlbs merged a pull request (MONGOCRYPT-570 require `min` and `max` for `int` `long` and `date`) into the following branch:
master: 9f51624d658840991877543076676f8fc427a85b

Generated at Thu Feb 08 09:08:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.