Skip to content

RUBY-3886 Migrate FLE/CSFLE test secrets to AWS Secrets Manager#3048

Draft
comandeo-mongo wants to merge 4 commits into
mongodb:masterfrom
comandeo-mongo:ruby-3886
Draft

RUBY-3886 Migrate FLE/CSFLE test secrets to AWS Secrets Manager#3048
comandeo-mongo wants to merge 4 commits into
mongodb:masterfrom
comandeo-mongo:ruby-3886

Conversation

@comandeo-mongo
Copy link
Copy Markdown
Contributor

@comandeo-mongo comandeo-mongo commented May 20, 2026

Replace the `"export FLE credentials"` Evergreen function that wrote secrets to `.env.private` with a `subprocess.exec` calling `drivers-evergreen-tools/.evergreen/csfle/setup-secrets.sh`. This fetches FLE secrets from the `drivers/csfle` vault in AWS Secrets Manager and generates temporary AWS STS credentials, writing everything to `secrets-export.sh` in the task working directory.

Jira: https://jira.mongodb.org/browse/RUBY-3886

Replace the deprecated project-variables approach in "export AWS auth
credentials" with a call to drivers-evergreen-tools setup-secrets.sh,
which fetches credentials from the drivers/aws_auth vault. Update
run-tests-aws-auth.sh and functions-aws.sh to source secrets-export.sh
instead of .env.private when running in CI.
Replace the "export FLE credentials" Evergreen function that wrote
secrets to .env.private with a subprocess.exec calling
drivers-evergreen-tools csfle/setup-secrets.sh. This fetches FLE
secrets from the drivers/csfle vault and generates temporary AWS
credentials via setup_secrets.py, writing everything to
secrets-export.sh in the task working directory.

Update run-tests.sh to source secrets-export.sh and remap the vault
variable names (FLE_AWS_KEY, FLE_AZURE_TENANTID, etc.) to the
MONGO_RUBY_DRIVER_* names expected by the test suite. Remove the
deprecated set-temp-creds.sh call.

Non-secret FLE configuration (key ARNs, endpoints, key names) is
passed via Evergreen expansion in the "run tests" function, which now
exports MONGO_RUBY_DRIVER_AWS_REGION, MONGO_RUBY_DRIVER_AWS_ARN, and
the Azure/GCP config vars directly.
@comandeo-mongo comandeo-mongo marked this pull request as ready for review May 21, 2026 05:53
@comandeo-mongo comandeo-mongo requested a review from a team as a code owner May 21, 2026 05:53
@comandeo-mongo comandeo-mongo requested review from Copilot and jamis May 21, 2026 05:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates FLE/CSFLE test secret provisioning in Evergreen from writing secrets into .env.private to using drivers-evergreen-tools/.evergreen/csfle/setup-secrets.sh, which pulls secrets from AWS Secrets Manager and generates temporary credentials for the test run.

Changes:

  • Replaced the Evergreen "export FLE credentials" function to invoke csfle/setup-secrets.sh via subprocess.exec.
  • Updated .evergreen/run-tests.sh to source secrets-export.sh and map generated values into MONGO_RUBY_DRIVER_* environment variables.
  • Adjusted Evergreen test-run setup to export non-secret FLE-related configuration via environment variables (region/ARN/endpoints, etc.).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.evergreen/run-tests.sh Sources secrets-export.sh and exports FLE-related env vars for the Ruby test suite.
.evergreen/config/common.yml.erb Switches FLE secret export to subprocess.exec running drivers-evergreen-tools setup-secrets.sh, and adjusts FLE env exports.
.evergreen/config.yml Same Evergreen configuration updates as common.yml.erb in the generated config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .evergreen/run-tests.sh
Comment on lines +240 to +244
if test -f secrets-export.sh; then
# shellcheck disable=SC1091
. ./secrets-export.sh
export MONGO_RUBY_DRIVER_AWS_KEY="${FLE_AWS_KEY}"
export MONGO_RUBY_DRIVER_AWS_SECRET="${FLE_AWS_SECRET}"
Comment thread .evergreen/run-tests.sh
# shellcheck disable=SC1091
. ./secrets-export.sh
export MONGO_RUBY_DRIVER_AWS_KEY="${FLE_AWS_KEY}"
export MONGO_RUBY_DRIVER_AWS_SECRET="${FLE_AWS_SECRET}"
@comandeo-mongo comandeo-mongo marked this pull request as draft May 21, 2026 13:42
setup-secrets.sh writes AWS_SESSION_TOKEN="" to secrets-export.sh for
long-lived keys. With an empty session token in the environment, the driver
includes a sessionToken: "" field in KMS credentials, causing AWS to reject
the request with an authentication error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants