diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a982f5..0ff7097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [1.35.0] +- Remote scans with `--git-history=none` now clone repositories with a working tree and scan the current files instead of erroring with "No inputs to scan". + ## [1.34.0] - Use system TLS root certificates to support self-hosted GitLab instances with internal CAs - Added new rule: Coze personal access token diff --git a/Cargo.toml b/Cargo.toml index 4295167..930a196 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ publish = false [package] name = "kingfisher" -version = "1.34.0" +version = "1.35.0" description = "MongoDB's blazingly fast secret scanning and validation tool" edition.workspace = true rust-version.workspace = true diff --git a/README.md b/README.md index ef68c1f..1fba1fb 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,17 @@ [](https://opensource.org/licenses/Apache-2.0) -Kingfisher is a blazingly fast secret‑scanning and validation tool built in Rust. It combines Intel’s hardware‑accelerated Hyperscan regex engine with language‑aware parsing via Tree‑Sitter, and **ships with hundreds of built‑in rules** to detect, validate, and triage secrets before they ever reach production +Kingfisher is a blazingly fast secret‑scanning and live validation tool built in Rust. It combines Intel’s hardware‑accelerated Hyperscan regex engine with language‑aware parsing via Tree‑Sitter, and **ships with hundreds of built‑in rules** to detect, validate, and triage secrets before they ever reach production
Kingfisher originated as a fork of Praetorian's [Nosey Parker](https://github.com/praetorian-inc/noseyparker), and is built atop their incredible work and the work contributed by the Nosey Parker community. ## What Kingfisher Adds - **Live validation** via cloud-provider APIs -- **Language-aware detection** (source-code parsing) for ~20 languages - **Extra targets**: GitLab repos, S3 buckets, Docker images, Jira issues, and Slack messages +- **Compressed Files**: Supports extracting and scanning compressed files for secrets - **Baseline mode**: ignore known secrets, flag only new ones +- **Language-aware detection** (source-code parsing) for ~20 languages - **Native Windows** binary @@ -27,6 +28,7 @@ Kingfisher originated as a fork of Praetorian's [Nosey Parker](https://github.co - **Jira issues**: JQL‑driven scans with `--jira-url` and `--jql` - **Slack messages**: query‑based scans with `--slack-query` - **AWS S3**: bucket scans via `--s3-bucket`/`--s3-prefix` with credentials from `KF_AWS_KEY`/`KF_AWS_SECRET`, `--role-arn`, `--aws-local-profile`, or anonymous +- **Compressed Files**: Supports extracting and scanning compressed files for secrets - **Baseline management**: generate and track baselines to suppress known secrets ([docs/BASELINE.md](/docs/BASELINE.md)) **Learn more:** [Introducing Kingfisher: Real‑Time Secret Detection and Validation](https://www.mongodb.com/blog/post/product-release-announcements/introducing-kingfisher-real-time-secret-detection-validation) diff --git a/src/git_binary.rs b/src/git_binary.rs index fc2baa1..6e9bd8d 100644 --- a/src/git_binary.rs +++ b/src/git_binary.rs @@ -105,8 +105,13 @@ impl Git { let _span = debug_span!("git_update", "{repo_url} {}", output_dir.display()).entered(); debug!("Attempting to update clone of {repo_url} at {}", output_dir.display()); let mut cmd = self.git(); - cmd.arg("--git-dir"); - cmd.arg(output_dir); + if output_dir.join(".git").is_dir() { + cmd.arg("-C"); + cmd.arg(output_dir); + } else { + cmd.arg("--git-dir"); + cmd.arg(output_dir); + } cmd.arg("remote"); cmd.arg("update"); cmd.arg("--prune"); @@ -129,7 +134,9 @@ impl Git { debug!("Attempting to create fresh clone of {} at {}", repo_url, output_dir.display()); let mut cmd = self.git(); cmd.arg("clone"); - cmd.arg(clone_mode.arg()); + if let Some(arg) = clone_mode.arg() { + cmd.arg(arg); + } cmd.arg(repo_url.as_str()); cmd.arg(output_dir); debug!("{cmd:#?}"); @@ -151,14 +158,17 @@ pub enum CloneMode { Bare, /// Equivalent to `git clone --mirror` Mirror, + /// Standard clone with a working tree + Checkout, } impl CloneMode { /// Return the CLI argument for this clone mode. - pub fn arg(&self) -> &str { + pub fn arg(&self) -> Option<&str> { match self { - Self::Bare => "--bare", - Self::Mirror => "--mirror", + Self::Bare => Some("--bare"), + Self::Mirror => Some("--mirror"), + Self::Checkout => None, } } } @@ -183,8 +193,9 @@ mod tests { #[test] fn test_clone_mode_arg() { - assert_eq!(CloneMode::Bare.arg(), "--bare"); - assert_eq!(CloneMode::Mirror.arg(), "--mirror"); + assert_eq!(CloneMode::Bare.arg(), Some("--bare")); + assert_eq!(CloneMode::Mirror.arg(), Some("--mirror")); + assert_eq!(CloneMode::Checkout.arg(), None); } #[test] diff --git a/src/scanner/repos.rs b/src/scanner/repos.rs index 7999988..19f6b4d 100644 --- a/src/scanner/repos.rs +++ b/src/scanner/repos.rs @@ -12,10 +12,7 @@ use crate::blob::BlobIdMap; use crate::{ blob::BlobMetadata, cli::{ - commands::{ - github::{GitCloneMode, GitHistoryMode}, - scan, - }, + commands::{github::GitCloneMode, github::GitHistoryMode, scan}, global, }, findings_store, @@ -42,16 +39,20 @@ pub fn clone_or_update_git_repos( datastore: &Arc