Skip to content

Commit 42aafd7

Browse files
committed
PYTHON-2034 Validate EC2/Lambda auth tests do not contain URI credentials
1 parent 93cf0dd commit 42aafd7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ functions:
274274
fi
275275
fi
276276
277-
if [ $(uname -s) == "Darwin" ]; then
277+
if [ $(uname -s) = "Darwin" ]; then
278278
core_pattern_mac=$(/usr/sbin/sysctl -n "kern.corefile")
279279
if [ "$core_pattern_mac" = "dump_%N.%P.core" ]; then
280280
echo "Enabling coredumps"
@@ -539,7 +539,7 @@ functions:
539539
working_dir: "src"
540540
script: |
541541
${PREPARE_SHELL}
542-
if [ "${skip_EC2_auth_test}" == "true" ]; then
542+
if [ "${skip_EC2_auth_test}" = "true" ]; then
543543
echo "This platform does not support the EC2 auth test, skipping..."
544544
exit 0
545545
fi
@@ -557,7 +557,7 @@ functions:
557557
working_dir: "src"
558558
script: |
559559
${PREPARE_SHELL}
560-
PYTHON_BINARY=${PYTHON_BINARY} .evergreen/run-mongodb-aws-test.sh
560+
PYTHON_BINARY=${PYTHON_BINARY} ASSERT_NO_URI_CREDS=true .evergreen/run-mongodb-aws-test.sh
561561
562562
"run aws auth test with aws credentials as environment variables":
563563
- command: shell.exec
@@ -577,7 +577,7 @@ functions:
577577
working_dir: "src"
578578
script: |
579579
${PREPARE_SHELL}
580-
PYTHON_BINARY=${PYTHON_BINARY} PROJECT_DIRECTORY=${PROJECT_DIRECTORY} .evergreen/run-mongodb-aws-test.sh
580+
PYTHON_BINARY=${PYTHON_BINARY} PROJECT_DIRECTORY=${PROJECT_DIRECTORY} ASSERT_NO_URI_CREDS=true .evergreen/run-mongodb-aws-test.sh
581581
582582
"run aws auth test with aws credentials and session token as environment variables":
583583
- command: shell.exec
@@ -599,7 +599,7 @@ functions:
599599
working_dir: "src"
600600
script: |
601601
${PREPARE_SHELL}
602-
PYTHON_BINARY=${PYTHON_BINARY} .evergreen/run-mongodb-aws-test.sh
602+
PYTHON_BINARY=${PYTHON_BINARY} ASSERT_NO_URI_CREDS=true .evergreen/run-mongodb-aws-test.sh
603603
604604
"run aws ECS auth test":
605605
- command: shell.exec
@@ -608,7 +608,7 @@ functions:
608608
working_dir: "src"
609609
script: |
610610
${PREPARE_SHELL}
611-
if [ "${skip_ECS_auth_test}" == "true" ]; then
611+
if [ "${skip_ECS_auth_test}" = "true" ]; then
612612
echo "This platform does not support the ECS auth test, skipping..."
613613
exit 0
614614
fi

.evergreen/run-mongodb-aws-test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ fi
2929

3030
export MONGODB_URI="$MONGODB_URI"
3131

32+
if [ "$ASSERT_NO_URI_CREDS" = "true" ]; then
33+
if echo "$MONGODB_URI" | grep -q "@"; then
34+
echo "MONGODB_URI unexpectedly contains user credentials!";
35+
exit 1
36+
fi
37+
fi
38+
3239
# show test output
3340
set -x
3441

0 commit comments

Comments
 (0)