-
Couldn't load subscription status.
- Fork 318
Description
My project is currently blocked on upgrading jsonwebtoken from 9.3.1 to 10.1.0 not only due to the #449 and #454 issues (of which #449 is particularly concerning), but also due to another one: jsonwebtoken 10 has an enormous number of transitive dependencies with either backend when comparing with 9. I noticed this after my project's total crate count went from 383 to over 410 after the jsonwebtoken upgrade with either backend. My use case is simple,: only verifying JWTs using the RS256 algorithm without PEM decoding (use-pem feature) for DecodingKey.
I made an empty binary crate and ran cargo tree on it with three configurations to demonstrate the issue:
jsonwebtoken = { version = "9.3.1", default-features = false }:
dep-checks v0.1.0 (/home/kanpov/Projects/dep-checks)
└── jsonwebtoken v9.3.1
├── base64 v0.22.1
├── ring v0.17.14
│ ├── cfg-if v1.0.4
│ ├── getrandom v0.2.16
│ │ ├── cfg-if v1.0.4
│ │ └── libc v0.2.177
│ └── untrusted v0.9.0
│ [build-dependencies]
│ └── cc v1.2.41
│ ├── find-msvc-tools v0.1.4
│ └── shlex v1.3.0
├── serde v1.0.228
│ ├── serde_core v1.0.228
│ └── serde_derive v1.0.228 (proc-macro)
│ ├── proc-macro2 v1.0.101
│ │ └── unicode-ident v1.0.19
│ ├── quote v1.0.41
│ │ └── proc-macro2 v1.0.101 (*)
│ └── syn v2.0.107
│ ├── proc-macro2 v1.0.101 (*)
│ ├── quote v1.0.41 (*)
│ └── unicode-ident v1.0.19
└── serde_json v1.0.145
├── itoa v1.0.15
├── memchr v2.7.6
├── ryu v1.0.20
└── serde_core v1.0.228
Crate count: 36
jsonwebtoken = { version = "10.1.0", default-features = false, features = ["rust_crypto"] }:
dep-checks v0.1.0 (/home/kanpov/Projects/dep-checks)
└── jsonwebtoken v10.1.0
├── base64 v0.22.1
├── ed25519-dalek v2.2.0
│ ├── curve25519-dalek v4.1.3
│ │ ├── cfg-if v1.0.4
│ │ ├── cpufeatures v0.2.17
│ │ ├── curve25519-dalek-derive v0.1.1 (proc-macro)
│ │ │ ├── proc-macro2 v1.0.101
│ │ │ │ └── unicode-ident v1.0.19
│ │ │ ├── quote v1.0.41
│ │ │ │ └── proc-macro2 v1.0.101 (*)
│ │ │ └── syn v2.0.107
│ │ │ ├── proc-macro2 v1.0.101 (*)
│ │ │ ├── quote v1.0.41 (*)
│ │ │ └── unicode-ident v1.0.19
│ │ ├── digest v0.10.7
│ │ │ ├── block-buffer v0.10.4
│ │ │ │ └── generic-array v0.14.9
│ │ │ │ ├── typenum v1.19.0
│ │ │ │ └── zeroize v1.8.2
│ │ │ │ [build-dependencies]
│ │ │ │ └── version_check v0.9.5
│ │ │ ├── const-oid v0.9.6
│ │ │ ├── crypto-common v0.1.6
│ │ │ │ ├── generic-array v0.14.9 (*)
│ │ │ │ └── typenum v1.19.0
│ │ │ └── subtle v2.6.1
│ │ ├── subtle v2.6.1
│ │ └── zeroize v1.8.2
│ │ [build-dependencies]
│ │ └── rustc_version v0.4.1
│ │ └── semver v1.0.27
│ ├── ed25519 v2.2.3
│ │ ├── pkcs8 v0.10.2
│ │ │ ├── der v0.7.10
│ │ │ │ ├── const-oid v0.9.6
│ │ │ │ ├── pem-rfc7468 v0.7.0
│ │ │ │ │ └── base64ct v1.8.0
│ │ │ │ └── zeroize v1.8.2
│ │ │ └── spki v0.7.3
│ │ │ └── der v0.7.10 (*)
│ │ └── signature v2.2.0
│ │ ├── digest v0.10.7 (*)
│ │ └── rand_core v0.6.4
│ │ └── getrandom v0.2.16
│ │ ├── cfg-if v1.0.4
│ │ └── libc v0.2.177
│ ├── sha2 v0.10.9
│ │ ├── cfg-if v1.0.4
│ │ ├── cpufeatures v0.2.17
│ │ └── digest v0.10.7 (*)
│ ├── subtle v2.6.1
│ └── zeroize v1.8.2
├── hmac v0.12.1
│ └── digest v0.10.7 (*)
├── p256 v0.13.2
│ ├── ecdsa v0.16.9
│ │ ├── der v0.7.10 (*)
│ │ ├── digest v0.10.7 (*)
│ │ ├── elliptic-curve v0.13.8
│ │ │ ├── base16ct v0.2.0
│ │ │ ├── crypto-bigint v0.5.5
│ │ │ │ ├── generic-array v0.14.9 (*)
│ │ │ │ ├── rand_core v0.6.4 (*)
│ │ │ │ ├── subtle v2.6.1
│ │ │ │ └── zeroize v1.8.2
│ │ │ ├── digest v0.10.7 (*)
│ │ │ ├── ff v0.13.1
│ │ │ │ ├── rand_core v0.6.4 (*)
│ │ │ │ └── subtle v2.6.1
│ │ │ ├── generic-array v0.14.9 (*)
│ │ │ ├── group v0.13.0
│ │ │ │ ├── ff v0.13.1 (*)
│ │ │ │ ├── rand_core v0.6.4 (*)
│ │ │ │ └── subtle v2.6.1
│ │ │ ├── hkdf v0.12.4
│ │ │ │ └── hmac v0.12.1 (*)
│ │ │ ├── pem-rfc7468 v0.7.0 (*)
│ │ │ ├── pkcs8 v0.10.2 (*)
│ │ │ ├── rand_core v0.6.4 (*)
│ │ │ ├── sec1 v0.7.3
│ │ │ │ ├── base16ct v0.2.0
│ │ │ │ ├── der v0.7.10 (*)
│ │ │ │ ├── generic-array v0.14.9 (*)
│ │ │ │ ├── pkcs8 v0.10.2 (*)
│ │ │ │ ├── subtle v2.6.1
│ │ │ │ └── zeroize v1.8.2
│ │ │ ├── subtle v2.6.1
│ │ │ └── zeroize v1.8.2
│ │ ├── rfc6979 v0.4.0
│ │ │ ├── hmac v0.12.1 (*)
│ │ │ └── subtle v2.6.1
│ │ ├── signature v2.2.0 (*)
│ │ └── spki v0.7.3 (*)
│ ├── elliptic-curve v0.13.8 (*)
│ ├── primeorder v0.13.6
│ │ └── elliptic-curve v0.13.8 (*)
│ └── sha2 v0.10.9 (*)
├── p384 v0.13.1
│ ├── ecdsa v0.16.9 (*)
│ ├── elliptic-curve v0.13.8 (*)
│ ├── primeorder v0.13.6 (*)
│ └── sha2 v0.10.9 (*)
├── rand v0.8.5
│ ├── libc v0.2.177
│ ├── rand_chacha v0.3.1
│ │ ├── ppv-lite86 v0.2.21
│ │ │ └── zerocopy v0.8.27
│ │ └── rand_core v0.6.4 (*)
│ └── rand_core v0.6.4 (*)
├── rsa v0.9.8
│ ├── const-oid v0.9.6
│ ├── digest v0.10.7 (*)
│ ├── num-bigint-dig v0.8.4
│ │ ├── byteorder v1.5.0
│ │ ├── lazy_static v1.5.0
│ │ │ └── spin v0.9.8
│ │ ├── libm v0.2.15
│ │ ├── num-integer v0.1.46
│ │ │ └── num-traits v0.2.19
│ │ │ └── libm v0.2.15
│ │ │ [build-dependencies]
│ │ │ └── autocfg v1.5.0
│ │ ├── num-iter v0.1.45
│ │ │ ├── num-integer v0.1.46 (*)
│ │ │ └── num-traits v0.2.19 (*)
│ │ │ [build-dependencies]
│ │ │ └── autocfg v1.5.0
│ │ ├── num-traits v0.2.19 (*)
│ │ ├── rand v0.8.5 (*)
│ │ ├── smallvec v1.15.1
│ │ └── zeroize v1.8.2
│ ├── num-integer v0.1.46 (*)
│ ├── num-traits v0.2.19 (*)
│ ├── pkcs1 v0.7.5
│ │ ├── der v0.7.10 (*)
│ │ ├── pkcs8 v0.10.2 (*)
│ │ └── spki v0.7.3 (*)
│ ├── pkcs8 v0.10.2 (*)
│ ├── rand_core v0.6.4 (*)
│ ├── signature v2.2.0 (*)
│ ├── spki v0.7.3 (*)
│ ├── subtle v2.6.1
│ └── zeroize v1.8.2
├── serde v1.0.228
│ ├── serde_core v1.0.228
│ └── serde_derive v1.0.228 (proc-macro)
│ ├── proc-macro2 v1.0.101 (*)
│ ├── quote v1.0.41 (*)
│ └── syn v2.0.107 (*)
├── serde_json v1.0.145
│ ├── itoa v1.0.15
│ ├── memchr v2.7.6
│ ├── ryu v1.0.20
│ └── serde_core v1.0.228
├── sha2 v0.10.9 (*)
└── signature v2.2.0 (*)
Crate count: 96
jsonwebtoken = { version = "10.1.0", default-features = false, features = [ "aws_lc_rs" ] }:
dep-checks v0.1.0 (/home/kanpov/Projects/dep-checks)
└── jsonwebtoken v10.1.0
├── aws-lc-rs v1.14.1
│ ├── aws-lc-sys v0.32.3
│ │ [build-dependencies]
│ │ ├── cc v1.2.41
│ │ │ ├── find-msvc-tools v0.1.4
│ │ │ ├── jobserver v0.1.34
│ │ │ │ └── libc v0.2.177
│ │ │ ├── libc v0.2.177
│ │ │ └── shlex v1.3.0
│ │ ├── cmake v0.1.54
│ │ │ └── cc v1.2.41 (*)
│ │ ├── dunce v1.0.5
│ │ └── fs_extra v1.3.0
│ ├── untrusted v0.7.1
│ └── zeroize v1.8.2
├── base64 v0.22.1
├── serde v1.0.228
│ ├── serde_core v1.0.228
│ └── serde_derive v1.0.228 (proc-macro)
│ ├── proc-macro2 v1.0.101
│ │ └── unicode-ident v1.0.19
│ ├── quote v1.0.41
│ │ └── proc-macro2 v1.0.101 (*)
│ └── syn v2.0.107
│ ├── proc-macro2 v1.0.101 (*)
│ ├── quote v1.0.41 (*)
│ └── unicode-ident v1.0.19
├── serde_json v1.0.145
│ ├── itoa v1.0.15
│ ├── memchr v2.7.6
│ ├── ryu v1.0.20
│ └── serde_core v1.0.228
└── signature v2.2.0
Crate count: 43
Additionally, there is a clear increase in binary size with both of these backends in comparison to when ring was used in 9.3.1. I'll need to make a concrete code example to measure the exact difference, but the effect on my project was about +2-3MB in debug binaries with aws-lc-rs, all other ring usages removed and opt-level = "z" (so, theoretically the effect on a release build using opt-level = 3 and lto = "fat" could be greater).
Differences in compilation time can also be measured, especially considering that aws-lc-rs is reportedly quite slow to build and its alternative backend pulls in a ton of crates, but that factor has a much smaller impact on real projects than transitive dependency count and binary size.