Skip to content

Commit b0a7037

Browse files
Nicorettitkilias
andauthored
Add project support to security-issues (#126)
-------- Co-authored-by: Torsten Kilias <[email protected]>
1 parent 973fc77 commit b0a7037

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

.github/actions/security-issues/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ inputs:
1515
description: 'Github Token'
1616
required: true
1717

18+
project:
19+
description: 'Project the created tickets shall be associated with'
20+
required: false
21+
1822
runs:
1923

2024
using: "composite"
@@ -28,7 +32,7 @@ runs:
2832
- name: Install Python Toolbox / Security tool
2933
shell: bash
3034
run: |
31-
pip install exasol-toolbox==0.6.2
35+
pip install exasol-toolbox==0.7.0
3236
3337
- name: Create Security Issue Report
3438
shell: bash
@@ -53,7 +57,7 @@ runs:
5357
GH_TOKEN: ${{ inputs.github-token }}
5458
shell: bash
5559
run: |
56-
tbx security cve create < issues.jsonl | tee created.txt
60+
tbx security cve create --project "${{ inputs.project }}" < issues.jsonl | tee created.txt
5761
5862
- name: Create Report
5963
shell: bash

doc/changelog.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,21 @@
66
Unreleased
77
==========
88

9+
10+
.. _changelog-0.7.0:
11+
12+
13+
0.7.0 - 2024-01-26
14+
==================
15+
16+
✨ Added
17+
--------
18+
* Added support for referencing projects in security-issues action.
19+
20+
921
.. _changelog-0.6.2:
1022

23+
1124
0.6.2 - 2023-11-20
1225
==================
1326

doc/github_actions/security_issues.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Currently there are only two converters available
6767

6868

6969
Input Format
70-
------------
70+
____________
7171

7272
The expect intput format is jsonl (line based json), of the following form:
7373

@@ -88,6 +88,19 @@ The temporary GitHub token of the workflow needs to be passed into the action (:
8888
in order to enable the action to query and created GitHub issues.
8989

9090

91+
project
92+
+++++++
93+
Title of the GitHub-Project the created issue(s) shall be associated with (default = None).
94+
To determine the title of an project you can use the GitHub-CLI, see example below.
95+
96+
.. code-block:: shell
97+
98+
gh project list --owner exasol
99+
100+
NUMBER TITLE STATE ID
101+
...
102+
103+
91104
Ideas
92105
-----
93106

exasol/toolbox/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Rating(Enum):
3434
F = Broken (Get it fixed!)
3535
N/A = Rating is not available
3636
"""
37+
3738
A = "A"
3839
B = "B"
3940
C = "C"

exasol/toolbox/tools/security.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,16 @@ def as_markdown_listing(elements: Iterable[str]):
128128
)
129129

130130

131-
def create_security_issue(issue: Issue) -> Tuple[str, str]:
131+
def create_security_issue(issue: Issue, project="") -> Tuple[str, str]:
132132
# fmt: off
133133
command = [
134134
"gh", "issue", "create",
135135
"--label", "security",
136136
"--title", security_issue_title(issue),
137137
"--body", security_issue_body(issue),
138138
]
139+
if project:
140+
command.extend(['--project', project])
139141
# fmt: on
140142
try:
141143
result = subprocess.run(command, check=True, capture_output=True)
@@ -235,6 +237,9 @@ def create(
235237
input_file: typer.FileText = typer.Argument(
236238
default="-", mode="r", help="file of cve's in the jsonl format"
237239
),
240+
project: str = typer.Option(
241+
default="", help="Project the created ticket shall be associated with."
242+
),
238243
) -> None:
239244
"""
240245
Create GitHub issues for CVE's
@@ -246,7 +251,7 @@ def create(
246251
Links to the created issue(s)
247252
"""
248253
for issue in _issues(input_file):
249-
std_err, std_out = create_security_issue(issue)
254+
std_err, std_out = create_security_issue(issue, project)
250255
stderr(std_err)
251256
stdout(std_out)
252257

exasol/toolbox/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
# Do not edit this file manually!
66
# If you need to change the version, do so in the project.toml, e.g. by using `poetry version X.Y.Z`.
77
MAJOR = 0
8-
MINOR = 6
9-
PATCH = 2
8+
MINOR = 7
9+
PATCH = 0
1010
VERSION = f"{MAJOR}.{MINOR}.{PATCH}"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "exasol-toolbox"
33
packages = [
44
{ include = "exasol" },
55
]
6-
version = "0.6.2"
6+
version = "0.7.0"
77
description = ""
88
authors = [
99
"Nicola Coretti <[email protected]>"

0 commit comments

Comments
 (0)