Skip to content

Commit 48135eb

Browse files
authored
Merge pull request #6 from reload/pull_request
Add security pull request from Dependabot
2 parents 0df4bd9 + 873c1af commit 48135eb

12 files changed

+645
-587
lines changed

.mdlrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Disable "MD013 Line length" and "MD029 Ordered list item prefix".
2+
rules "~MD013", "~MD029"

.phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<file>./src</file>
4+
<file>./tests</file>
5+
<config name="installed_paths" value="../../appocular/coding-standard"/>
6+
<rule ref="AppocularCodingStandard"/>
7+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8+
<properties>
9+
<!-- Tell Slevomat the root directories of our namespaces, so
10+
it can check if the filepath is correct. -->
11+
<property name="rootNamespaces" type="array">
12+
<element key="src" value="GitHubSecurityJira"/>
13+
<element key="tests" value="GitHubSecurityJira"/>
14+
</property>
15+
</properties>
16+
</rule>
17+
</ruleset>

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------
2-
FROM composer:1.9 AS build-env
2+
FROM composer:1.9.1 AS build-env
33

44
COPY . /opt/ghsec-jira/
55

@@ -8,7 +8,7 @@ WORKDIR /opt/ghsec-jira
88
RUN composer install --prefer-dist --no-dev
99

1010
# -----------------
11-
FROM php:7.3.12-alpine
11+
FROM php:7.4.1-alpine
1212

1313
COPY --from=build-env /opt/ghsec-jira/ /opt/ghsec-jira/
1414

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: check phpstan phpcs markdownlint
2+
3+
check: phpstan phpcs markdownlint
4+
5+
phpstan:
6+
-vendor/bin/phpstan analyse .
7+
8+
phpcs:
9+
-vendor/bin/phpcs -s bin/ src/
10+
11+
# gem install mdl
12+
markdownlint:
13+
-mdl *.md

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# github-security-jira
2-
GitHub Action for mapping security alerts to Jira tickets.
32

3+
GitHub Action for mapping security alerts to Jira tickets.
44

55
## Setup
66

@@ -9,28 +9,26 @@ You need the following pieces set up to sync alerts with Jira:
99
1. Two repo secrets containing a GitHub access token and a Jira API token, respectively.
1010
2. A workflow file which runs the action on a schedule, continually creating new tickets when necessary.
1111

12-
1312
### Repo secrets
13+
1414
The `reload/github-security-jira` action requires you to [create two encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets#creating-encrypted-secrets) in the repo:
1515

1616
1. A secret called `GitHubSecurityToken` which should contain a [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) for the GitHub user under which this action should be executed. The token must include the `public_repo` scope if checking only public repos, or the `repo` scope for use on private repos. Also, the user must have [access to security alerts in the repo](https://help.github.com/en/github/managing-security-vulnerabilities/managing-alerts-for-vulnerable-dependencies-in-your-organization).
1717
2. A secret called `JiraApiToken` containing an [API Token](https://confluence.atlassian.com/cloud/api-tokens-938839638.html) for the Jira user that should be used to create tickets.
1818

19-
2019
### Workflow file setup
20+
2121
The [GitHub workflow file](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#creating-a-workflow-file) should reside in any repo where you want to sync security alerts with Jira.
2222

2323
It has some required and some optional settings, which are passed to the action as environment variables:
2424

2525
- `GH_SECURITY_TOKEN`: A reference to the repo secret `GitHubSecurityToken` (**REQUIRED**)
2626
- `JIRA_TOKEN`: A reference to the repo secret `JiraApiToken` (**REQUIRED**)
27-
- `JIRA_HOST`: The endpoint for your Jira instance, e.g. https://foo.atlassian.net (**REQUIRED**)
27+
- `JIRA_HOST`: The endpoint for your Jira instance, e.g. <https://foo.atlassian.net> (**REQUIRED**)
2828
- `JIRA_USER`: The ID of the Jira user which is associated with the 'JiraApiToken' secret, eg '[email protected]' (**REQUIRED**)
2929
- `JIRA_PROJECT`: The project key for the Jira project where issues should be created, eg `TEST` or `ABC`. (**REQUIRED**)
3030
- `JIRA_ISSUE_TYPE`: Type of issue to create, e.g. `Security`. Defaults to `Bug`. (*Optional*)
31-
- `JIRA_WATCHERS`: Jira users to add as watchers to tickets. Use the [YAML block scalar literal style indicator with stripping chomping indicator](https://yaml-multiline.info/) (pipe and dash: `|-`) to add multiple watchers. (*Optional*)
32-
- `JIRA_RESTRICTED_GROUP`: If set, the action will add a restricted comment to the ticket, viewable by only this Jira group. (*Optional*)
33-
- `JIRA_RESTRICTED_COMMENT`: The comment to post. Use the YAML multiline operator for adding linebreaks to the comment. (*Optional, but required if group is set*)
31+
- `JIRA_WATCHERS`: Jira users to add as watchers to tickets. Separate multiple watchers with comma (no spaces).
3432

3533
Here is an example setup which runs this action every 6 hours.
3634

@@ -54,16 +52,9 @@ jobs:
5452
JIRA_USER: [email protected]
5553
JIRA_PROJECT: ABC
5654
JIRA_ISSUE_TYPE: Security
57-
JIRA_WATCHERS: |-
58-
59-
60-
JIRA_RESTRICTED_GROUP: Developers
61-
JIRA_RESTRICTED_COMMENT: |-
62-
Remember to evaluate severity here and set ticket priority.
63-
Check out the guide [in our wiki|https://foo.atlassian.net/wiki/]!
55+
6456
```
6557
66-
6758
## Local development
6859
6960
Copy `docker-composer.override.example.yml` to `docker-composer.override.yml` and edit according to your settings.

composer.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@
44
"license": "MIT",
55
"require": {
66
"php": ">=7.2.0",
7-
"lesstif/php-jira-rest-client": "^1",
87
"softonic/graphql-client": "^1.2",
98
"symfony/console": "^4",
10-
"symfony/yaml": "^5.0"
9+
"symfony/yaml": "^5.0",
10+
"reload/jira-security-issue": "dev-master"
1111
},
12+
"repositories": [
13+
{
14+
"type": "vcs",
15+
"url": "https://github.com/appocular/coding-standard"
16+
},
17+
{
18+
"type": "vcs",
19+
"url": "https://github.com/reload/jira-security-issue"
20+
}
21+
],
1222
"autoload": {
1323
"psr-4": {
1424
"GitHubSecurityJira\\": "src/"
1525
}
26+
},
27+
"require-dev": {
28+
"appocular/coding-standard": "^1.0",
29+
"phpstan/phpstan": "^0.12.5"
1630
}
1731
}

0 commit comments

Comments
 (0)