Skip to content

Commit

Permalink
add missing return to mock KMS server (mongodb-labs#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinAlbs authored Nov 5, 2024
1 parent 1a2a600 commit d9fb504
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .evergreen/csfle/kms_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ def _do_post(self):
if not self.headers["Host"] == "localhost":
data = "Unexpected host"
self._send_reply(data.encode("utf-8"))
return

if not self._validate_signature(self.headers, raw_input):
data = "Bad Signature"
self._send_reply(data.encode("utf-8"))
return

# X-Amz-Target: TrentService.Encrypt
aws_operation = self.headers['X-Amz-Target']
Expand All @@ -85,6 +87,7 @@ def _do_post(self):
else:
data = "Unknown AWS Operation"
self._send_reply(data.encode("utf-8"))
return

def _validate_signature(self, headers, raw_input):
auth_header = headers["Authorization"]
Expand Down Expand Up @@ -130,6 +133,7 @@ def _do_encrypt(self, raw_input):
}

self._send_reply(json.dumps(response).encode('utf-8'))
return

def _do_encrypt_faults(self, raw_ciphertext):
kms_http_common.stats.fault_calls += 1
Expand Down Expand Up @@ -186,6 +190,7 @@ def _do_decrypt(self, raw_input):
}

self._send_reply(json.dumps(response).encode('utf-8'))
return

def _do_decrypt_faults(self, blob):
kms_http_common.stats.fault_calls += 1
Expand Down

0 comments on commit d9fb504

Please sign in to comment.