Skip to content

Commit

Permalink
add code, iac, sbom, code and log4shell functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Aug 6, 2024
1 parent f097562 commit 73336d4
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
pipeline: .
args: |
setup
iac_test --severity-threshold=medium
iac test --severity-threshold=medium
working-directory: example
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion plugin/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 plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "snyk"
version = "0.6.0"
version = "0.6.1"

[lib]
crate-type = ["cdylib"]
Expand Down
90 changes: 90 additions & 0 deletions plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,96 @@ pub fn test(args: String) -> FnResult<String> {
Ok(stdout)
}

#[plugin_fn]
pub fn iac(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("iac test")?
.pkgx()?
.with_exec(vec![
"pkgx",
"+nodejs.org",
"+bun.sh",
"bunx",
"snyk",
"iac",
&args,
])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn code(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("iac test")?
.pkgx()?
.with_exec(vec![
"pkgx",
"+nodejs.org",
"+bun.sh",
"bunx",
"snyk",
"code",
&args,
])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn sbom(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("iac test")?
.pkgx()?
.with_exec(vec![
"pkgx",
"+nodejs.org",
"+bun.sh",
"bunx",
"snyk",
"sbom",
&args,
])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn log4shell(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("iac test")?
.pkgx()?
.with_exec(vec![
"pkgx",
"+nodejs.org",
"+bun.sh",
"bunx",
"snyk",
"log4shell",
&args,
])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn container(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("iac test")?
.pkgx()?
.with_exec(vec![
"pkgx",
"+nodejs.org",
"+bun.sh",
"bunx",
"snyk",
"container",
&args,
])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn iac_test(args: String) -> FnResult<String> {
let stdout = dag()
Expand Down

0 comments on commit 73336d4

Please sign in to comment.