Skip to content

fix(router): resolve S3 storage credentials from the environment - #1071

Open
Meemaw wants to merge 2 commits into
graphql-hive:mainfrom
Meemaw:s3-credentials-from-env
Open

fix(router): resolve S3 storage credentials from the environment#1071
Meemaw wants to merge 2 commits into
graphql-hive:mainfrom
Meemaw:s3-credentials-from-env

Conversation

@Meemaw

@Meemaw Meemaw commented May 29, 2026

Copy link
Copy Markdown
Contributor

The S3 storage backend built its client with AmazonS3Builder::new(), which ignores the standard AWS_* environment variables. As a result it did not work out of the box in Kubernetes/EKS and credentials could not be supplied via the environment.

Build from AmazonS3Builder::from_env() instead, so EKS IRSA works automatically (the pod identity webhook injects
AWS_WEB_IDENTITY_TOKEN_FILE/AWS_ROLE_ARN) and static credentials can be provided via AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY. Explicit config values are applied afterwards and continue to take precedence.

Adds e2e coverage for env-supplied credentials and config-over-env precedence using the in-process S3 mock.

The S3 storage backend built its client with `AmazonS3Builder::new()`,
which ignores the standard `AWS_*` environment variables. As a result it
did not work out of the box in Kubernetes/EKS and credentials could not
be supplied via the environment.

Build from `AmazonS3Builder::from_env()` instead, so EKS IRSA works
automatically (the pod identity webhook injects
`AWS_WEB_IDENTITY_TOKEN_FILE`/`AWS_ROLE_ARN`) and static credentials can
be provided via `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`. Explicit
config values are applied afterwards and continue to take precedence.

Adds e2e coverage for env-supplied credentials and config-over-env
precedence using the in-process S3 mock.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the S3 storage backend to resolve credentials from standard AWS_* environment variables by default when no explicit credentials are provided. It also adds integration tests to verify this behavior and ensure explicit configuration takes precedence. Feedback on the changes highlights a potential issue where unconditionally using AmazonS3Builder::from_env() can cause credential pollution or conflicts when explicit credentials are configured, and suggests conditionally initializing the builder only when configuration credentials are absent.

Comment thread bin/router/src/storage/s3_runtime.rs Outdated
…gured

Addresses review feedback: seeding the builder with `from_env()`
unconditionally could mix environment-derived credentials into explicitly
configured ones — a stray `AWS_SESSION_TOKEN` attaching to configured
static keys, or env static keys taking object_store's internal precedence
over a configured `web_identity` role.

Only seed from `from_env()` when no credentials are configured. When
credentials are set explicitly, start from a clean builder and use solely
the configured credentials; non-credential env vars (region, endpoint)
still apply as a fallback. Strengthen the precedence e2e test to cover the
`AWS_SESSION_TOKEN` pollution case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Meemaw
Meemaw marked this pull request as ready for review June 13, 2026 21:09
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.

1 participant