Skip to content

Commit 5bc03a4

Browse files
committed
Merge tag '1.20.0' into debian/unstable
1.20.0 release
2 parents 6efccc5 + c51fa2e commit 5bc03a4

17 files changed

Lines changed: 236 additions & 34 deletions

.evergreen/config.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,19 +1192,32 @@ tasks:
11921192
mkdir libmongocrypt_upload/include
11931193
mv $srcdir/include/mongocrypt libmongocrypt_upload/include
11941194
1195-
# Move library
1195+
# Move library files
11961196
if [ -f "$srcdir/lib64/libmongocrypt.so" ]; then
11971197
mkdir libmongocrypt_upload/lib64
11981198
mv $srcdir/lib64/libmongocrypt.so libmongocrypt_upload/lib64
1199+
mv $srcdir/lib64/libmongocrypt-static.a libmongocrypt_upload/lib64
1200+
mv $srcdir/lib64/libbson-static-for-libmongocrypt.a libmongocrypt_upload/lib64
1201+
mv $srcdir/lib64/libkms_message-static.a libmongocrypt_upload/lib64
11991202
elif [ -f "$srcdir/lib/libmongocrypt.so" ]; then
12001203
mkdir libmongocrypt_upload/lib
12011204
mv $srcdir/lib/libmongocrypt.so libmongocrypt_upload/lib
1205+
mv $srcdir/lib/libmongocrypt-static.a libmongocrypt_upload/lib
1206+
mv $srcdir/lib/libbson-static-for-libmongocrypt.a libmongocrypt_upload/lib
1207+
mv $srcdir/lib/libkms_message-static.a libmongocrypt_upload/lib
12021208
elif [ -f "$srcdir/lib/libmongocrypt.dylib" ]; then
12031209
mkdir libmongocrypt_upload/lib
12041210
mv $srcdir/lib/libmongocrypt.dylib libmongocrypt_upload/lib
1211+
mv $srcdir/lib/libmongocrypt-static.a libmongocrypt_upload/lib
1212+
mv $srcdir/lib/libbson-static-for-libmongocrypt.a libmongocrypt_upload/lib
1213+
mv $srcdir/lib/libkms_message-static.a libmongocrypt_upload/lib
12051214
elif [ -f "$srcdir/bin/mongocrypt.dll" ]; then
12061215
mkdir libmongocrypt_upload/bin
1216+
mkdir libmongocrypt_upload/lib
12071217
mv $srcdir/bin/mongocrypt.dll libmongocrypt_upload/bin
1218+
mv $srcdir/lib/mongocrypt-static.lib libmongocrypt_upload/lib
1219+
mv $srcdir/lib/bson-static-for-libmongocrypt.lib libmongocrypt_upload/lib
1220+
mv $srcdir/lib/kms_message-static.lib libmongocrypt_upload/lib
12081221
fi
12091222
- command: archive.targz_pack
12101223
params:

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
# ChangeLog
22

3+
## 1.20.0
4+
5+
### Added
6+
- Stable support for substring queries.
7+
8+
## 1.19.2
9+
10+
### Added
11+
- Add static library files to GitHub releases.
12+
313
## 1.19.1
414

515
### Added
616
- Restore support for the experimental `prefixPreview` and `suffixPreview` query types.
717

18+
819
## 1.19.0
920

1021
### Added
@@ -16,6 +27,13 @@
1627
### Removed
1728
- Support for the experimental `prefixPreview` and `suffixPreview` query types.
1829

30+
31+
## 1.18.2
32+
33+
### Fixed
34+
- Add musl arm64 release to GitHub release. This was an omission in 1.18.0.
35+
- Reject large KMS replies.
36+
1937
## 1.18.1
2038

2139
### Fixed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ A Windows DLL for x86_64 is available on the Github Releases page. See the [late
7878

7979
Use `gpg` to verify the signature. The public key for `libmongocrypt` is available on https://pgp.mongodb.com/.
8080

81+
## Python Releases ##
82+
Python releases and tags are signed using the MongoDB Python driver PGP key. Use `gpg` to verify the signature. The public key is available at https://pgp.mongodb.com/python-driver.pub.
83+
8184

8285
### Testing ###
8386
`test-mongocrypt` mocks all I/O with files stored in the `test/data` and `test/example` directories. Run `test-mongocrypt` from the source directory:

kms-message/src/kms_kmip_response_parser.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ kms_kmip_response_parser_feed (kms_kmip_response_parser_t *parser,
111111
uint32_t temp;
112112
memcpy (&temp, parser->buf->str + FIRST_LENGTH_OFFSET, sizeof (uint32_t));
113113
parser->first_len = KMS_UINT32_FROM_BE (temp);
114+
if (parser->first_len > KMS_PARSER_MAX_RESPONSE_LEN) {
115+
KMS_ERROR (parser, "KMS KMIP response too large");
116+
return false;
117+
}
114118
}
115119
return true;
116120
}

