-
Notifications
You must be signed in to change notification settings - Fork 78
Unmaintained Dependency paste
(RUSTSEC-2024-0436)
#279
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
Comments
Others had the same problems and it seems there are quite a few forks already, including |
We are talking 4 files, overall ~800-900 Loc (including doc comments). |
Thanks for bringing this up! If there are already forks available I would also prefer using them directly instead of having to maintain the crate ourselves 😅 Do you see any advantages of having the crate in our repo? Would definitely be open for a PR trying out |
@wiktor-k , @hug-dev |
I can fully understand that.
Compared to having another well maintained dependency? -> No If there are no alternatives available, it does not make the status quo worse as you likely don't touch it, Should I close PR #280 ? |
Then yes I think we can close the PR and plan to switch to an alternative! Hope it was not too much work and thank you for testing it anyway! |
Changing to pastey should be really just a change in the Cargo.toml: [dependencies]
- paste = "1"
+ paste = { package = "pastey", version = "*" } as described in https://crates.io/crates/pastey. But I am not convinced the new fork is less of a security issue than old "unmaintained" crate. In kryoptic we dropped this dependency as we used it only in one place. Here I can see it is only used in one place too, but I can not see if there is a way to go without this on the first sight. |
I think there is a serious problem in the rust ecosystem that people fork unmaintained crates and then add some new features to it and dont actually maintain it. This is a prime setup for a supply chain attack.
I think this is generally an issue within the rust ecosystem since people are so eager to switch to a new crate to avoid the CVE notices in CI and it enviably creates security holes since these crates we switch to have not been vetted. Here is a recent example from
I would advise anyone to add this to your [bans]
deny = [
# AI Fork of serde_yaml
"serde_yml",
# AI Fork of paste
"pastey",
] |
I agree that this is a highly suboptimal situation but the root cause, at least from my point of view, was marking
The author said the crate is unmaintained. Of course there are crates that have a maintainer missing-in-action and your attack scenario is plausible.
It's an "issue" within the rust ecosystem because it's so easy to check for this in Rust. Cargo-deny is incredibly straightforward to setup and the centralised advisory db is easy to update.
Personally I don't have anything against "lack luster changes". This is something different than being malicious. I view this as a systemic problem that should be taken care of by a Rust governing entity. Apache Foundation was a safe haven for old projects in other ecosystems back in the day, maybe Rust needs something like this too? I guess the way forward here is to look at the macro invocation at hand and see if we can simplify that. Sadly, since this is (at least for me) a side project, this may take some time :-/ |
We can track this which would allow us to remove diff --git a/cryptoki/src/context/general_purpose.rs b/cryptoki/src/context/general_purpose.rs
index be7ead9..8c8b3bd 100644
--- a/cryptoki/src/context/general_purpose.rs
+++ b/cryptoki/src/context/general_purpose.rs
@@ -35,11 +35,10 @@ pub(super) fn get_library_info(ctx: &Pkcs11) -> Result<Info> {
macro_rules! check_fn {
($pkcs11:expr, $func_name:ident) => {{
- let func = paste! { $pkcs11
+ let func = $pkcs11
.impl_
.get_function_list()
- .[<C_ $func_name>]
- };
+ .${concat(C_, $func_name)};
func.is_some()
}};
} got the idea from xiph/rav1e#3430 |
Can you open a PR with the changes? |
Hi Cryptoki maintainers,
Thanks for providing this library!
I noticed that
cryptoki
uses thepaste
crate (https://github.com/dtolnay/paste), and I wanted to bring to your attention RUSTSEC-2024-0436, which notes thatpaste
is currently unmaintained.I've been thinking about possible solutions, and given how small the
paste
crate is, vendoring it directly intocryptoki
seems like a reasonable and straightforward option. This would remove the external dependency and give you more control over its maintenance and security going forward. Plus, it wouldn't negatively impact the current security posture.To that end, I was wondering if you'd be open to a PR where I vendor the
paste
code directly intocryptoki
?Thanks for your time and all your work on
cryptoki
!best
Nico
The text was updated successfully, but these errors were encountered: