Skip to content

Commit fb07f92

Browse files
playing
1 parent fffc4a0 commit fb07f92

17 files changed

+1006
-50
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ WORKDIR /opt/ghsec-jira
77

88
RUN composer install --prefer-dist --no-dev
99

10+
RUN cat composer.lock
11+
1012
# -----------------
1113
FROM php:8.2.11-alpine3.18@sha256:671c309315113b73eba316bb175e130f376d3ba5e1a930794909ef5a1cb10fbc
1214

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"php": ">=8.1",
77
"softonic/graphql-client": "^2.1",
88
"symfony/console": "^5",
9-
"symfony/yaml": "^6.1",
10-
"flextock/jira-security-issue": "^1.0.0"
9+
"symfony/yaml": "^6.1"
1110
},
1211
"repositories": [
1312
{
@@ -17,7 +16,8 @@
1716
],
1817
"autoload": {
1918
"psr-4": {
20-
"GitHubSecurityJira\\": "src/"
19+
"GitHubSecurityJira\\": "src/",
20+
"JiraSecurityIssue\\": "jira-security-issue/"
2121
}
2222
},
2323
"require-dev": {

composer.lock

Lines changed: 0 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jira-security-issue/.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,feature}]
15+
indent_size = 2

jira-security-issue/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
.phpunit.result.cache

jira-security-issue/.phpcs.xml

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

jira-security-issue/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Reload A/S
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

jira-security-issue/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: test lint phpunit phpcs phpstan all
2+
3+
all: test lint
4+
5+
lint: phpcs phpstan
6+
7+
test: phpunit
8+
9+
phpcs:
10+
vendor/bin/phpcs
11+
12+
phpunit:
13+
vendor/bin/phpunit
14+
15+
phpstan:
16+
vendor/bin/phpstan analyse

jira-security-issue/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Reload Jira Security Issue
2+
3+
This is a small library that can create Jira issues. The main idea is
4+
that it's simple to use and it'll not recreate an issue if the proper
5+
keys are supplied.
6+
7+
Quick example:
8+
9+
``` php
10+
$issue = new JiraSecurityIssue();
11+
12+
$issue->setTitle('Issue title')
13+
->setBody('The main body');
14+
15+
$issue->setKeyLabel('some-unique-id');
16+
17+
echo $issue->ensure();
18+
```
19+
20+
Configuration is set using environment variables, for ease of use in
21+
CI systems.
22+
23+
- `JIRA_TOKEN`: A reference to the repo secret `JiraApiToken` (**REQUIRED**)
24+
- `JIRA_HOST`: The endpoint for your Jira instance, e.g. https://foo.atlassian.net (**REQUIRED**)
25+
- `JIRA_USER`: The ID of the Jira user which is associated with the 'JiraApiToken' secret, eg '[email protected]' (**REQUIRED**)
26+
- `JIRA_PROJECT`: The project key for the Jira project where issues should be created, eg `TEST` or `ABC`. (**REQUIRED** if not set in code)
27+
- `JIRA_ISSUE_TYPE`: Type of issue to create, e.g. `Security`. Defaults to `Bug`. (*Optional*)
28+
- `JIRA_WATCHERS`: Jira users to add as watchers to tickets. Separate
29+
multiple watchers with comma (no spaces). (*Optional*)
30+
- `JIRA_RESTRICTED_COMMENT_ROLE`: A comment with restricted visibility
31+
to this role is posted with info about who was added as watchers to
32+
the issue. Defaults to `Developers`. (*Optional*)

jira-security-issue/bin/jsi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require __DIR__.'/../vendor/autoload.php';
5+
6+
use Symfony\Component\Console\Application;
7+
use Reload\JiraSecurityIssueCommand;
8+
use Reload\JiraUserInfoCommand;
9+
10+
$application = new Application('jsi');
11+
12+
$application->add(new JiraSecurityIssueCommand());
13+
$application->add(new JiraUserInfoCommand());
14+
$application->setDefaultCommand('ensure');
15+
16+
17+
$application->run();

jira-security-issue/composer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "reload/jira-security-issue",
3+
"description": "Create Jira issues if it doesn't exist",
4+
"license": "MIT",
5+
"require": {
6+
"php": ">=8.2.0",
7+
"lesstif/php-jira-rest-client": "^5",
8+
"webignition/symfony-console-typed-input": "^0.6"
9+
},
10+
"autoload": {
11+
"psr-4": {
12+
"Reload\\": "src/"
13+
}
14+
},
15+
"autoload-dev": {
16+
"psr-4": {
17+
"Reload\\": "tests/"
18+
}
19+
},
20+
"require-dev": {
21+
"appocular/coding-standard": "^2.0",
22+
"phpstan/phpstan": "^1.10",
23+
"phpunit/phpunit": "^9.6",
24+
"sempro/phpunit-pretty-print": "^1.2",
25+
"symfony/console": "^5.0",
26+
"phpspec/prophecy": "^1.15",
27+
"jangregor/phpstan-prophecy": "^1.0",
28+
"phpspec/prophecy-phpunit": "^2.0",
29+
"phpstan/extension-installer": "^1.3"
30+
},
31+
"config": {
32+
"lock": false,
33+
"allow-plugins": {
34+
"dealerdirect/phpcodesniffer-composer-installer": true,
35+
"phpstan/extension-installer": true
36+
}
37+
}
38+
}

jira-security-issue/phpstan.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
level: max
3+
paths:
4+
- .
5+
excludePaths:
6+
- vendor

jira-security-issue/phpunit.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false"
12+
printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9"
13+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
14+
<coverage processUncoveredFiles="true">
15+
<include>
16+
<directory suffix=".php">./src</directory>
17+
</include>
18+
</coverage>
19+
<testsuites>
20+
<testsuite name="Suite">
21+
<directory suffix="Test.php">./tests</directory>
22+
</testsuite>
23+
</testsuites>
24+
</phpunit>

0 commit comments

Comments
 (0)