Repository navigation
Conversation
US3 is UCloud's object storage service. It speaks the S3 protocol with signature V4 only, which is exactly what aws-sdk-go-v2 already emits, so the backend reuses the existing S3 client instead of adding another SDK. - new provider `us3` (scheme `us3://`) registered in the factory, the storage allow-list, the tenant storage config, the instance model, the system handler (status + connectivity check), the env-driven initialisation and the CLI provider list - endpoint is optional: when empty it is derived from the region as https://s3-<region>.ufileos.com; bare hosts get https://, and a region that is not a documented code is rejected so it cannot inject a host - path-style addressing is the default (every public region supports path-style HTTPS); `virtual_hosted_style` / `US3_VIRTUAL_HOSTED_STYLE` opts into the other form - s3FileService now carries its scheme, so `s3://` and `us3://` references stay distinguishable while sharing one implementation - credential redaction, secret preservation, provider validation (endpoint optional) and reference/URL scheme allow-lists updated - unit tests for endpoint resolution, scheme handling, SSRF rejection and the provider → engine-config mapping; docs and .env.example updated Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
us3storage provider for UCloud US3(UCloud 对象存储).US3 is S3-protocol compatible and implements signature V4 only — exactly what
aws-sdk-go-v2already sends — so the backend reuses the existing S3 client instead of pulling in another SDK.s3FileServicenow carries its scheme (s3:///us3://), so references from the two providers stay distinguishable while sharing one implementation.Behaviour
endpointis optional: empty →https://s3-<region>.ufileos.com. A bare host getshttps://, and a region that is not a documented code is rejected so it cannot smuggle a different host into the derived endpoint. Internal endpoints (http://internal.s3-<region>.ufileos.com) must be set explicitly.US3_VIRTUAL_HOSTED_STYLE=true(tenant JSON:virtual_hosted_style) opts into virtual-hosted style. The UI drawer defaults the path-style switch to on for US3.PresignGetObject, 24 h), i.e. V4 query-string signing.Wiring
internal/application/service/file/us3.go— new backend (CheckUS3Connectivity,ResolveUS3Endpoint)file/s3.go— service carriesscheme;newS3ClientWithSchemestorageallowlist,types.StorageEngineConfig/ instance model / legacy + env projection, redaction + secret preservation, provider validation (endpoint optional), system handler (status item,POST /system/storage-engine-check), container env init, CLI provider list, API client, scheme allow-lists (Go + frontend), storage settings drawer, swagger, docs,.env.exampleEnv
Tests
go test ./internal/application/service/file/ -run 'US3|S3|StorageClients'— PASS (endpoint resolution, scheme round-trip incl. thestorage://<backend>/us3://…wrapper, SSRF rejection)go test ./internal/storageallowlist ./internal/storageurl— PASSinternal/typesandinternal/handlercannot be built on this Windows host (pre-existing cgo-only deps:pg_query,sqlite-vec,duckdb); the new provider path there is covered byknowledge_storage_config_test.goin CI.No live US3 credentials were available, so the end-to-end upload/presign path is not exercised here; the endpoint/region/signature rules follow the documented US3 behaviour.
🤖 Generated with Claude Code