Repository navigation
Commit c35f0dc
committed
Migrate rand 0.8 to 0.10, and test the two values it generates
**It removes six crates and adds none.** The lock already carried rand
0.10.2, because `quinn-proto` needs it through reqwest — so `rand = "0.8"`
was forcing a second, older copy alongside it. Migrating deduplicates onto
the version already in the graph and drops 0.8's exclusive subtree:
`rand@0.8.8`, `rand_chacha@0.3.1`, `rand_core@0.6.4`, `ppv-lite86@0.2.21`,
`zerocopy@0.8.57`, `zerocopy-derive@0.8.57`. 207 packages to 201.
The code change is two call sites in `auth.rs`, both renames: `thread_rng()`
is now `rng()`, and `Rng::gen` is `random()`. `rand::random` is a free
function, so the `use rand::Rng` import goes away rather than becoming
`RngExt`.
**The randomness guarantee is unchanged and now stated.** Both values — the
PKCE verifier and the OAuth `state` — draw from `ThreadRng`, which rand 0.10
declares `TryCryptoRng`, the same CSPRNG guarantee 0.8's `thread_rng` gave.
Checked in rand's source rather than assumed, because it is the property
these two strings live or die by.
**Nothing tested either of them before.** `generate_pkce` had no test at all.
Four now: the pair satisfies RFC 7636 §4.1 and §4.2 (43 characters, and the
challenge really is `BASE64URL(SHA256(ASCII(verifier)))` rather than a hash
of the raw bytes), both strings use only the unreserved alphabet because they
go into a query string unescaped, successive pairs differ, and the `state`
parameter is covered too.
That last one is the one that matters, and it fails for the right reason:
replacing the generator with `[7u8; 32]` leaves the length and alphabet tests
passing — a constant is perfectly well-formed — and only
`every_pkce_pair_is_different` goes red.
Ported from mapbox/mapbox-cli-private#139, which cannot merge there now that
`oss/` is a submodule (mapbox/mapbox-cli-private#132). It exists because
Dependabot tried this by moving the lockfile alone, which fails every
`--locked` build while the manifest still says `rand = "0.8"`.1 parent a3f5e16 commit c35f0dc
4 files changed
Lines changed: 104 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
1373 | 1372 | | |
1374 | 1373 | | |
1375 | 1374 | | |
1376 | | - | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
1377 | 1380 | | |
1378 | 1381 | | |
1379 | 1382 | | |
| |||
1763 | 1766 | | |
1764 | 1767 | | |
1765 | 1768 | | |
1766 | | - | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
1767 | 1773 | | |
1768 | 1774 | | |
1769 | 1775 | | |
| |||
2884 | 2890 | | |
2885 | 2891 | | |
2886 | 2892 | | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
2887 | 2973 | | |
0 commit comments