diff --git a/.github/scripts/release_rust/README.md b/.github/scripts/release_rust/README.md index 897d398f..d26d8ea7 100644 --- a/.github/scripts/release_rust/README.md +++ b/.github/scripts/release_rust/README.md @@ -18,6 +18,11 @@ The release workflow first runs the complete workspace dry run: cargo publish --workspace --dry-run ``` +That dry run stages the workspace as one set, so it also packages members whose +intra-workspace dependency versions are not on crates.io yet. A single-package +`cargo publish -p --dry-run` does not, and fails before a bootstrap with +a version-selection error for the unpublished dependency. + It then runs `publish.py`. The publisher uploads one package at a time, requests and revokes a fresh GitHub OIDC-derived crates.io token for every attempt, retries crates.io rate limits, and treats an already-published matching diff --git a/AGENTS.md b/AGENTS.md index a6fa22f0..03ba4e67 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -93,19 +93,25 @@ need a JavaScript host clock. ## Versioning -- Existing service crates and core share a lockstep major version (`3.0.0`). -- New provider and shared crates (`reqsign-cloudflare`, `reqsign-b2`, - `reqsign-baidu-netdisk`, `reqsign-oauth2`, `reqsign-dropbox`, - `reqsign-vercel`, `reqsign-koofr`) start - independent `1.0.0` version lines and depend on the current core major. -- `reqsign-aliyun-drive`, `reqsign-github`, `reqsign-onedrive`, and - `reqsign-yandex-disk` start independent `1.0.0` version lines. -- `reqsign-http-send-reqwest` has its own major (`4.0.0`). +- Established service crates and core share a lockstep major version + (`4.0.0`): `reqsign-core`, `reqsign-aws-core`, every established + `reqsign-` service crate, `reqsign-http-message-signatures`, + `reqsign-file-read-tokio`, and `reqsign-command-execute-tokio`. A breaking + change in core bumps this whole line together. +- Provider and shared crates (`reqsign-b2`, `reqsign-aliyun-drive`, + `reqsign-baidu-netdisk`, `reqsign-cloudflare`, `reqsign-dropbox`, + `reqsign-github`, `reqsign-koofr`, `reqsign-oauth2`, `reqsign-onedrive`, + `reqsign-seafile`, `reqsign-upyun`, `reqsign-vercel`, `reqsign-yandex-disk`) + start independent `1.0.0` version lines and depend on the current core major. +- `reqsign-http-send-reqwest` has its own major (`5.0.0`), one major ahead of + the core lockstep. It moves when the core lockstep major changes, so a + reqwest major bump never forces a core major. - `reqsign-crypto-rustcrypto` and `reqsign-crypto-boring` each have independent version lines, starting at `1.0.0`. -- The facade `reqsign` crate follows an independent scheme (`0.20.0`). +- The facade `reqsign` crate follows an independent scheme (`0.21.0`). - Release is triggered by pushing a `v*.*.*` tag; `cargo publish --workspace` - publishes everything. + publishes every crate in the plan. `crypto/boring` is excluded from the root + workspace and needs its own publication decision. ## License diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..1f376bcc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,131 @@ +# Apache Reqsign Changelog + +Release notes for Apache Reqsign. The facade `reqsign` version names the +release; every other crate keeps its own line. Migration steps for the current +major are in +[Upgrading to Reqsign 0.21](website/docs/guides/upgrading-to-0.21.md). + +## 0.21.0 - Unreleased + +0.21 is a coordinated major for the core and the established service crates, +and the first crates.io release of the provider crates added since 0.20.8. It +moves cryptography out of the signing crates into a `CryptoProvider` selected +through the `Context`, passes the `Context` explicitly to facade +`default_signer` helpers, and raises the minimum supported Rust version to +1.87. + +### Breaking changes + +- **Cryptography is resolved through `Context`.** `reqsign-core` and every + `services/*` crate no longer link SHA-1, SHA-256, HMAC, RSA, P-256, or + AES-GCM. `Context::new()` starts unbound; a context without a provider, or a + provider without the requested operation, fails with `ConfigInvalid`. Bind a + provider with `Context::with_crypto`, install one process-wide with + `reqsign_core::crypto::install_default`, or use the facade's + `default_context()`, which binds `RustCryptoProvider` when no global provider + is installed and the `default-crypto` feature is enabled. +- **`reqsign_core::jwt` is removed** together with the core `jwt` feature. Azure + client-certificate and Google service-account flows format RS256 JWS in + private service helpers through the selected provider. Hash and MAC helpers + now take `&dyn CryptoProvider` and return `Result`; Azure + `ServiceSharedAccessSignature::token` takes the resolved provider. +- **Facade `default_signer` takes the `Context` first.** For example + `aws::default_signer(ctx, "s3", "us-east-1")`. The `default-context` feature + no longer gates `DefaultSigner` or `default_signer`; both exist whenever the + service feature is enabled. +- **`Signer::with_context` isolates the credential cache** instead of reusing + the previous context's cached credential, because a different context can + resolve a different identity. Use `with_request_signer` or + `with_credential_granter` to keep the cache. +- **OBS and TOS `Credential` gained `expires_at`**, which breaks struct-literal + construction. Use `Credential::new` plus `with_expires_at` (and + `with_session_token` for TOS). + +### Added + +- Crypto backend crates `reqsign-crypto-rustcrypto` (workspace member, + `wasm32-unknown-unknown` for its supported subset) and + `reqsign-crypto-boring` (native-only, excluded from the main workspace, + optional `fips` feature), both `1.0.0`. +- Provider crates and facade features, all first release at `1.0.0`: + `reqsign-aliyun-drive`, `reqsign-b2` (facade feature `b2`), + `reqsign-baidu-netdisk`, `reqsign-cloudflare`, `reqsign-dropbox`, + `reqsign-github`, `reqsign-koofr`, `reqsign-oauth2`, `reqsign-onedrive`, + `reqsign-seafile`, `reqsign-upyun`, `reqsign-vercel`, `reqsign-yandex-disk`. +- `reqsign-http-message-signatures` for RFC 9421 request signing, facade + feature `http-message-signatures`. +- Shared OAuth 2.0 refresh grants and OpenStack static-token credentials and + Swift TempURL presigning. +- Optional MD5 and HMAC-SHA512 provider operations. +- Opt-in IMDSv1 fallback for AWS credentials, and AssumeRole providers that + honor STS endpoint settings. + +### Changed + +- Minimum supported Rust version is 1.87.0. The RustCrypto backend's + `rsa 0.10.0` requirement is the reason. +- The facade `default` feature enables `default-context` and `default-crypto`. +- Lockstep major `4.0.0` for `reqsign-core`, `reqsign-aws-core`, every + established service crate, `reqsign-file-read-tokio`, and + `reqsign-command-execute-tokio`. `reqsign-http-send-reqwest` moves to + `5.0.0`, its own line offset from the core major. + +### Carried over from the v0.20.9 release candidate + +The 0.21 source also contains the changes prepared for v0.20.9, which had not +reached crates.io when this release was prepared. If the v0.20.9 vote completes +first, these reach users there and this section only records that 0.21 includes +them: + +- AWS SSO-backed assume-role profile chains, S3 Express session-token selection + by service, and configurable SigV4 canonical URI encoding. +- Google service-account OAuth2 token caching for the request signer. +- Oracle caller-supplied request body-header signing and profile field + inheritance. +- Huawei Cloud OBS IAM agency granter, Volcengine TOS STS `AssumeRole` granter, + and Tencent COS `GetFederationToken` granter. +- Absolute credential expiry for OBS and TOS (see breaking changes above). +- OpenStack catalog search across all matching entries. +- Credential and security-token redaction in OBS and TOS debug output. + +### Crate versions + +| Crate | 0.21.0 | +| --- | --- | +| `reqsign` | 0.21.0 | +| `reqsign-core` | 4.0.0 | +| `reqsign-command-execute-tokio` | 4.0.0 | +| `reqsign-file-read-tokio` | 4.0.0 | +| `reqsign-http-send-reqwest` | 5.0.0 | +| `reqsign-aws-core` | 4.0.0 | +| `reqsign-aws-v4` | 4.0.0 | +| `reqsign-aws-v4a` | 4.0.0 | +| `reqsign-aliyun-oss` | 4.0.0 | +| `reqsign-azure-storage` | 4.0.0 | +| `reqsign-google` | 4.0.0 | +| `reqsign-huaweicloud-obs` | 4.0.0 | +| `reqsign-http-message-signatures` | 4.0.0 | +| `reqsign-openstack-keystone` | 4.0.0 | +| `reqsign-oracle` | 4.0.0 | +| `reqsign-tencent-cos` | 4.0.0 | +| `reqsign-volcengine-tos` | 4.0.0 | +| `reqsign-crypto-rustcrypto` | 1.0.0 | +| `reqsign-crypto-boring` | 1.0.0 (published outside the workspace) | +| `reqsign-aliyun-drive` | 1.0.0 | +| `reqsign-b2` | 1.0.0 | +| `reqsign-baidu-netdisk` | 1.0.0 | +| `reqsign-cloudflare` | 1.0.0 | +| `reqsign-dropbox` | 1.0.0 | +| `reqsign-github` | 1.0.0 | +| `reqsign-koofr` | 1.0.0 | +| `reqsign-oauth2` | 1.0.0 | +| `reqsign-onedrive` | 1.0.0 | +| `reqsign-seafile` | 1.0.0 | +| `reqsign-upyun` | 1.0.0 | +| `reqsign-vercel` | 1.0.0 | +| `reqsign-yandex-disk` | 1.0.0 | + +## Earlier releases + +Release notes before 0.21.0 were published with each +[GitHub release](https://github.com/apache/reqsign/releases). diff --git a/Cargo.toml b/Cargo.toml index 4d600cdd..73a1735b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,34 +29,34 @@ rust-version = "1.87.0" [workspace.dependencies] # Workspace dependencies reqsign-aliyun-drive = { version = "1.0.0", path = "services/aliyun-drive" } -reqsign-aliyun-oss = { version = "3.2.2", path = "services/aliyun-oss" } -reqsign-aws-core = { version = "3.4.0", path = "services/aws-core" } -reqsign-aws-v4 = { version = "3.5.0", path = "services/aws-v4" } -reqsign-aws-v4a = { version = "3.2.0", path = "services/aws-v4a" } -reqsign-azure-storage = { version = "3.3.2", path = "services/azure-storage" } +reqsign-aliyun-oss = { version = "4.0.0", path = "services/aliyun-oss" } +reqsign-aws-core = { version = "4.0.0", path = "services/aws-core" } +reqsign-aws-v4 = { version = "4.0.0", path = "services/aws-v4" } +reqsign-aws-v4a = { version = "4.0.0", path = "services/aws-v4a" } +reqsign-azure-storage = { version = "4.0.0", path = "services/azure-storage" } reqsign-b2 = { version = "1.0.0", path = "services/b2" } reqsign-baidu-netdisk = { version = "1.0.0", path = "services/baidu-netdisk" } reqsign-cloudflare = { version = "1.0.0", path = "services/cloudflare" } -reqsign-command-execute-tokio = { version = "3.0.9", path = "context/command-execute-tokio" } -reqsign-core = { version = "3.3.4", path = "core" } +reqsign-command-execute-tokio = { version = "4.0.0", path = "context/command-execute-tokio" } +reqsign-core = { version = "4.0.0", path = "core" } reqsign-crypto-rustcrypto = { version = "1.0.0", path = "crypto/rustcrypto" } reqsign-dropbox = { version = "1.0.0", path = "services/dropbox" } -reqsign-file-read-tokio = { version = "3.0.9", path = "context/file-read-tokio" } +reqsign-file-read-tokio = { version = "4.0.0", path = "context/file-read-tokio" } reqsign-github = { version = "1.0.0", path = "services/github" } -reqsign-google = { version = "3.4.0", path = "services/google" } -reqsign-http-send-reqwest = { version = "4.0.9", path = "context/http-send-reqwest" } -reqsign-huaweicloud-obs = { version = "3.1.0", path = "services/huaweicloud-obs" } -reqsign-http-message-signatures = { version = "3.0.0", path = "services/http-message-signatures" } +reqsign-google = { version = "4.0.0", path = "services/google" } +reqsign-http-send-reqwest = { version = "5.0.0", path = "context/http-send-reqwest" } +reqsign-huaweicloud-obs = { version = "4.0.0", path = "services/huaweicloud-obs" } +reqsign-http-message-signatures = { version = "4.0.0", path = "services/http-message-signatures" } reqsign-koofr = { version = "1.0.0", path = "services/koofr" } reqsign-oauth2 = { version = "1.0.0", path = "services/oauth2" } reqsign-onedrive = { version = "1.0.0", path = "services/onedrive" } -reqsign-openstack-keystone = { version = "3.0.1", path = "services/openstack-keystone" } -reqsign-oracle = { version = "3.1.0", path = "services/oracle" } +reqsign-openstack-keystone = { version = "4.0.0", path = "services/openstack-keystone" } +reqsign-oracle = { version = "4.0.0", path = "services/oracle" } reqsign-seafile = { version = "1.0.0", path = "services/seafile" } -reqsign-tencent-cos = { version = "3.1.0", path = "services/tencent-cos" } +reqsign-tencent-cos = { version = "4.0.0", path = "services/tencent-cos" } reqsign-upyun = { version = "1.0.0", path = "services/upyun" } reqsign-vercel = { version = "1.0.0", path = "services/vercel" } -reqsign-volcengine-tos = { version = "3.2.0", path = "services/volcengine-tos" } +reqsign-volcengine-tos = { version = "4.0.0", path = "services/volcengine-tos" } reqsign-yandex-disk = { version = "1.0.0", path = "services/yandex-disk" } # Crates.io dependencies diff --git a/context/command-execute-tokio/Cargo.toml b/context/command-execute-tokio/Cargo.toml index 2cfa3eb6..e8fe81bf 100644 --- a/context/command-execute-tokio/Cargo.toml +++ b/context/command-execute-tokio/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-command-execute-tokio" -version = "3.0.9" +version = "4.0.0" categories = ["asynchronous"] description = "Tokio-based command execution implementation for reqsign" diff --git a/context/file-read-tokio/Cargo.toml b/context/file-read-tokio/Cargo.toml index fb582915..11cd1b5e 100644 --- a/context/file-read-tokio/Cargo.toml +++ b/context/file-read-tokio/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-file-read-tokio" -version = "3.0.9" +version = "4.0.0" categories = ["asynchronous"] description = "Tokio-based file reader implementation for reqsign" diff --git a/context/http-send-reqwest/Cargo.toml b/context/http-send-reqwest/Cargo.toml index 50d70d5f..bf570ef1 100644 --- a/context/http-send-reqwest/Cargo.toml +++ b/context/http-send-reqwest/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-http-send-reqwest" -version = "4.0.9" +version = "5.0.0" categories = ["asynchronous"] description = "Reqwest-based HTTP client implementation for reqsign." diff --git a/core/Cargo.toml b/core/Cargo.toml index 4f545b9c..2d49b18f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-core" -version = "3.3.4" +version = "4.0.0" categories = ["command-line-utilities", "web-programming"] description = "Signing API requests without effort." diff --git a/core/README.md b/core/README.md index b88b837c..2bd5477e 100644 --- a/core/README.md +++ b/core/README.md @@ -29,6 +29,22 @@ signer.sign(&mut parts, None).await?; - **Environment Integration**: Access environment variables through the Context - **Type Safety**: Strong typing ensures compile-time correctness +## Changelog: 4.0.0 + +- Cryptography moved behind `reqsign_core::crypto::CryptoProvider`, resolved + through the `Context`: an explicit `Context::with_crypto` binding, then the + process-wide `install_default`, otherwise `ConfigInvalid` at the point of use. + `Context::new()` starts unbound and the crate links no cryptographic + implementation. Use `reqsign-crypto-rustcrypto` (or another backend) to bind + one. +- The `jwt` module and `jwt` feature are removed. Hash and MAC helpers take + `&dyn CryptoProvider` and return `Result`; services format their own RS256 + JWS through the selected provider. +- `Signer::with_context` isolates the credential cache instead of reusing the + previous context's cached credential. `with_request_signer` and + `with_credential_granter` keep the cache. +- The minimum supported Rust version is 1.87.0. + ## Core Concepts ### Context diff --git a/crypto/boring/Cargo.toml b/crypto/boring/Cargo.toml index cb1e5a90..41a336cc 100644 --- a/crypto/boring/Cargo.toml +++ b/crypto/boring/Cargo.toml @@ -32,15 +32,15 @@ fips = ["boring/fips"] [dependencies] boring = "5.5.1" -reqsign-core = { version = "3.3.4", path = "../../core" } +reqsign-core = { version = "4.0.0", path = "../../core" } [dev-dependencies] hex = "0.4" hmac = "0.13" http = "1" p256 = { version = "0.14.0", default-features = false, features = ["ecdsa"] } -reqsign-aws-core = { version = "3.4.0", path = "../../services/aws-core" } -reqsign-aws-v4 = { version = "3.5.0", path = "../../services/aws-v4" } +reqsign-aws-core = { version = "4.0.0", path = "../../services/aws-core" } +reqsign-aws-v4 = { version = "4.0.0", path = "../../services/aws-v4" } reqsign-crypto-rustcrypto = { version = "1.0.0", path = "../rustcrypto" } sha2 = "0.11" tokio = { version = "1", features = ["macros", "rt"] } diff --git a/release/SKILL.md b/release/SKILL.md index 90d2f0c0..99824f4f 100644 --- a/release/SKILL.md +++ b/release/SKILL.md @@ -21,6 +21,11 @@ Use this skill when preparing or executing an Apache Reqsign release. ## Release Preparation +Prepare, then reserve, then vote, then publish. The order is: version and notes +PR merged into `main`; reserve every missing crate name with the bootstrap +workflow; RC tag and source artifact; vote; formal tag from the voted commit; +Release workflow publishes the plan; GitHub Release from `CHANGELOG.md`. + 1. Sync live state. ```bash @@ -34,13 +39,34 @@ Use this skill when preparing or executing an Apache Reqsign release. 2. Prepare version bump on a PR. - Typical version policy: - - - `reqsign`: patch bump, for example `0.20.0 -> 0.20.1`. - - Crate with new public capability: minor bump, for example `reqsign-aliyun-oss 3.0.0 -> 3.1.0`. - - New provider crates use independent versions starting at `1.0.0`; bump them by their own change, not the core lockstep. - - Other workspace crates published in the same workspace release: patch bump. - - Keep root `[workspace.dependencies]` version requirements aligned with each crate manifest. + Version policy by track. The current line is facade `0.21.0`, lockstep + `4.0.0`, reqwest adapter `5.0.0`, and `1.0.0` for first-release crates. + + - `reqsign`: patch bump for a compatible release, for example + `0.21.0 -> 0.21.1`. A breaking or feature release takes the next `0.x` + minor because 0.x minors are the facade's breaking channel. + - Core and the established service line (`reqsign-core`, `reqsign-aws-core`, + every established `reqsign-` crate, + `reqsign-http-message-signatures`, `reqsign-file-read-tokio`, + `reqsign-command-execute-tokio`): bump the whole line together. A breaking + core change, including a lockstep major, moves every crate on it to the + same major. A new public capability without a break takes a minor. + - `reqsign-http-send-reqwest`: patch or minor by its own change, and a major + whenever the core lockstep major changes. It stays one major ahead of core. + - Provider and shared crates on independent `1.0.0` lines + (`reqsign-cloudflare`, the B2 crate, `reqsign-baidu-netdisk`, + `reqsign-oauth2`, `reqsign-dropbox`, `reqsign-aliyun-drive`, + `reqsign-github`, `reqsign-onedrive`, `reqsign-seafile`, `reqsign-upyun`, + `reqsign-vercel`, `reqsign-yandex-disk`, `reqsign-koofr`): keep `1.0.0` + until the first publication, then bump by their own change. + - `reqsign-crypto-rustcrypto` and `reqsign-crypto-boring`: independent + `1.0.0` lines, bumped by their own change. + - Keep root `[workspace.dependencies]` version requirements equal to each + crate manifest version, and update the standalone + `crypto/boring/Cargo.toml` bounds separately because that crate is outside + the workspace. + - Add the release-notes entry to `CHANGELOG.md` and the migration steps to + `website/docs/guides/` in the same PR. 3. Validate the publish plan and packages. @@ -52,6 +78,46 @@ Use this skill when preparing or executing an Apache Reqsign release. cargo publish --workspace --dry-run --allow-dirty ``` + `cargo publish --workspace --dry-run` stages the workspace as one set, so it + packages members whose intra-workspace dependencies are not on crates.io yet. + Do not substitute a per-package `cargo publish -p --dry-run` before + bootstrap: it fails with a version-selection error such as + `failed to select a version for the requirement reqsign-core = "^4.0.0"` + because that dependency version is unpublished. Use the per-package form only + after bootstrap, when every dependency version in the plan exists on + crates.io. + + Inventory the plan against the registry before asking for a bootstrap. The + check is read-only and needs no credentials: + + ```bash + python3 - <<'EOF' + import json, subprocess, urllib.request, urllib.error + plan = json.loads(subprocess.check_output( + ["python3", ".github/scripts/release_rust/plan.py"], text=True)) + for package in plan: + request = urllib.request.Request( + f"https://crates.io/api/v1/crates/{package['name']}", + headers={"User-Agent": "reqsign-release"}) + try: + published = [v["num"] for v in + json.load(urllib.request.urlopen(request, timeout=20))["versions"]] + except urllib.error.HTTPError as error: + if error.code != 404: + raise + print(f"missing name: {package['name']}") + continue + if package["version"] in published: + print(f"already published: {package['name']} {package['version']}") + EOF + ``` + + Every `missing name` must be reserved by the bootstrap workflow before the + RC tag, and no line may report an already-published planned version. The + 0.21.0 preparation started from 31 workspace packages: 15 missing names plus + 16 published crates, and the standalone `reqsign-crypto-boring` as a + separately inventoried name. + 4. Merge the version bump PR into `main`. Do not create the RC tag from an unmerged side branch unless the release manager explicitly accepts that the voted commit will not be on `main`. @@ -84,8 +150,10 @@ The helper: `trustpub_only` enabled. The protected job authenticates ownership and audits the complete publish plan -before any write. Established crates must already have exactly one Trusted -Publisher with: +before any write. A Trusted Publisher cannot be configured for a name that does +not exist on crates.io yet, so every missing name is resolved by the bootstrap +first: the `0.0.0` reservation is what makes the publisher configuration +possible. Existing crates must already have exactly one Trusted Publisher with: - Repository owner: `apache` - Repository name: `reqsign` @@ -98,6 +166,15 @@ each. For a missing name, the workflow publishes a dependency-free `0.0.0` placeholder, creates the expected Trusted Publisher, enables `trustpub_only`, and reconciles partial placeholders on rerun. +The `rust-bootstrap` environment in `.asf.yaml` accepts dispatches only from +`main`, requires reviewers, and sets `prevent_self_review`, so a dispatch by the +release manager still needs one of the other configured reviewers to approve. +The helper's public verification uses unauthenticated crates.io data and covers +name existence, the reservation version, and `trustpub_only`. The authenticated +preflight inside the job covers ownership and publisher metadata; the two checks +have different scopes, and the public one is not a substitute for the preflight. +The last successful reservation run for this repository was `43195429526`. + ASF Infrastructure provisions the `release` and `rust-bootstrap` environments from `.asf.yaml`. A PMC release manager must add `CARGO_REGISTRY_BOOTSTRAP_TOKEN` to the `rust-bootstrap` environment. The token @@ -108,6 +185,19 @@ release workflow. Run the helper again if the publish plan gains another crate after a successful bootstrap. +### What the workspace publish covers + +`cargo publish --workspace` publishes every root workspace member that allows +the crates.io registry, in dependency order, and `plan.py` is the authoritative +list. `crypto/boring` is excluded from the root workspace +(`exclude = ["crypto/boring"]`), so `reqsign-crypto-boring` is not in +`plan.py`, not packaged by the Release workflow, and not covered by the +bootstrap. Publishing it needs its own explicit decision and publishing path, +including its own crates.io Trusted Publisher, and it is out of scope for a +workspace release unless the release manager says otherwise. Its dependency +version bounds in `crypto/boring/Cargo.toml` are not inherited from the root +workspace, so align them by hand in the same preparation PR. + ## Create RC Tag Create the RC tag from the merged version-bump commit on `main`. @@ -324,7 +414,9 @@ NAME 7. Create a GitHub Release. - Use the formal tag and include source artifact links, notable changes, and crate versions. + Use the formal tag. The `0.21.0` section of `CHANGELOG.md` is the release + notes source: keep its notable changes and crate-version table, and add the + source artifact links. ## Recovery Notes diff --git a/reqsign/Cargo.toml b/reqsign/Cargo.toml index 55f03bbb..6d886dce 100644 --- a/reqsign/Cargo.toml +++ b/reqsign/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign" -version = "0.20.9" +version = "0.21.0" categories = ["authentication", "web-programming::http-client"] description = "Signing HTTP requests for AWS, Azure, Cloudflare, Dropbox, GitHub, Google, Huawei, Aliyun, Tencent, Oracle, Vercel and Seafile services" diff --git a/reqsign/README.md b/reqsign/README.md index 974193c7..50a7dd77 100644 --- a/reqsign/README.md +++ b/reqsign/README.md @@ -23,6 +23,13 @@ This crate provides a unified interface for signing HTTP requests across multipl - **Vercel**: Vercel Blob and Artifacts (Turborepo Remote Cache) bearer tokens - **Seafile**: Seafile Web API services +## Upgrading + +0.21 moves the core and the established service crates to `4.0.0` and makes +cryptography and the runtime `Context` explicit. The migration steps, including +`default_signer(ctx, ...)` and the `CryptoProvider` binding, are in +[Upgrading to Reqsign 0.21](https://github.com/apache/reqsign/blob/main/website/docs/guides/upgrading-to-0.21.md). + ## Request URI Contract Requests passed to the built-in signers must already contain a valid, wire-ready URI @@ -48,7 +55,7 @@ Add `reqsign` to your `Cargo.toml`: ```toml [dependencies] -reqsign = "0.20" +reqsign = "0.21" ``` By default, this includes `default-context` (a ready-to-use context using @@ -63,7 +70,7 @@ To use specific services only: ```toml [dependencies] -reqsign = { version = "0.20", default-features = false, features = ["aws", "default-context"] } +reqsign = { version = "0.21", default-features = false, features = ["aws", "default-context"] } ``` ## Examples @@ -280,6 +287,6 @@ This crate supports WebAssembly (WASM) targets. However, the `default-context` f Example for WASM: ```toml [dependencies] -reqsign = { version = "0.20", default-features = false, features = ["aws"] } -reqsign-http-send-reqwest = "4" +reqsign = { version = "0.21", default-features = false, features = ["aws"] } +reqsign-http-send-reqwest = "5" ``` diff --git a/services/aliyun-oss/Cargo.toml b/services/aliyun-oss/Cargo.toml index 80a1d5c2..fbf21581 100644 --- a/services/aliyun-oss/Cargo.toml +++ b/services/aliyun-oss/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-aliyun-oss" -version = "3.2.2" +version = "4.0.0" description = "Aliyun OSS signing implementation for reqsign." diff --git a/services/aws-core/Cargo.toml b/services/aws-core/Cargo.toml index 8898f3b4..d4506f08 100644 --- a/services/aws-core/Cargo.toml +++ b/services/aws-core/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-aws-core" -version = "3.4.0" +version = "4.0.0" description = "Shared AWS credential and request canonicalization support for reqsign." diff --git a/services/aws-v4/Cargo.toml b/services/aws-v4/Cargo.toml index 4668fbe3..f603b104 100644 --- a/services/aws-v4/Cargo.toml +++ b/services/aws-v4/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-aws-v4" -version = "3.5.0" +version = "4.0.0" description = "AWS SigV4 signing implementation for reqsign." diff --git a/services/aws-v4a/Cargo.toml b/services/aws-v4a/Cargo.toml index 4cd4e2b3..69990816 100644 --- a/services/aws-v4a/Cargo.toml +++ b/services/aws-v4a/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-aws-v4a" -version = "3.2.0" +version = "4.0.0" description = "AWS SigV4a signing implementation for reqsign." diff --git a/services/azure-storage/Cargo.toml b/services/azure-storage/Cargo.toml index b944f85b..d83210c2 100644 --- a/services/azure-storage/Cargo.toml +++ b/services/azure-storage/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-azure-storage" -version = "3.3.2" +version = "4.0.0" description = "Azure Storage signing implementation for reqsign." diff --git a/services/google/Cargo.toml b/services/google/Cargo.toml index 7cb739ac..0074e35f 100644 --- a/services/google/Cargo.toml +++ b/services/google/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-google" -version = "3.4.0" +version = "4.0.0" description = "Google Cloud Platform signing implementation for reqsign." diff --git a/services/http-message-signatures/Cargo.toml b/services/http-message-signatures/Cargo.toml index 5c5803b0..831681f4 100644 --- a/services/http-message-signatures/Cargo.toml +++ b/services/http-message-signatures/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-http-message-signatures" -version = "3.0.0" +version = "4.0.0" categories = ["authentication", "web-programming::http-client"] description = "RFC 9421 HTTP Message Signatures for reqsign." diff --git a/services/huaweicloud-obs/Cargo.toml b/services/huaweicloud-obs/Cargo.toml index e93bd3bc..42765333 100644 --- a/services/huaweicloud-obs/Cargo.toml +++ b/services/huaweicloud-obs/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-huaweicloud-obs" -version = "3.1.0" +version = "4.0.0" description = "Huawei Cloud OBS signing implementation for reqsign." diff --git a/services/openstack-keystone/Cargo.toml b/services/openstack-keystone/Cargo.toml index 4bb6ccc4..7d564fc8 100644 --- a/services/openstack-keystone/Cargo.toml +++ b/services/openstack-keystone/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-openstack-keystone" -version = "3.0.1" +version = "4.0.0" description = "OpenStack Keystone authentication implementation for reqsign." diff --git a/services/oracle/Cargo.toml b/services/oracle/Cargo.toml index 83da4ee2..f408c942 100644 --- a/services/oracle/Cargo.toml +++ b/services/oracle/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-oracle" -version = "3.1.0" +version = "4.0.0" description = "Oracle Cloud signing implementation for reqsign." diff --git a/services/tencent-cos/Cargo.toml b/services/tencent-cos/Cargo.toml index 2a668a6e..7220bd46 100644 --- a/services/tencent-cos/Cargo.toml +++ b/services/tencent-cos/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-tencent-cos" -version = "3.1.0" +version = "4.0.0" description = "Tencent Cloud COS signing implementation for reqsign." diff --git a/services/volcengine-tos/Cargo.toml b/services/volcengine-tos/Cargo.toml index 75b23985..d8133c1f 100644 --- a/services/volcengine-tos/Cargo.toml +++ b/services/volcengine-tos/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "reqsign-volcengine-tos" -version = "3.2.0" +version = "4.0.0" description = "Volcengine TOS signing implementation for reqsign." diff --git a/website/docs/architecture.md b/website/docs/architecture.md index 1f45850e..a690393b 100644 --- a/website/docs/architecture.md +++ b/website/docs/architecture.md @@ -315,8 +315,8 @@ letting the application choose context implementations: ```toml [dependencies] -reqsign-core = "3" -reqsign-aws-v4 = "3" +reqsign-core = "4" +reqsign-aws-v4 = "4" ``` | You are building | Use | diff --git a/website/docs/guides/upgrading-to-0.21.md b/website/docs/guides/upgrading-to-0.21.md new file mode 100644 index 00000000..1940aa0e --- /dev/null +++ b/website/docs/guides/upgrading-to-0.21.md @@ -0,0 +1,278 @@ +--- +title: Upgrading to Reqsign 0.21 +sidebar_label: Upgrade to 0.21 +description: Migrate to reqsign 0.21, reqsign-core 4.0, explicit contexts, and CryptoProvider-based cryptography. +--- + + + +# Upgrading to Reqsign 0.21 + +0.21 moves the core and every established service crate to one new lockstep +major (`4.0.0`), publishes the provider crates added since 0.20.8, and removes +cryptographic implementations from the signing crates. Most applications need +three steps: + +1. Update the facade to `0.21` and let it pull the matching `4.0.0` components. +2. Make sure the `Context` handed to a signer can resolve a `CryptoProvider`. +3. Pass the `Context` explicitly to `default_signer`. + +Everything else on this page is the detail behind those steps. + +## Dependency versions + +| Crate | 0.20 line | 0.21 line | +| --- | --- | --- | +| `reqsign` | `0.20.x` | `0.21.x` | +| `reqsign-core`, `reqsign-aws-core`, every established service crate, `reqsign-file-read-tokio`, `reqsign-command-execute-tokio` | `3.x` | `4.0.0` | +| `reqsign-http-send-reqwest` | `4.0.x` | `5.0.0` | +| `reqsign-crypto-rustcrypto`, `reqsign-crypto-boring` | — | `1.0.0` | +| `reqsign-aliyun-drive`, `reqsign-baidu-netdisk`, `reqsign-cloudflare`, `reqsign-dropbox`, `reqsign-github`, `reqsign-koofr`, `reqsign-oauth2`, `reqsign-onedrive`, `reqsign-seafile`, `reqsign-upyun`, `reqsign-vercel`, `reqsign-yandex-disk`, and the B2 crate `reqsign-b2` | — | `1.0.0` | + +Mixing core majors does not compile, because the traits are the compatibility +boundary. Upgrade the facade and every directly used `reqsign-*` crate in the +same change: + +```toml +[dependencies] +reqsign = "0.21" + +# Only if you use these crates directly: +reqsign-core = "4" +reqsign-aws-v4 = "4" +reqsign-http-send-reqwest = "5" +``` + +## Cryptography now comes from the context + +Reqsign no longer links SHA-1, SHA-256, HMAC, RSA, P-256, or AES-GCM into +`reqsign-core` or any service crate. Signing resolves a +`reqsign_core::crypto::CryptoProvider` through the `Context`, in this order: + +1. `Context::with_crypto(provider)` — explicit binding, highest priority. +2. `reqsign_core::crypto::install_default(provider)` — process-wide + registration. +3. Otherwise `ErrorKind::ConfigInvalid` at the point of use. + +`Context::new()` and `Context::default()` start unbound. Signing with an +unbound context fails instead of silently using a bundled implementation. + +### Facade users + +`default_context()` keeps working. With the `default-crypto` feature, which is +part of `default`, it binds `RustCryptoProvider` when the process-wide slot is +empty; it never installs the global provider itself. No startup boilerplate is +required: + +```rust +use reqsign::{aws, default_context}; + +let ctx = default_context(); +let signer = aws::default_signer(ctx, "s3", "us-east-1"); +``` + +To choose a single backend for the whole application, install it before +constructing contexts. Contexts that already bound RustCrypto keep that +binding; explicit `with_crypto` always wins: + +```rust +use reqsign::RustCryptoProvider; + +// Returns Err when another component already installed a provider. +RustCryptoProvider::install_default() + .map_err(|_| "a CryptoProvider is already installed")?; +``` + +Middleware and libraries should not install a global provider. They should +accept the caller's `Context` instead. + +### Bare `reqsign-core` users + +```rust +use reqsign_core::{Context, OsEnv, Signer}; +use reqsign_crypto_rustcrypto::RustCryptoProvider; + +let ctx = Context::new() + .with_crypto(RustCryptoProvider::new()) + .with_env(OsEnv); +``` + +### Custom providers + +Implement `reqsign_core::crypto::CryptoProvider`. `sha1`, `sha256`, +`hmac_sha1`, and `hmac_sha256` are mandatory; the remaining operations have +default implementations that return `ConfigInvalid` so a minimal provider can +serve the services that only need hashing and MACs. + +A provider or operation that is missing is a non-retryable `ConfigInvalid`. +Malformed key material is `CredentialInvalid`. Backend failures are +`Unexpected`. + +The generic credential chain continues past provider errors and returns +`Ok(None)` when every source is exhausted, so a missing provider discovered +while loading credentials can surface as `CredentialInvalid` from +`Signer::sign` with the request unchanged. Bind or install a provider before +loading credentials to see the `ConfigInvalid` failure itself. + +### Removed and changed crypto APIs + +- The public `reqsign_core::jwt` module and the `jwt` feature are removed. Azure + client-certificate and Google service-account flows format RS256 JWS + internally through the resolved provider. Callers that used `reqsign_core::jwt` + must call `CryptoProvider::rsa_pkcs1v15_sha256_sign` and format the JWS + themselves. +- Hash and MAC helpers take a provider and return `Result`: + + ```rust + // 0.20 + let digest = reqsign_core::hash::hex_sha256(body); + + // 0.21 + let digest = reqsign_core::hash::hex_sha256(ctx.crypto_provider()?, body)?; + ``` + +- Azure `ServiceSharedAccessSignature::token` takes the resolved provider: + `sas.token(ctx.crypto_provider()?)?`. +- Base64 helpers (`base64_encode`, `base64_decode`) are unchanged. + +### Backend crates + +- `reqsign-crypto-rustcrypto` implements all operations and supports + `wasm32-unknown-unknown` for SHA-1, SHA-256, HMAC-SHA-1/256, and P-256 ECDSA. + RSA, AES-GCM, and random generation report `ConfigInvalid` there. +- `reqsign-crypto-boring` is native-only, excluded from the main workspace, and + forwards an optional `fips` feature. Bind it explicitly: + `Context::new().with_crypto(BoringCryptoProvider::new())`. + +## Default signers take an explicit `Context` + +Every per-service `default_signer` now takes the context as its first argument. +The `default-context` feature no longer gates `DefaultSigner` or +`default_signer`: they exist whenever the service feature is enabled, including +custom-runtime and WASM builds. + +```rust +// 0.20 +let signer = reqsign::aws::default_signer("s3", "us-east-1"); +let signer = reqsign::azure::default_signer(); + +// 0.21 +let ctx = reqsign::default_context(); +let signer = reqsign::aws::default_signer(ctx.clone(), "s3", "us-east-1"); +let signer = reqsign::azure::default_signer(ctx); +``` + +Passing one shared context lets several signers and granters reuse the same +HTTP client and credential adapters instead of building a new runtime per +call. + +`Signer::with_context` also changed: replacing the context now creates an +isolated, empty credential cache, because a different context can resolve a +different identity. To replace only the signing operation and keep the cached +credential, use `with_request_signer` or `with_credential_granter`. + +## Minimum supported Rust version is 1.87 + +The RustCrypto backend's `rsa 0.10` dependency requires Rust 1.87, and the +workspace declares `rust-version = "1.87.0"`. Builds on Rust 1.86 fail during +dependency resolution. + +## New provider crates + +These crates and facade features are published for the first time at `1.0.0`. +They depend on `reqsign-core` 4 and follow the same `Context` and signing +contracts as the established services: + +| Facade feature | Crate | Scope | +| --- | --- | --- | +| `aliyun-drive` | `reqsign-aliyun-drive` | Aliyun Drive Open Platform OAuth and bearer signing | +| `b2` | `reqsign-b2` | Backblaze B2 Native API | +| `baidu-netdisk` | `reqsign-baidu-netdisk` | Baidu Netdisk static access-token query signing | +| `cloudflare` | `reqsign-cloudflare` | Cloudflare API token requests (KV, D1) | +| `dropbox` | `reqsign-dropbox` | Dropbox OAuth 2.0 bearer authentication | +| `github` | `reqsign-github` | GitHub.com bearer tokens and anonymous public access | +| `koofr` | `reqsign-koofr` | Koofr access-token exchange and request signing | +| `oauth2` | `reqsign-oauth2` | Shared OAuth 2.0 refresh grants | +| `onedrive` | `reqsign-onedrive` | Microsoft Graph OAuth 2.0 bearer authentication | +| `seafile` | `reqsign-seafile` | Seafile account-token authentication | +| `upyun` | `reqsign-upyun` | UPYUN header signing | +| `vercel` | `reqsign-vercel` | Vercel Blob and Artifacts bearer tokens | +| `yandex-disk` | `reqsign-yandex-disk` | Yandex Disk OAuth credentials and signing | + +`reqsign-http-message-signatures` (RFC 9421, facade feature +`http-message-signatures`) is also new; it joins the lockstep line and starts at +`4.0.0` so it composes with `reqsign-core` 4. + +Baidu Netdisk has no ambient credential source, so the caller supplies the +token: + +```rust +use reqsign::{baidu_netdisk, default_context}; + +let ctx = default_context(); +let signer = baidu_netdisk::default_signer(ctx, access_token); +``` + +The caller still owns request policy, such as the `User-Agent` Baidu requires +on download requests. Reqsign only signs the `access_token` query parameter and +preserves the rest of the wire query. + +## OBS and TOS credentials carry an absolute expiry + +The Huawei Cloud OBS and Volcengine TOS `Credential` types gained +`expires_at: Option` in the v0.20.9 release-candidate source. That +public field breaks struct-literal construction: + +```rust +// 0.20 and earlier +let credential = obs::Credential { + access_key_id, + secret_access_key, + security_token, +}; + +// 0.21, Huawei Cloud OBS: the constructor keeps the security token and leaves +// the expiration unset. +let credential = obs::Credential::new(access_key_id, secret_access_key, security_token) + .with_expires_at(expires_at); + +// 0.21, Volcengine TOS: the constructor takes only the key pair. +let credential = tos::Credential::new(&access_key_id, &secret_access_key) + .with_session_token(&security_token) + .with_expires_at(expires_at); +``` + +Header signing and presigning reject known-expiry credentials that do not cover +the requested operation deadline; presigning checks the full lifetime of the +signed URL. The STS granters (`AssumeRole` for TOS, IAM `Agency` for OBS) and +Tencent COS `GetFederationToken` return credentials that carry the exact +cloud-side expiration. + +These changes already landed in the v0.20.9 release-candidate source, so they +are new relative to the published 0.20.8 crates. If the v0.20.9 vote completes +first, they reach crates.io there; the 0.21 release carries them either way. + +## Behavior preserved + +Wire formats are unchanged: AWS SigV4/SigV4a, Azure Storage SAS/shared +key/client certificate, Google signed URLs and CAB tokens, Oracle, Aliyun OSS, +Huawei Cloud OBS, Tencent COS, and Volcengine TOS keep their canonicalization +and encodings. `Signer::sign` is still atomic: on error, the request head is +unchanged; on success, only the URI and headers may change. diff --git a/website/docs/reference/versioning-and-targets.md b/website/docs/reference/versioning-and-targets.md index a22d655d..96e2126e 100644 --- a/website/docs/reference/versioning-and-targets.md +++ b/website/docs/reference/versioning-and-targets.md @@ -25,19 +25,22 @@ description: Version tracks across the Reqsign crates, and the supported Rust an ## Versioning -Reqsign publishes many crates on four tracks: +Reqsign publishes many crates on five tracks: | Track | Crates | Scheme | | --- | --- | --- | -| Core + existing services | `reqsign-core`, `reqsign-aws-core`, every existing `reqsign-` service crate, `reqsign-file-read-tokio`, `reqsign-command-execute-tokio` | Lockstep major (currently `3.x`) | -| New provider and shared crates | `reqsign-b2`, `reqsign-baidu-netdisk`, `reqsign-oauth2`, `reqsign-dropbox`, `reqsign-aliyun-drive`, `reqsign-github`, `reqsign-cloudflare`, `reqsign-onedrive`, `reqsign-seafile`, `reqsign-vercel`, `reqsign-yandex-disk`, `reqsign-koofr`, and later crates introduced after the lockstep line | Independent major, starting at `1.0.0` | -| Reqwest adapter | `reqsign-http-send-reqwest` | Independent major (currently `4.x`), so reqwest major bumps do not force a core major | -| Facade | `reqsign` | Independent (currently `0.20.x`) | - -Lockstep means any `3.x` established service crate composes with any `3.x` -core. New provider and shared crates start at `1.0.0` and depend on the current -core major, so a `1.x` crate composes with `3.x` core. Mixing core majors fails -to compile — the trait definitions are the compatibility boundary, and Cargo +| Core + established services | `reqsign-core`, `reqsign-aws-core`, every established `reqsign-` service crate, `reqsign-http-message-signatures`, `reqsign-file-read-tokio`, `reqsign-command-execute-tokio` | Lockstep major (currently `4.x`) | +| Provider and shared crates | `reqsign-b2`, `reqsign-aliyun-drive`, `reqsign-baidu-netdisk`, `reqsign-cloudflare`, `reqsign-dropbox`, `reqsign-github`, `reqsign-koofr`, `reqsign-oauth2`, `reqsign-onedrive`, `reqsign-seafile`, `reqsign-upyun`, `reqsign-vercel`, `reqsign-yandex-disk`, and later crates introduced after the lockstep line | Independent major, starting at `1.0.0` | +| Crypto backends | `reqsign-crypto-rustcrypto`, `reqsign-crypto-boring` | Independent major, starting at `1.0.0` | +| Reqwest adapter | `reqsign-http-send-reqwest` | Independent major (currently `5.x`), offset from the core major so reqwest major bumps do not force a core major | +| Facade | `reqsign` | Independent (currently `0.21.x`) | + +Lockstep means any `4.x` established service crate composes with any `4.x` +core. Provider and shared crates start at `1.0.0` and depend on the current +core major, so a `1.x` crate composes with `4.x` core. Crypto backends version +independently of both, and the reqwest adapter moves to a new major when the +core lockstep major changes, one major ahead. Mixing core majors fails to +compile — the trait definitions are the compatibility boundary, and Cargo enforces it. Applications should depend on the facade and let it pin compatible @@ -47,11 +50,11 @@ application: ```toml # Application: -reqsign = { version = "0.20", features = ["aws"] } +reqsign = { version = "0.21", features = ["aws"] } # Library: -reqsign-core = "3" -reqsign-aws-v4 = "3" +reqsign-core = "4" +reqsign-aws-v4 = "4" ``` Every release ships as an ASF source release plus crates.io packages — see diff --git a/website/docs/sidebars.js b/website/docs/sidebars.js index f51e2045..08cb7899 100644 --- a/website/docs/sidebars.js +++ b/website/docs/sidebars.js @@ -72,6 +72,7 @@ module.exports = { "guides/granting", "guides/custom-runtimes", "guides/testing", + "guides/upgrading-to-0.21", ], }, "architecture",