-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub-Action for reporting security issues
* Add various security related cli tools * Add composite Github Action for reporting security issues --------- Co-authored-by: Torsten Kilias <[email protected]> Co-authored-by: Christoph Pirkl <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,037 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: 'SIA' | ||
description: 'The Security Issues Action creates github issues for open security issues in the repository' | ||
|
||
inputs: | ||
|
||
command: | ||
description: 'Command for generating a security report' | ||
required: true | ||
|
||
format: | ||
description: 'Input format (e.g. "maven" or "pass-through")' | ||
required: true | ||
|
||
github-token: | ||
description: 'Github Token' | ||
required: true | ||
|
||
runs: | ||
|
||
using: "composite" | ||
steps: | ||
|
||
- name: Setup Python (${{ inputs.python-version}}) | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install Python Toolbox / Security tool | ||
shell: bash | ||
run: | | ||
pip install exasol-toolbox==0.6.0 | ||
- name: Create Security Issue Report | ||
shell: bash | ||
run: | | ||
${{ inputs.command }} | tee input | ||
- name: Convert Report To Common Input Format | ||
shell: bash | ||
run: | | ||
tbx security cve convert ${{inputs.format}} < input | tee cves.jsonl | ||
- name: Filter Issues | ||
env: | ||
GH_TOKEN: ${{ inputs.github-token }} | ||
shell: bash | ||
run: | | ||
tbx security cve filter github-issues < cves.jsonl 2> filtered.txt | tee issues.jsonl | ||
cat filtered.txt | ||
- name: Create Issues | ||
env: | ||
GH_TOKEN: ${{ inputs.github-token }} | ||
shell: bash | ||
run: | | ||
tbx security cve create < issues.jsonl | tee created.txt | ||
- name: Create Report | ||
shell: bash | ||
run: | | ||
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY | ||
echo -e "## Created Security Issue\n" >> $GITHUB_STEP_SUMMARY | ||
cat created.txt >> $GITHUB_STEP_SUMMARY | ||
echo -e "## Filtered Security Issue\n" >> $GITHUB_STEP_SUMMARY | ||
tail -n +2 filtered.txt | grep . >> $GITHUB_STEP_SUMMARY |
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 |
---|---|---|
|
@@ -7,6 +7,4 @@ | |
|
||
../design | ||
development | ||
todos | ||
|
||
|
||
ideas |
4 changes: 2 additions & 2 deletions
4
doc/developer_guide/todos.rst → doc/developer_guide/ideas.rst
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,7 @@ | ||
🦺 Github Actions | ||
================= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
security_issues |
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,102 @@ | ||
security-issues | ||
=============== | ||
|
||
Example Usage | ||
------------- | ||
|
||
.. code-block:: yaml | ||
name: Report Security Issues for Repository | ||
on: | ||
schedule: | ||
# “Every day at 00:00.” (https://crontab.guru) | ||
- cron: "0 0 * * *" | ||
jobs: | ||
report_security_issues: | ||
name: Report Security Issues | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
steps: | ||
- name: SCM Checkout | ||
uses: actions/checkout@v4 | ||
- name: Report Security Issues | ||
uses: exasol/python-toolbox/.github/actions/[email protected]/security-issues-action | ||
with: | ||
format: "maven" | ||
command: "cat maven-cve-report.json" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
Configuration | ||
------------- | ||
This action exposes 3 configuration parameters `command`_, `format`_ and `github-token`_, for details see | ||
the specific sections below. | ||
|
||
command | ||
+++++++ | ||
|
||
Workspace command which shall be executed in order to check the project's dependencies for CVEs. | ||
|
||
.. note:: | ||
|
||
The calling workflow needs to make sure the specified command can be executed in the context of the workflow. | ||
|
||
|
||
format | ||
++++++ | ||
|
||
Specifies converter which needs to be applied on the output of the provided command. | ||
Currently there are only two converters available | ||
|
||
#. maven | ||
|
||
Converts the output of mavens oss plugin into required input format. | ||
|
||
|
||
#. pass-through | ||
|
||
In case the command itself already outputs the expected input format, the format can be specified as code:`pass-through`. | ||
|
||
|
||
Input Format | ||
------------ | ||
|
||
The expect intput format is jsonl (line based json), of the following form: | ||
|
||
.. code-block:: python | ||
{ "cve": "<cve-id>", "cwe": "<cwe-id>", "description": "<multiline string>", "coordinates": "<string>", "references": ["<url>", "<url>", ...] } | ||
.. attention:: | ||
|
||
The input format may change in the future. Therefore make sure to rather use or contribute a converter for | ||
a specific format rather than outputting this format by your own tooling. | ||
|
||
|
||
github-token | ||
++++++++++++ | ||
The temporary GitHub token of the workflow needs to be passed into the action (:code:`${{ secrets.GITHUB_TOKEN }}`), | ||
in order to enable the action to query and created GitHub issues. | ||
|
||
|
||
Ideas | ||
----- | ||
|
||
.. todo:: | ||
|
||
Add additional details to the :code:`security.Issue` type | ||
|
||
|
||
.. todo:: | ||
|
||
Consider adapting common CVE report format as input, for additional details | ||
`see here <https://github.com/CVEProject/cve-schema/blob/master/schema/v5.0/CVE_JSON_5.0_schema.json>`_. |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
user_guide/user_guide | ||
tools | ||
github_actions/github_actions | ||
api | ||
developer_guide/developer_guide | ||
changelog |
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,48 +1,28 @@ | ||
💻 Tools | ||
======== | ||
|
||
tbx | ||
--- | ||
The :code:`tbx` is the main entry point for all of the toolbox specific tooling. | ||
The python-toolbox ships with a set of command line tools, whose entry point always is the command :code:`tbx`. | ||
The commands are structured in a *tree* manner, and help is provided along with the command(s) no matter the nesting. | ||
|
||
How to get Help | ||
--------------- | ||
|
||
.. code-block:: shell | ||
$ tbx --help | ||
Usage: tbx [OPTIONS] COMMAND [ARGS]... | ||
╭─ Options ───────────────────────────────────────────────────────────────────────────╮ | ||
│ --install-completion Install completion for the current shell. │ | ||
│ --show-completion Show completion for the current shell, to copy it or │ | ||
│ customize the installation. │ | ||
│ --help Show this message and exit. │ | ||
╰─────────────────────────────────────────────────────────────────────────────────────╯ | ||
╭─ Commands ──────────────────────────────────────────────────────────────────────────╮ | ||
│ workflow │ | ||
╰─────────────────────────────────────────────────────────────────────────────────────╯ | ||
workflow | ||
++++++++ | ||
The workflow command helps to install and maintain GitHub workflows provided by the toolbox. | ||
|
||
.. code-block:: shell | ||
$ tbx workflow --help | ||
$ tbx command --help | ||
Usage: tbx workflow [OPTIONS] COMMAND [ARGS]... | ||
╭─ Options ───────────────────────────────────────────────────────────────────────────╮ | ||
│ --help Show this message and exit. │ | ||
╰─────────────────────────────────────────────────────────────────────────────────────╯ | ||
╭─ Commands ──────────────────────────────────────────────────────────────────────────╮ | ||
│ diff Diff a specific workflow against the installed one. │ | ||
│ install Installs the requested workflow into the target directory. │ | ||
│ list List all available workflows. │ | ||
│ show Shows a specific workflow. │ | ||
│ update Similar to install but checks for existing workflows and shows diff │ | ||
╰─────────────────────────────────────────────────────────────────────────────────────╯ | ||
.. code-block:: shell | ||
$ tbx command subcommand --help | ||
.. code-block:: shell | ||
$ tbx command subcommand subsubcommand --help | ||
If the details for a specific command are not sufficient checkout the according subsections bellow, | ||
or `create an isssue <https://github.com/exasol/python-toolbox/issues/new?assignees=&labels=documentation&projects=&template=documentation.md&title=%F0%9F%93%9A+%3CInsert+Title%3E>`_ if nothing is avialable yet. |
Oops, something went wrong.