src/mc-efc-private.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ typedef enum _supported_query_type_flags {
2828
SUPPORTS_RANGE_QUERIES = 1 << 1,
2929
// Range preview query supported
3030
SUPPORTS_RANGE_PREVIEW_DEPRECATED_QUERIES = 1 << 2,
31-
// Text search preview query supported
32-
SUPPORTS_SUBSTRING_PREVIEW_QUERIES = 1 << 3,
31+
// Text search query supported
32+
SUPPORTS_SUBSTRING_QUERIES = 1 << 3,
3333
SUPPORTS_SUFFIX_QUERIES = 1 << 4,
3434
SUPPORTS_PREFIX_QUERIES = 1 << 5,
3535
// suffixPreview and prefixPreview are deprecated aliases for suffix and prefix, respectively.
3636
SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES = 1 << 6,
3737
SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES = 1 << 7,
38+
// substring preview query supported
39+
SUPPORTS_SUBSTRING_PREVIEW_DEPRECATED_QUERIES = 1 << 8,
3840
} supported_query_type_flags;
3941

4042
typedef struct _mc_EncryptedField_t {

src/mc-efc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ static bool _parse_query_type_string(const char *queryType, supported_query_type
3333
*out = SUPPORTS_RANGE_QUERIES;
3434
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED_STR), qtv)) {
3535
*out = SUPPORTS_RANGE_PREVIEW_DEPRECATED_QUERIES;
36-
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_STR), qtv)) {
37-
*out = SUPPORTS_SUBSTRING_PREVIEW_QUERIES;
36+
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED_STR), qtv)
37+
|| mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRING_STR), qtv)) {
38+
*out = SUPPORTS_SUBSTRING_QUERIES;
3839
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIX_STR), qtv)) {
3940
*out = SUPPORTS_SUFFIX_QUERIES;
4041
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIX_STR), qtv)) {
@@ -244,8 +245,9 @@ bool mc_EncryptedFieldConfig_parse(mc_EncryptedFieldConfig_t *efc,
244245

245246
if (!bson_iter_init_find(&iter, efc_bson, "strEncodeVersion")) {
246247
if (all_supported_queries
247-
& (SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES
248-
| SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES | SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES)) {
248+
& (SUPPORTS_SUBSTRING_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_DEPRECATED_QUERIES | SUPPORTS_SUFFIX_QUERIES
249+
| SUPPORTS_PREFIX_QUERIES | SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES
250+
| SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES)) {
249251
// Has at least one text search query type, set to latest by default.
250252
efc->str_encode_version = LATEST_STR_ENCODE_VERSION;
251253
} else {

src/mc-textopts.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ bool mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(const mc_TextOpts_t *txo,
378378
include_suffix = true;
379379
break;
380380
}
381-
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW: {
381+
case MONGOCRYPT_QUERY_TYPE_SUBSTRING:
382+
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED: {
382383
include_substring = true;
383384
break;
384385
}

src/mongocrypt-ctx-encrypt.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,9 @@ static moe_result must_omit_encryptionInformation(const char *command_name,
890890
bool has_fields_requiring_ei = false;
891891
for (const mc_EncryptedField_t *ef = efc->fields; ef != NULL; ef = ef->next) {
892892
if (ef->supported_queries
893-
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES
894-
| SUPPORTS_PREFIX_QUERIES | SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES
895-
| SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES)) {
893+
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_QUERIES | SUPPORTS_SUFFIX_QUERIES
894+
| SUPPORTS_PREFIX_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_DEPRECATED_QUERIES
895+
| SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES | SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES)) {
896896
has_fields_requiring_ei = true;
897897
break;
898898
}
@@ -1012,8 +1012,8 @@ static bool _fle2_append_compactionTokens(mongocrypt_t *crypt,
10121012
const _mongocrypt_buffer_t *ecoct_buf = mc_ECOCToken_get(ecoct);
10131013

10141014
if (ptr->supported_queries
1015-
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES
1016-
| SUPPORTS_PREFIX_QUERIES | SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES
1015+
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_QUERIES | SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES
1016+
| SUPPORTS_SUBSTRING_PREVIEW_DEPRECATED_QUERIES | SUPPORTS_SUFFIX_PREVIEW_DEPRECATED_QUERIES
10171017
| SUPPORTS_PREFIX_PREVIEW_DEPRECATED_QUERIES)) {
10181018
// Append the document {ecoc: <ECOCToken>, anchorPaddingToken: <AnchorPaddingTokenRoot>}
10191019
esct = mc_ESCToken_new(crypto, cl1t, status);
@@ -1524,9 +1524,10 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
15241524
// fallthrough
15251525
case MONGOCRYPT_QUERY_TYPE_SUFFIX:
15261526
case MONGOCRYPT_QUERY_TYPE_PREFIX:
1527+
case MONGOCRYPT_QUERY_TYPE_SUBSTRING:
15271528
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED:
15281529
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED:
1529-
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW:
1530+
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED:
15301531
case MONGOCRYPT_QUERY_TYPE_RANGE:
15311532
case MONGOCRYPT_QUERY_TYPE_EQUALITY: marking.u.fle2.type = MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND; break;
15321533
default: _mongocrypt_ctx_fail_w_msg(ctx, "Invalid value for EncryptOpts.queryType"); goto fail;
@@ -2101,9 +2102,9 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
21012102
return _mongocrypt_ctx_fail_w_msg(ctx, "suffix query type requires string index type");
21022103
}
21032104
}
2104-
if (qt == MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW) {
2105+
if (qt == MONGOCRYPT_QUERY_TYPE_SUBSTRING || qt == MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED) {
21052106
if (!(ctx->opts.index_type.set && ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_STRING)) {
2106-
return _mongocrypt_ctx_fail_w_msg(ctx, "substringPreview query type requires string index type");
2107+
return _mongocrypt_ctx_fail_w_msg(ctx, "substring query type requires string index type");
21072108
}
21082109
}
21092110
}
@@ -2186,9 +2187,10 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
21862187
// fallthrough
21872188
case MONGOCRYPT_QUERY_TYPE_PREFIX:
21882189
case MONGOCRYPT_QUERY_TYPE_SUFFIX:
2190+
case MONGOCRYPT_QUERY_TYPE_SUBSTRING:
21892191
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED:
21902192
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED:
2191-
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW:
2193+
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED:
21922194
matches = (ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_STRING);
21932195
break;
21942196
default:

src/mongocrypt-ctx-private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ typedef enum _mongocrypt_query_type_t {
4646
MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED = 3,
4747
MONGOCRYPT_QUERY_TYPE_PREFIX = 4,
4848
MONGOCRYPT_QUERY_TYPE_SUFFIX = 5,
49-
MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW = 6,
49+
MONGOCRYPT_QUERY_TYPE_SUBSTRING = 6,
5050
// prefixPreview and suffixPreview are deprecated aliases for prefix and suffix, respectively. They behave
5151
// identically; the distinct values exist for consistency (cf. rangePreview) and to ease eventual removal.
5252
MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED = 7,
5353
MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED = 8,
54+
MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED = 9,
5455
} mongocrypt_query_type_t;
5556

5657
const char *_mongocrypt_query_type_to_string(mongocrypt_query_type_t val);

src/mongocrypt-ctx.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ bool mongocrypt_ctx_setopt_algorithm(mongocrypt_ctx_t *ctx, const char *algorith
248248
} else if (mstr_eq_ignore_case(algo_str, mstrv_lit(MONGOCRYPT_ALGORITHM_STRING_STR))) {
249249
ctx->opts.index_type.value = MONGOCRYPT_INDEX_TYPE_STRING;
250250
ctx->opts.index_type.set = true;
251+
} else if (mstr_eq_ignore_case(algo_str, mstrv_lit(MONGOCRYPT_ALGORITHM_TEXTPREVIEW_DEPRECATED_STR))) {
252+
_mongocrypt_ctx_fail_w_msg(ctx, "Algorithm 'textPreview' is deprecated, please use 'string'");
253+
return false;
251254
} else {
252255
char *error = bson_strdup_printf("unsupported algorithm string \"%.*s\"",
253256
algo_str.len <= (size_t)INT_MAX ? (int)algo_str.len : INT_MAX,
@@ -1027,6 +1030,9 @@ bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_t
10271030
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIX_STR))) {
10281031
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUFFIX;
10291032
ctx->opts.query_type.set = true;
1033+
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRING_STR))) {
1034+
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUBSTRING;
1035+
ctx->opts.query_type.set = true;
10301036
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR))) {
10311037
// 'prefixPreview' is a deprecated alias for 'prefix'.
10321038
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED;
@@ -1035,8 +1041,10 @@ bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_t
10351041
// 'suffixPreview' is a deprecated alias for 'suffix'.
10361042
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED;
10371043
ctx->opts.query_type.set = true;
1038-
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_STR))) {
1039-
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW;
1044+
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED_STR))) {
1045+
// TODO: MONGOCRYPT-938 disallow substringPreview
1046+
// _mongocrypt_ctx_fail_w_msg(ctx, "Query type 'substringPreview' is deprecated, please use 'substring'");
1047+
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED;
10401048
ctx->opts.query_type.set = true;
10411049
} else {
10421050
/* don't check if qt_str.len fits in int; we want the diagnostic output */
@@ -1068,9 +1076,10 @@ const char *_mongocrypt_query_type_to_string(mongocrypt_query_type_t val) {
10681076
case MONGOCRYPT_QUERY_TYPE_RANGE: return "Range";
10691077
case MONGOCRYPT_QUERY_TYPE_PREFIX: return "Prefix";
10701078
case MONGOCRYPT_QUERY_TYPE_SUFFIX: return "Suffix";
1079+
case MONGOCRYPT_QUERY_TYPE_SUBSTRING: return "Substring";
10711080
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED: return "PrefixPreview";
10721081
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED: return "SuffixPreview";
1073-
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW: return "SubstringPreview";
1082+
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_DEPRECATED: return "SubstringPreview";
10741083
default: return "Unknown";
10751084
}
10761085
}

0 commit comments

Comments
 (0)