Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ phylum_project = { path = "../phylum_project" }
phylum_types = { git = "https://github.com/phylum-dev/phylum-types", branch = "development" }
prettytable-rs = "0.10.0"
purl = { version = "0.1.5", features = ["serde"] }
rand = "0.8.4"
rand = "0.9.4"
regex = "1.5.5"
reqwest = { version = "0.12.7", features = [
"blocking",
Expand Down
6 changes: 3 additions & 3 deletions cli/src/auth/oidc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use base64::Engine as _;
use chrono::{DateTime, Utc};
use maplit::hashmap;
use phylum_types::types::auth::{AccessToken, AuthorizationCode, RefreshToken, TokenResponse};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::distr::Alphanumeric;
use rand::{rng, Rng};
use reqwest::Url;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -69,7 +69,7 @@ impl CodeVerifier {
return Err(anyhow!("length must be between 43 and 128 inclusive."));
}
let code_verifier: String =
thread_rng().sample_iter(&Alphanumeric).take(length as usize).map(char::from).collect();
rng().sample_iter(&Alphanumeric).take(length as usize).map(char::from).collect();
let mut hasher = Sha256::new();
hasher.update(&code_verifier);
let hash = hasher.finalize();
Expand Down
9 changes: 4 additions & 5 deletions cli/src/auth/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use axum::Router;
use chrono::{DateTime, Utc};
use log::{debug, error};
use phylum_types::types::auth::{AuthorizationCode, RefreshToken};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::distr::Alphanumeric;
use rand::{rng, Rng};
use reqwest::Url;
use serde::Deserialize;
use tokio::net::TcpListener;
Expand Down Expand Up @@ -184,7 +184,7 @@ pub async fn handle_auth_flow(
) -> Result<RefreshToken> {
let locksmith_settings = fetch_locksmith_server_settings(ignore_certs, api_uri).await?;
let (code_verifier, challenge_code) = CodeVerifier::generate(64)?;
let state: String = thread_rng().sample_iter(&Alphanumeric).take(32).map(char::from).collect();
let state: String = rng().sample_iter(&Alphanumeric).take(32).map(char::from).collect();
let (auth_code, callback_url) =
spawn_server_and_get_auth_code(&locksmith_settings, auth_action, &challenge_code, state)
.await?;
Expand Down Expand Up @@ -215,8 +215,7 @@ mod test {
let (_verifier, challenge) =
CodeVerifier::generate(64).expect("Failed to build PKCE verifier and challenge");

let state: String =
thread_rng().sample_iter(&Alphanumeric).take(32).map(char::from).collect();
let state: String = rng().sample_iter(&Alphanumeric).take(32).map(char::from).collect();

spawn_server_and_get_auth_code(&locksmith_settings, AuthAction::Login, &challenge, state)
.await?;
Expand Down