Skip to content

Pluggable Crypto / Update reqwest 0.13 - #707

Merged
alamb merged 24 commits into
apache:mainfrom
goffrie:pluggable-crypto
Jun 17, 2026
Merged

alamb merged 24 commits into
apache:mainfrom
goffrie:pluggable-crypto

Conversation

@goffrie

@goffrie goffrie commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

NOTE: this is a rebased version of #585

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Adds the ability to compile object_store without a dependency on ring, and instead use aws-lc-rs or a user-provided crypto implementation. Also changes the default to aws-lc-rs, which the ecosystem seems to be moving toward as a default.

Also upgrades reqwest to 0.13, and makes it possible to configure reqwest with any TLS backend by selecting a -no-crypto feature.

Are there any user-facing changes?

@djc

djc commented May 12, 2026

Copy link
Copy Markdown

Ping? Would be nice to avoid having duplicate reqwest versions in downstream projects.

@goffrie

goffrie commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

I've given this another rebase, I think it's more blocked on review/maintainer capacity though?

@goffrie

goffrie commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

(cc @Creperum since you were asking for a rebase in #585)

@awesterb awesterb mentioned this pull request May 15, 2026
@goffrie
goffrie force-pushed the pluggable-crypto branch from 9363266 to 51969a8 Compare May 26, 2026 21:06
@djc

djc commented Jun 1, 2026

Copy link
Copy Markdown

Maintainers, could someone take a look? Would be nice to avoid duplicate dependencies in downstream applications that are up to date with the rest of the ecosystem (and it's been 5 months since reqwest 0.13 was released).

@Tpt Tpt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a maintainer but I would love to see this MR get merged.

I allowed myself 3 suggestions.

Comment thread .github/workflows/ci.yml Outdated
- name: Check no crypto crates
run:
cargo tree --features gcp-no-crypto,aws-no-crypto,azure-no-crypto,http-no-crypto \
| grep -qE '\b(ring|openssl)\b' && { echo "❌ disallowed crate found"; exit 1; } || echo "✅ no disallowed crates"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this test should also add aws-lc-rs?

Suggested change
| grep -qE '\b(ring|openssl)\b' && { echo "❌ disallowed crate found"; exit 1; } || echo "✅ no disallowed crates"
| grep -qE '\b(ring|openssl|aws-lc-rs)\b' && { echo "❌ disallowed crate found"; exit 1; } || echo "✅ no disallowed crates"

Comment thread src/client/mod.rs Outdated
"user_agent" => Ok(Self::UserAgent),
_ => Err(super::Error::UnknownConfigurationKey {
store: "HTTP",
store: "http-no-crypto",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find/replace error?

Suggested change
store: "http-no-crypto",
store: "HTTP",

Comment thread src/gcp/credential.rs
Ok(_) => Err(Error::MissingKey),
Err(source) => Err(Error::ReadPem { source }),
}
#[cfg(feature = "aws-lc-rs")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyper-nit (please ignore): moving the cfg switch inside of the function might help ensuring the signature does not diverge between aws-lc and rustls (same for the other functions)

@tustvold

tustvold commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Apologies this is still on my list, things have just been extremely busy at work and maintaining this and arrow-rs is no longer my day job 😅. I'll try to take a look this evening.

Comment thread Cargo.toml
quick-xml = { version = "0.39.0", features = ["serialize", "overlapped-lists"], optional = true }
rand = { version = "0.10", default-features = false, features = ["std", "std_rng", "thread_rng"], optional = true }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "http2"], optional = true }
reqwest = { version = "0.13", default-features = false, features = ["http2"], optional = true }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I request we make a separate PR to upgrade the version of reqwest to 0.13

That way we won't tie the fate of that upgrade to the pluggable crypto stuff (and it will maek the PR easier / faster to review)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the reqwest upgrade ends up tied to this, because there were changes to the way reqwest handles encryption

@alamb

alamb commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Given it looks like we will make a new major version anyways I think it would be good to try and update reqwest as well

@goffrie
goffrie force-pushed the pluggable-crypto branch from 51969a8 to d3f327d Compare June 5, 2026 01:02

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think *-custom would be clearer than *-no-crypto.

From a user’s perspective, aws-no-crypto, gcp-no-crypto, and azure-no-crypto sound like the stores can operate without crypto. But these stores may still need crypto for request signing, signed URLs, service-account JWTs, SAS signing, etc.

The feature really means: enable the store without selecting object_store’s default crypto provider.

*-custom better matches that expectation:

  • aws, gcp, azure, http: normal/default path
  • aws-custom, gcp-custom, azure-custom, http-custom: advanced path for users who want to choose their own crypto/TLS setup
  • crypto-aws-lc, crypto-ring: explicit provider choices

Example:

# default path
object_store = { features = ["aws"] }

# custom provider setup
object_store = { features = ["aws-custom", "crypto-ring", "tls-rustls"] }

This keeps the existing feature names for normal users, while making the advanced path match the actual use case: customization, not disabling crypto.

@kevinjqliu

Copy link
Copy Markdown
Contributor

Create an issue to facilitate with discussion on feature naming
#744

Comment thread Cargo.toml Outdated
default = ["fs"]
cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"]
azure = ["cloud", "httparse"]
cloud-no-crypto = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/stream", "chrono/serde", "base64", "rand","http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should align the feature naming here with the optional reqwest work in #724.
Feel free to chime in on the discussion here: #744

Instead of adding a separate *-no-crypto naming pattern, I think *-base can be the common escape hatch for both optional transport and optional crypto:

cloud-base = shared cloud implementation without default reqwest or bundled crypto

aws-base   = cloud-base + AWS/S3-specific implementation deps
azure-base = cloud-base + Azure-specific implementation deps
gcp-base   = cloud-base + GCS-specific implementation deps
http-base  = cloud-base + HTTP-specific implementation deps

reqwest    = built-in reqwest HTTP transport

ring       = bundled ring crypto provider
aws-lc-rs  = bundled aws-lc-rs crypto provider

cloud      = cloud-base + reqwest + default crypto provider
             compatibility alias for the old cloud behavior

aws        = aws-base + reqwest + default crypto provider
azure      = azure-base + reqwest + default crypto provider
gcp        = gcp-base + reqwest + default crypto provider
http       = http-base + reqwest + default crypto provider

That gives users explicit composition:

# S3 implementation only; user provides HTTP connector and crypto provider
object_store = { default-features = false, features = ["aws-base"] }

# S3 implementation + built-in reqwest, but user controls crypto provider
object_store = { default-features = false, features = ["aws-base", "reqwest"] }

# S3 implementation + custom HTTP connector, but object_store provides bundled ring crypto
object_store = { default-features = false, features = ["aws-base", "ring"] }

# S3 implementation + built-in reqwest + explicit aws-lc-rs crypto provider
object_store = { default-features = false, features = ["aws-base", "reqwest", "aws-lc-rs"] }

This keeps the default user path simple:

object_store = { features = ["aws"] }

while making the advanced cases composable.

The remaining compatibility/default decision is whether the batteries-included features should keep ring as the default crypto provider for compatibility, or intentionally switch to aws-lc-rs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remaining compatibility/default decision is whether the batteries-included features should keep ring as the default crypto provider for compatibility, or intentionally switch to aws-lc-rs.

My suggestion would be to follow reqwest and use aws-lc-rs. This way users of both object_store and reqwest do not end up with two crypto stacks.

@alamb

alamb commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

As others have noted, this is going to conflict / need feature flag alignment with

I recommend we try and merge #724 in first, and then merge this one up and clean up the flags / dependencies

@kevinjqliu

Copy link
Copy Markdown
Contributor

I also can't but help thinking we may be making things too complicated here by trying to help people use reqwest without one of its built in crypto providers -- I fear in so doing we are going to overfit and people won't actually be able to test with all the feature flags.

This is actually for users who wants to provide a custom HTTP client instead of reqwest. We want *-base + aws-lc-rs to be a standalone feature combination; the new CI check catches that case directly.

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I also can't but help thinking we may be making things too complicated here by trying to help people use reqwest without one of its built in crypto providers -- I fear in so doing we are going to overfit and people won't actually be able to test with all the feature flags.

This is actually for users who wants to provide a custom HTTP client instead of reqwest. We want *-base + aws-lc-rs to be a standalone feature combination; the new CI check catches that case directly.

I feel one difference is that actual customers will have their own Cargo.toml file where they can directly activate the features in the subcrates, so they won't be compiling just the object_store. So therefore I think the new CI check is invalid as it is verifying something that won't actually be done in practice.

After some thought, I think a better way to test these features would be to create some targeted examples that are not part of the workspace and demonstrate (and verify they compile, etc) how to do the various usecases. I will file a follow on ticket to track this work

@kevinjqliu

Copy link
Copy Markdown
Contributor

After some thought, I think a better way to test these features would be to create some targeted examples that are not part of the workspace and demonstrate (and verify they compile, etc) how to do the various usecases. I will file a follow on ticket to track this work

Yea thats a great idea.

I'm happy to move on with the PR as is. I can follow up with documentations on using aws-lc-rs without reqwest

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Thanks @kevinjqliu -- I filed a ticket to track improved testing:

I will also fix the CI and add a comment link

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Okay -- hoping for a clean run now

# Conflicts:
#	src/azure/builder.rs
#	src/azure/client.rs
#	src/azure/credential.rs
#	src/azure/mod.rs
@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

merged up to resolve conflicts

The merged CPK support (apache#742) computed the encryption key SHA-256 via
ring::digest directly, which fails to compile on this branch since
azure-base no longer depends on ring. Route it through the CryptoProvider
abstraction (DigestAlgorithm::Sha256) instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I am not entirely sure I got all the pluggable crypto hooked up correctly in the azure client, but assuming I can get CI to pass on this PR I am going to merge it in. We can work on improving / testing the pluggable crypto as a follow on PR

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I also filed a ticket to track adding more tests / docs for the pluggable crypto feature

@alamb
alamb merged commit 996e084 into apache:main Jun 17, 2026
10 checks passed
@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Let's get this in and iterate / test on main as this is the most potentially disruptive update. I will start preparing for a release with a version bump and release notes

@kevinjqliu

Copy link
Copy Markdown
Contributor

awesome thanks @alamb, i'll do some testing on main branch as well.
And thank you @goffrie for the PR! 😄

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

awesome thanks @alamb, i'll do some testing on main branch as well. And thank you @goffrie for the PR! 😄

Yes, 100% -- thank you @kevinjqliu and @goffrie (and @djc and @tustvold and @Tpt ) -- quite a team effort

@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I had a small follow on doc PR:

alamb added a commit that referenced this pull request Jun 18, 2026
* Clarify aws-lc-rs feature docs and fix CI comment URL

Follow-on documentation polish from the review of #707.

- Document that the `aws-lc-rs` feature requires the user to also select an
  aws-lc-rs backend when the built-in `reqwest` transport is not enabled.
- Fix the malformed github.com URL in the CI testing-matrix comment.

Comment/documentation-only; no code or behavior changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Update src/lib.rs

Co-authored-by: Kevin Liu <[email protected]>

* fmt

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Kevin Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change crypto provider from ring to aws-rust-lc

8 participants