1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-09-11 06:55:38 +03:00

fix(github): sanitize the GitHub token in debug logs

fixes #515
This commit is contained in:
Orhun Parmaksız 2024-02-28 13:22:33 +03:00
parent 4508d4d7a6
commit be34949df7
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90
2 changed files with 5 additions and 5 deletions

View File

@ -18,6 +18,7 @@ use git_cliff_core::{
DEFAULT_OUTPUT,
};
use glob::Pattern;
use secrecy::SecretString;
use std::path::PathBuf;
#[derive(Debug, Clone, Copy, ValueEnum)]
@ -227,7 +228,7 @@ pub struct Opt {
value_name = "TOKEN",
hide_env_values = true
)]
pub github_token: Option<String>,
pub github_token: Option<SecretString>,
/// Sets the GitHub repository.
#[arg(
long,

View File

@ -39,7 +39,6 @@ use git_cliff_core::{
DEFAULT_CONFIG,
IGNORE_FILE,
};
use secrecy::Secret;
use std::env;
use std::fs::{
self,
@ -126,8 +125,8 @@ fn process_repository<'a>(
}
// Print debug information about configuration and arguments.
log::trace!("{:#?}", args);
log::trace!("{:#?}", config);
log::trace!("Arguments: {:#?}", args);
log::trace!("Config: {:#?}", config);
// Parse commits.
let mut commit_range = args.range.clone();
@ -399,7 +398,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
}
if args.github_token.is_some() {
config.remote.github.token = args.github_token.clone().map(Secret::new);
config.remote.github.token = args.github_token.clone();
}
if let Some(ref remote) = args.github_repo {
config.remote.github.owner = remote.0.owner.to_string();