From 42029d4445e580747563799418428d473ff8f7d7 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Tue, 6 Aug 2024 12:18:09 +0000 Subject: [PATCH] feat: add functions for scanning jenkins, elasticsearch and huggingface --- Cargo.lock | 2 +- Cargo.toml | 8 ++++---- README.md | 35 +++++++++++++++++++---------------- fluentci.toml | 2 +- src/lib.rs | 27 +++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dc76b0..62bfcf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -373,7 +373,7 @@ dependencies = [ [[package]] name = "trufflehog" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "extism-pdk", diff --git a/Cargo.toml b/Cargo.toml index a71e12d..9ef3c20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,19 @@ [package] authors = [ - "Tsiry Sandratraina " + "Tsiry Sandratraina ", ] description = "Set up your CI/CD Pipeline with a specific version of trufflehog" edition = "2021" license = "MIT" name = "trufflehog" -version = "0.1.0" +version = "0.1.1" [lib] crate-type = [ - "cdylib" + "cdylib", ] [dependencies] anyhow = "1.0.82" extism-pdk = "1.1.0" -fluentci-pdk = "0.1.9" \ No newline at end of file +fluentci-pdk = "0.1.9" diff --git a/README.md b/README.md index b0c4741..37eeed8 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,23 @@ fluentci run --wasm trufflehog setup ## Functions -| Name | Description | -| ---------- | -------------------------------------------- | -| setup | Installs a specific version of trufflehog. | -| git | Find credentials in git repositories | -| github | Find credentials in GitHub repositories. | -| gitlab | Find credentials in GitLab repositories. | -| filesystem | Find credentials in a filesystem. | -| s3 | Find credentials in S3 buckets. | -| gcs | Find credentials in GCS buckets | -| syslog | Scan syslog | -| circleci | Scan CircleCI | -| docker | Scan Docker Image | -| travisci | Scan TravisCI | -| postman | Scan Postman | +| Name | Description | +| ------------- | -------------------------------------------- | +| setup | Installs a specific version of trufflehog. | +| git | Find credentials in git repositories | +| github | Find credentials in GitHub repositories. | +| gitlab | Find credentials in GitLab repositories. | +| filesystem | Find credentials in a filesystem. | +| s3 | Find credentials in S3 buckets. | +| gcs | Find credentials in GCS buckets | +| syslog | Scan syslog | +| circleci | Scan CircleCI | +| docker | Scan Docker Image | +| travisci | Scan TravisCI | +| postman | Scan Postman | +| jenkins | Scan Jenkins | +| elasticsearch | Scan Elasticsearch | +| huggingface | Scan Huggingface | ## Code Usage @@ -36,7 +39,7 @@ Add `fluentci-pdk` crate to your `Cargo.toml`: ```toml [dependencies] -fluentci-pdk = "0.1.9" +fluentci-pdk = "0.2.1" ``` Use the following code to call the plugin: @@ -46,7 +49,7 @@ use fluentci_pdk::dag; // ... -dag().call("https://pkg.fluentci.io/trufflehog@v0.1.0?wasm=1", "setup", vec!["latest"])?; +dag().call("https://pkg.fluentci.io/trufflehog@v0.1.1?wasm=1", "setup", vec!["latest"])?; ``` ## 📚 Examples diff --git a/fluentci.toml b/fluentci.toml index af9e3f8..aa139fc 100644 --- a/fluentci.toml +++ b/fluentci.toml @@ -5,4 +5,4 @@ authors = [ description = "CI/CD Plugin for TruffleHog" license = "MIT" name = "trufflehog" -version = "0.1.0" +version = "0.1.1" diff --git a/src/lib.rs b/src/lib.rs index fac8cbe..180d2bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -116,3 +116,30 @@ pub fn postman(flags: String) -> FnResult { .stdout()?; Ok(stdout) } + +#[plugin_fn] +pub fn jenkins(flags: String) -> FnResult { + let stdout = dag() + .pkgx()? + .with_exec(vec!["pkgx", "trufflehog", "jenkins", &flags])? + .stdout()?; + Ok(stdout) +} + +#[plugin_fn] +pub fn elasticsearch(flags: String) -> FnResult { + let stdout = dag() + .pkgx()? + .with_exec(vec!["pkgx", "trufflehog", "elasticsearch", &flags])? + .stdout()?; + Ok(stdout) +} + +#[plugin_fn] +pub fn huggingface(flags: String) -> FnResult { + let stdout = dag() + .pkgx()? + .with_exec(vec!["pkgx", "trufflehog", "huggingface", &flags])? + .stdout()?; + Ok(stdout) +}