Skip to content

Feat/alibaba oss cdn support - #701

Closed
will36900 wants to merge 7 commits into
AsterCommunity:masterfrom
will36900:feat/alibaba-oss-cdn-support
Closed

will36900 wants to merge 7 commits into
AsterCommunity:masterfrom
will36900:feat/alibaba-oss-cdn-support

Conversation

@will36900

Copy link
Copy Markdown
Contributor

Pull request

Summary

Test plan

  • Not needed: documentation, metadata, or configuration-only change
  • Backend: cargo check
  • Backend: targeted cargo nextest run --lib <filter> or cargo nextest run --test <name> <filter>
  • Frontend: bun run check
  • Frontend: bun run build
  • Manual UI check for user-facing changes

Notes for reviewers

  • Database migrations:
  • Runtime configuration changes:
  • Deployment or upgrade notes:

will36900 and others added 7 commits November 2, 2026 20:13
…cation

Add optional CDN download domain configuration to the Alibaba Cloud OSS
connector. When configured, user-facing download links use the CDN domain
with Alibaba Cloud CDN URL authentication (type A/B/C or none), while
backend operations (read/write, upload, multipart, cleanup) continue to
use the OSS API endpoint.

Implementation:
- Add cdn_domain, cdn_auth_type config fields and cdn_auth_key credential
- Implement CDN URL signing for authentication types A, B, C per official
  Alibaba Cloud CDN documentation
- Validate CDN domain to reject credentials, query, fragment, or path
- Percent-encode object keys and reject path traversal segments
- Mark authentication key as secret to exclude from logs and audit
- DirectDownloadStorageDriver resolves to CDN URL when configured, falls
  back to OSS V4 presigned URL otherwise
- 46 unit tests covering signature formats, encoding, validation, and
  fallback behavior

Documentation:
- Chinese and English admin tutorials cover CDN setup and validation
- CHANGELOG entries in both languages

Related: AsterCommunity#685
…s and validation

Fix critical issues in CDN URL signing found by CodeRabbit review:

**Critical (Major)**:
- Fix type B and C timestamp formats (were using decimal Unix seconds)
  - Type B now uses UTC+8 YYYYMMDDHHMM format (12 digits)
  - Type C now uses hexadecimal Unix timestamp (no 0x prefix)
  - Type A remains using decimal Unix seconds
- Refactor calculate_expiry_timestamp to calculate_expiry_datetime returning DateTime<Utc>

**Configuration & Validation**:
- Change CdnAuthType::from_str to parse() returning Result
  - Empty string and "none" parse to CdnAuthType::None
  - Unknown values return StorageErrorKind::Misconfigured error
- Add validation: auth types requiring signature must provide cdn_auth_key
- Trim cdn_domain before passing to driver to prevent malformed URLs
- Enforce HTTPS-only for CDN domains (security requirement from issue AsterCommunity#685)

**Download Options**:
- Fall back to OSS presigned URL when response_content_disposition is set
  (CDN auth URLs don't support query parameters for response header overrides)

**Documentation**:
- Clarify actual link validity = AsterDrive TTL + CDN console auth duration
- Recommend reducing CDN console validity period for tighter TTL control
- Update both Chinese and English admin documentation

Testing:
- All 50 tests pass including new validation tests
- Updated timestamp format assertions for B/C types
- Added tests for auth key requirement and invalid auth type rejection

Related: AsterCommunity#685, addresses CodeRabbit findings in PR AsterCommunity#694
Reject a policy that sets cdn_domain without cdn_auth_type. Without this
check, a blank auth type is parsed as "none" and the driver silently
serves unauthenticated CDN links.

- Return Misconfigured from validate_config when cdn_domain is set and
  cdn_auth_type is empty; "none" must be chosen explicitly
- Add #[serde(default)] to oss_cdn_domain and oss_cdn_auth_type so
  existing policies without these fields still deserialize
- Replace the empty if branch in resolve_download_url with an
  is_none() check; behavior is unchanged
- Add a test that a response_content_disposition request falls back to
  the OSS presigned URL instead of the CDN URL
- Clarify in the zh/en admin docs that link validity is the AsterDrive
  TTL plus the CDN console auth duration, and use the console's own
  name for that setting
- Add a developer design doc for CDN download delivery

Related: AsterCommunity#685
…ain configuration (AsterCommunity#692)

* feat(storage): support Tencent COS custom source domains (AsterCommunity#455)

* feat(storage)!: replace OBS addressing mode with shared CNAME boolean

BREAKING CHANGE: `obs_addressing_mode` is replaced by boolean
`obs_use_cname`; API clients must use the new field and all nodes
must be upgraded together.

- Replace Huawei OBS select field `obs_addressing_mode` with boolean
  `obs_use_cname` (default `false`) in the connector schema, driver
  config, and signing layer, removing `HuaweiObsAddressingMode`
- Add reversible migration `m20261102_000001_obs_use_cname` that
  rewrites saved policies, remote storage targets, and deferred
  cleanup snapshots in batched transactions, validating conflicting
  or unknown values without logging secrets
- Unify custom-domain switch wording ("Use a custom domain (CNAME)")
  across OSS, OBS, and COS localization and docs
- Update admin API docs, storage backend guides (EN/zh-CN), e2e and
  integration tests to cover OBS CNAME create/edit round-trips and
  runtime driver URL generation
- Document upgrade procedure, down-migration requirement, and CDN
  download authentication tracking in the OBS guide

* fix(storage): preserve legacy COS CNAME defaults and address review findings
…terCommunity#696)

* feat(storage): add private Tencent CDN SHA-256 delivery

* refactor(storage): use exhaustive COS dispatch matches

Cover delivery modes, credentials, SDK signing carriers, actions and HTTP status classification with explicit matches. Surface CDN bearer-link requirements in bilingual caution blocks.
@astercommunity-automation astercommunity-automation Bot added Documentation Improvements or additions to documentation Rust Pull requests that update Rust code TypeScript Pull requests that update JavaScript code Scope: Storage Storage policies, connectors, drivers, provider capabilities, and storage backends Scope: Admin UI Administrator-facing frontend workflows and management interfaces Scope: Files Core file and folder product behavior labels Nov 3, 2026
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@astercommunity-automation

Copy link
Copy Markdown

PR readiness for e4f1a7eafe92

Fact Value
Blocking conditions 1
Waiting conditions 0
Current unresolved threads 0
Current-head approvals 0
Stale latest reviews 0
  • BLOCK: PR Gate: cancelled

This report is deterministic and updated for the current pull request head.

@will36900 will36900 closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Rust Pull requests that update Rust code Scope: Admin UI Administrator-facing frontend workflows and management interfaces Scope: Files Core file and folder product behavior Scope: Storage Storage policies, connectors, drivers, provider capabilities, and storage backends TypeScript Pull requests that update JavaScript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants