Skip to content

fix(object_store): validate S3 bucket name before use (#20263) - #26585

Open
utkarshmankad wants to merge 1 commit into
risingwavelabs:mainfrom
utkarshmankad:fix/20263-validate-s3-bucket-name
Open

fix(object_store): validate S3 bucket name before use (#20263)#26585
utkarshmankad wants to merge 1 commit into
risingwavelabs:mainfrom
utkarshmankad:fix/20263-validate-s3-bucket-name

Conversation

@utkarshmankad

@utkarshmankad utkarshmankad commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Closes Catch invalid object store configurations early #20263.
  • An invalid S3 bucket name (e.g. rw_data, containing an underscore) previously only surfaced as an opaque error like Unexpected (permanent) at stat on first access, which doesn't convey the real reason.
  • Added validate_s3_bucket_name() in src/object_store/src/object/s3.rs implementing the AWS S3 bucket naming rules (length, allowed characters, start/end character, no adjacent periods, no IP-address format, no reserved prefix/suffix).
  • Wired it into build_remote_object_store() in src/object_store/src/object/mod.rs for the s3:// scheme, covering both the native S3ObjectStore and OpenDAL S3 engine code paths, so a bad bucket name now panics eagerly at startup with a clear message instead of failing confusingly on first request.

Test plan

  • Unit tests: cargo test -p risingwave_object_store --lib validate_s3_bucket_name — 8/8 passed (valid names, underscore, bad length, uppercase, IP-address format, bad start/end char, adjacent periods, reserved prefix/suffix)
  • Integration test: cargo test -p risingwave_object_store --lib rejects_invalid_bucket — new test_build_remote_object_store_rejects_invalid_bucket_name exercises the actual build_remote_object_store() entry point with s3://rw_data and asserts it panics with "Invalid object store configuration" before any network call — 1/1 passed
  • Smoke test: ./risedev d + ./risedev psql -c "select 1;" confirms cluster start-up and query path are unaffected by the change (no regression for valid configs)

An invalid bucket name (e.g. `rw_data`, which contains an
underscore) previously only surfaced as an opaque error like
"Unexpected (permanent) at stat" on first access, making the real
cause hard to diagnose.

Add validate_s3_bucket_name() implementing the AWS S3 bucket naming
rules, and call it eagerly in build_remote_object_store() for the
s3:// scheme (both the native S3ObjectStore and OpenDAL S3 engine
paths) so misconfiguration is caught at startup with a clear panic
message instead of a confusing runtime error.

Closes risingwavelabs#20263
@utkarshmankad
utkarshmankad force-pushed the fix/20263-validate-s3-bucket-name branch from b118982 to 11c0fbe Compare August 4, 2026 21:25
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.

Catch invalid object store configurations early

1 participant