-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
There is a new make file, doc/Makefile that defines these goals: - `check-requirements`: Check `requirements.txt` for security problems (CVEs) using `skjold`. This goal is intended for the "Users guide" CI. SKJOLD_GITHUB_API_TOKEN might have to be set if GITHUB_TOKEN is not in the environment, in order to access the GitHub GraphQL API. - `build-and-check-requirements`: Rebuild `requirements.txt` from `requirements.in` using `pip-compile`, and check with `check-requirements`. This goal is intended for manual invocation. It is invoked from the top Makefile via goal `users-guide-requirements`. Alternatively, these goals could be coupled with the doc build `make users-guide`. However, since these goals require a couple of seconds to run, I think it is annoying to call them on every build of the documentation.
- Loading branch information
1 parent
8760e3d
commit a57cbc4
Showing
7 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Build and safety-check requirements.txt | ||
|
||
# skjold needs a personal github access token. This needs no permissions, | ||
# it is only required to query the GitHub GraphQL API v4. | ||
# See: https://pythonawesome.com/security-audit-python-project-dependencies-against-security-advisory-databases/ | ||
# We attempt to get it from the environment variable GITHUB_TOKEN. | ||
# It can also be passed to this Makefile via either: | ||
# | ||
# make GITHUB_TOKEN=... (build-and-)check-requirements | ||
# make SKJOLD_GITHUB_API_TOKEN=... (build-and-)check-requirements | ||
# | ||
# | ||
SKJOLD_GITHUB_API_TOKEN=${GITHUB_TOKEN} | ||
|
||
.PHONY: build-and-check-requirements | ||
build-and-check-requirements: requirements.txt check-requirements | ||
|
||
# Always rebuild requirements.txt | ||
.PHONY: requirements.txt | ||
# requirements.txt is generated from requirements.in | ||
# via pip-compile included in the pip-tools package. | ||
# See https://modelpredict.com/wht-requirements-txt-is-not-enough | ||
requirements.txt: requirements.in | ||
. ../.python-sphinx-virtualenv/bin/activate \ | ||
&& pip install pip-tools \ | ||
&& pip-compile requirements.in | ||
|
||
# Check requirements.txt for security violations via skjold, | ||
# configured in pyproject.toml. | ||
# See: https://pythonawesome.com/security-audit-python-project-dependencies-against-security-advisory-databases/ | ||
.PHONY: check-requirements | ||
check-requirements: | ||
@if [ "\'${SKJOLD_GITHUB_API_TOKEN}\'" == "\'\'" ] \ | ||
; then \ | ||
echo "WARNING: Neither SKOLD_GITHUB_API_TOKEN nor GITHUB_TOKEN is set." \ | ||
; echo "Vulnerability check via skjold might fail when using the GitHub GraphQL API." \ | ||
; fi | ||
. ../.python-sphinx-virtualenv/bin/activate \ | ||
&& pip install skjold \ | ||
&& skjold audit | ||
# NB: For portability, we use '.' (sh etc.) instead of 'source' (bash). | ||
|
||
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# https://pythonawesome.com/security-audit-python-project-dependencies-against-security-advisory-databases/ | ||
[tool.skjold] | ||
sources = ['github', 'gemnasium', 'pyup'] | ||
report_only = false | ||
# ALT: true # Report only, always exit with zero. | ||
report_format = 'cli' | ||
# ALT: 'json' # Output findings as `json`. Default is 'cli'. | ||
verbose = true | ||
cache_dir = '.skjold_cache' | ||
cache_expires = 43200 # Cache max. age. (43200 = 12hrs) | ||
ignore_file = '.skjoldignore' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
sphinx >= 3.1 | ||
sphinx_rtd_theme | ||
sphinx-jsonschema | ||
# Pygments>=2.7.4 suggested by CVE-2021-20270 CVE-2021-27291 | ||
Pygments >= 2.7.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters