Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added toxenv for snyk scanning #926

Merged
merged 1 commit into from
Apr 11, 2023
Merged
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
28 changes: 28 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
isolated_build = true
skip_missing_interpreters = true

[testenv]
deps =
-r{toxinidir}/requirements.txt

[testenv:pre-commit]
basepython = python3
Expand All @@ -15,3 +18,28 @@ deps =
bandit
commands =
- bandit -r -c {toxinidir}/ipas_default.config {toxinidir}/ -f txt -o {toxworkdir}/bandit-report.txt

[testenv:snyk-scan]
deps =
{[testenv]deps}
allowlist_externals =
bash
curl
wget
chmod
rm
*snyk*
commands =
bash -c "pip freeze > snyk-req.txt"
curl https://static.snyk.io/cli/latest/snyk-linux -o {toxworkdir}/snyk
chmod +x {toxworkdir}/snyk
{toxworkdir}/snyk config set endpoint={env:SNYK_ENDPOINT}
{toxworkdir}/snyk config set disable-analytics=1
- {toxworkdir}/snyk test --file=snyk-req.txt --package-manager=pip --sarif-file-output={toxworkdir}/snyk.sarif --json-file-output={toxworkdir}/snyk.json
- {toxworkdir}/snyk monitor --file=snyk-req.txt --package-manager=pip
wget -P .tox/ https://github.com/snyk/snyk-to-html/releases/download/v2.3.6/snyk-to-html-linux
chmod +x {toxworkdir}/snyk-to-html-linux
{toxworkdir}/snyk-to-html-linux -i {toxworkdir}/snyk.json -o {toxworkdir}/snyk.html -d
rm {toxworkdir}/snyk
rm {toxworkdir}/snyk-to-html-linux
rm snyk-req.txt