Skip to content

Commit 4895409

Browse files
committed
Require redacting replies to sensitive commands
This changes the test expectation for a hello command with sensitive information. Previously, the test did not require redaction of the reply, as it does not contain sensitive information (due to speculative authentication failing). However, this makes the test useless, as it can no longer test that the redaction logic applies to hello at all. Until we're able to test successful authentication, it's sensible to require redacting the reply to ensure drivers are spec compliant.
1 parent 6224ead commit 4895409

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

source/command-monitoring/tests/unified/redacted-commands.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440
"commandName": "hello",
441441
"reply": {
442442
"isWritablePrimary": {
443-
"$$unsetOrMatches": true
443+
"$$exists": false
444444
},
445445
"speculativeAuthenticate": {
446446
"$$exists": false
@@ -504,7 +504,7 @@
504504
"commandName": "ismaster",
505505
"reply": {
506506
"ismaster": {
507-
"$$unsetOrMatches": true
507+
"$$exists": false
508508
},
509509
"speculativeAuthenticate": {
510510
"$$exists": false
@@ -530,7 +530,7 @@
530530
"commandName": "isMaster",
531531
"reply": {
532532
"ismaster": {
533-
"$$unsetOrMatches": true
533+
"$$exists": false
534534
},
535535
"speculativeAuthenticate": {
536536
"$$exists": false

source/command-monitoring/tests/unified/redacted-commands.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,10 @@ tests:
232232
- commandSucceededEvent:
233233
commandName: hello
234234
reply:
235-
# We expect the reply not to be redacted, as the server can't
236-
# successfully authenticate us, which means the reply does not
237-
# need to be redacted. However, drivers may still choose to
238-
# redact the reply based on the fact that the command contained
239-
# sensitive information
240-
isWritablePrimary: { $$unsetOrMatches: true }
235+
# Even though authentication above fails and the reply does not
236+
# contain sensitive information, we're expecting the reply to be
237+
# redacted as well.
238+
isWritablePrimary: { $$exists: false }
241239
# This assertion will currently always hold true since we're
242240
# not expecting successful authentication, in which case this
243241
# field is missing anyways.
@@ -272,7 +270,7 @@ tests:
272270
- commandSucceededEvent:
273271
commandName: ismaster
274272
reply:
275-
ismaster: { $$unsetOrMatches: true }
273+
ismaster: { $$exists: false }
276274
speculativeAuthenticate: { $$exists: false }
277275
- commandStartedEvent:
278276
commandName: isMaster
@@ -282,7 +280,7 @@ tests:
282280
- commandSucceededEvent:
283281
commandName: isMaster
284282
reply:
285-
ismaster: { $$unsetOrMatches: true }
283+
ismaster: { $$exists: false }
286284
speculativeAuthenticate: { $$exists: false }
287285

288286
- description: "hello without speculative authenticate is not redacted"

0 commit comments

Comments
 (0)