Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Disabling keyutils (and only using secret-service) on Linux #153

Closed
VorpalBlade opened this issue Dec 25, 2023 · 5 comments · Fixed by #154
Closed

Feature request: Disabling keyutils (and only using secret-service) on Linux #153

VorpalBlade opened this issue Dec 25, 2023 · 5 comments · Fixed by #154
Assignees

Comments

@VorpalBlade
Copy link

I'm trying to put my dependency tree on a diet and discovered that keyring seems to always pull in support for keyutils on Linux, even though I only ever use DBUS secret service (since I'm writing an interactive desktop program).

I don't see a way in your Cargo.toml to disable this. Would it be possible to make it a feature (enabled by default for backward compatibility of course)? Then those who don't need it can pull in keyring with no-default-features and just the feature linux-secret-service

@brotskydotcom
Copy link
Collaborator

My understanding is that keyutils is part of the kernel on Linux and so there are no additional dependencies included by the keyutils credential store. (Perhaps @landhb knows better?)

Are you asking for a way of compiling this crate so that the keyutils credential store is not even included in the build?

@VorpalBlade
Copy link
Author

VorpalBlade commented Dec 25, 2023

My understanding is that keyutils is part of the kernel on Linux and so there are no additional dependencies included by the keyutils credential store.

keyring depends on the linux-keyutils crate on Linux to interact with the kernel functionality. That in turn depends an old version of bitflags (the only crate in my dependency tree pulling in bitflags 1.x, causing duplication of that dependency). Which in turn pulls in more things. And so on.

Are you asking for a way of compiling this crate so that the keyutils credential store is not even included in the build?

Yes exactly. This will help with compile times and size of build trees (I'm running into the 10 GB limit on caches in GitHub CI due to the large build tree in combination with the large number of cross compiled architectures I'm supporting).

@brotskydotcom brotskydotcom self-assigned this Dec 26, 2023
@brotskydotcom
Copy link
Collaborator

brotskydotcom commented Dec 26, 2023

keyring depends on the linux-keyutils crate on Linux to interact with the kernel functionality.

Oh, right, duh! That will teach me not to look at my own Cargo.toml file before answering 🤦.

This is a good suggestion, and easy. I'll implement it right away.

@brotskydotcom
Copy link
Collaborator

Actually this issue makes me realize that the way the features have been defined are all wrong. Even the platform dependencies should be controlled by features not by platform, in case users want to be using (for example) an internet-based store and don't want to pay the cost of the platform dependencies.

If no platform keystores are available, the mock keystore should be used as the default.

brotskydotcom added a commit to brotskydotcom/keyring-rs that referenced this issue Dec 26, 2023
This fixes hwchen#153 by making all platform dependencies be features and including them as default features, so now you can suppress building all platform dependencies by suppressing default features.

This also fixes hwchen#148 by having the code check to see if there is platform support and, if not, using the mock keystore as the default.

While this change is not fully backward compatible for people who were suppressing default features on macOS, iOS, Win, or FreeBSD, doing so was undefined behavior on those platforms and so changing it does not break the semantics of the API.
brotskydotcom added a commit to brotskydotcom/keyring-rs that referenced this issue Dec 26, 2023
This fixes hwchen#153 by making all platform dependencies be features and including them as default features, so now you can suppress building all platform dependencies by suppressing default features.

This also fixes hwchen#148 by having the code check to see if there is platform support and, if not, using the mock keystore as the default.

While this change is not fully backward compatible for people who were suppressing default features on macOS, iOS, Win, or FreeBSD, doing so was undefined behavior on those platforms and so changing it does not break the semantics of the API.
@brotskydotcom
Copy link
Collaborator

Release v2.2.0 fixes this issue. You can now do default-features = false, features = [linux-secret-service] and the right thing will happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants