Repository navigation
feat(core): implement CryptoProvider for Arc<T> - #1073
Merged
Merged
Conversation
Forward every CryptoProvider operation through Arc<T>, including optional methods, so callers can pass an existing Arc<dyn CryptoProvider> to Context::with_crypto and crypto::install_default without a wrapper. Add runtime marker coverage and a source audit that keeps the forwarding impl in sync with the trait as optional methods are added. Refs #1068.
Scope clippy::missing_trait_methods to the Arc<T> CryptoProvider impl so any new defaulted trait method fails the existing clippy CI gate unless the Arc impl forwards it. Remove the formatting-sensitive source audit and keep a compact runtime marker regression covering all ten methods, argument forwarding, the mutable random buffer, and the original error. Refs #1068.
PsiACE
approved these changes
Nov 25, 2026
This was referenced Nov 25, 2026
Xuanwo
added a commit
that referenced
this pull request
Nov 25, 2026
## Summary - Add selectable `rsa`, `p256`, and `aes-gcm` features to `reqsign-crypto-rustcrypto`, all enabled by default. MD5, SHA-1, SHA-256, HMAC-SHA-1/256/512, and HMAC-SHA512 stay unconditional. - Disabled operations return `ConfigInvalid` naming the missing feature, including secure randomness. RSA, AES-GCM, and randomness remain unsupported on `wasm32-unknown-unknown` when enabled; P-256 stays available. - The facade exposes no algorithm features. `default-crypto` depends on the backend with `default-features = false`; service features weakly select only what they need: `aws-v4a` -> `p256`; `azure`, `google`, `oracle`, and `http-message-signatures` -> `rsa`. A service feature alone does not pull the backend. - Remove the facade `google-credential-access-boundary-client-side` feature. Client-side CAB is now opt-in through `reqsign-google/credential-access-boundary-client-side` with a provider supporting AES-GCM and secure randomness, plus an `HttpSend` transport for STS. If a graph also enables facade `google`, Cargo feature unification can expose the type through facade re-exports; that is not a facade feature. - The 0.21 release notes cover both this feature selection and the merged `Arc<T>` forwarding for `CryptoProvider` (#1068). ## Google client-side CAB migration - First acquisition or refresh of intermediary credentials goes to STS. A valid cached intermediary enables local issuance of downscoped tokens. - The rustdoc example is runnable and uses a mock STS transport with the public `Granter::grant(None)` path. Only the `aes-gcm` backend feature is required; the example uses a public test vector, not credentials. - The upgrade guide, service README, and facade docs describe the facade feature removal, direct service opt-in, the Cargo-unification re-export caveat, and the AES-GCM/secure-randomness plus `HttpSend` requirements. ## CI coverage - Backend feature matrix: default, no-default, each algorithm alone, and all three together, including missing-feature diagnostics. - All 25 facade service features plus the `full` aggregate are built and behavior-tested in isolated downstream Cargo invocations. Probes exercise actual RSA, P-256, AES-GCM, randomness, hash, and HMAC operations, and verify a service feature alone does not pull the backend. - A shared service table drives both the weak-mapping static check and the actual-operation oracle. `full` is validated by resolved feature expansion; deleting `vercel` from `full` fails with `full does not enable service features: ['vercel']`. - Existing crypto dependency-boundary and website provider-catalog checks remain. ## Verification - `cargo fmt --all -- --check` - `cargo clippy --workspace --all-targets --all-features -- -D warnings` - `cargo test --workspace --no-fail-fast` - `cargo test --doc --all-features --workspace` - `cargo test -p reqsign-google --features credential-access-boundary-client-side --lib --tests` - `python3 .github/scripts/check_crypto_features.py` - `python3 .github/scripts/test_facade_features.py` - `node website/scripts/validate-providers.mjs` - Release plan: 32 packages. Workspace publish dry run: 31 staged uploads / 31 dry-run aborts. Standalone `reqsign-crypto-boring` packaging: 12 files, 4 staged local dependencies normalized without paths. - Integrated tree equals the #1073 merge-tree before the additive release-note and review-fix commits; the original candidate patch-id is preserved. Part of #1069. ## Downstream follow-up SMB lock resolution is downstream and is not claimed here. After the actual 0.21 release, the maintainers will open and then notify the dedicated OpenDAL issue for the SMB lockfile path. This PR does not edit OpenDAL or notify it.
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.
Summary
CryptoProvidernow has a blanket implementation forArc<T>whereT: CryptoProvider + ?Sized. A caller that already holds anArc<dyn CryptoProvider>can pass it directly to the existingContext::with_cryptoandcrypto::install_defaultentry points instead of maintaining a forwarding newtype.There are no
with_crypto_arcorinstall_default_arcAPIs. The process-wide installation policy is unchanged. Docs state the shared-Arc path; release and migration notes are intentionally not part of this PR.Coverage
The forwarding impl overrides all ten
CryptoProvidermethods, including the defaulted optional methods, and preserves arguments, return values, the mutablefill_randombuffer, and provider errors.#[deny(clippy::missing_trait_methods)]is scoped to the Arc impl. The lint is allow-by-default upstream; this scoped deny makes a newly added defaulted trait method fail the existingcargo clippy --workspace --all-targets --all-features -- -D warningsgate unless the Arc impl forwards it. The lint exists on the 1.87 MSRV and current stable.P = Arc<dyn CryptoProvider>(generic dispatch, not autoderef), so an omitted current optional method or a stub fails behaviorally as well as through clippy. A separate integration-test binary coversinstall_default(Arc<dyn CryptoProvider>)without leaking global state into other tests;Context::with_crypto(Arc<dyn CryptoProvider>)is covered in the main Arc test binary.md5producedmissing trait method provided by default: md5and a runtime error mismatch; adding a defaultprobemethod producedmissing trait method provided by default: probe; stubbingsha256failed the runtime test. All probes were reverted.Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo +1.87.0 clippy -p reqsign-core --lib --all-features -- -D warningscargo test --no-fail-fastcargo test -p reqsign-core --no-fail-fastcargo check -p reqsign-core --target wasm32-unknown-unknowncargo check --manifest-path crypto/boring/Cargo.tomlRUSTDOCFLAGS="--cfg docsrs" cargo +nightly test --doc --all-features --workspaceNo workflow or test suppression is added; Azure live checks remain enabled.
Closes #1068.