|
| 1 | +# publish-sarif-to-jira |
| 2 | + |
| 3 | +Python project to push SARIF output to JIRA Cloud and track progress of personal projects in JIRA |
| 4 | + |
| 5 | +Project Status: **In Active Development** |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +1. Requires a JIRA Cloud account |
| 10 | + - Access to the Authentication Email and API token |
| 11 | + |
| 12 | +## Work items |
| 13 | + |
| 14 | +1. Use rich-text (Atlassian Document Format) in JIRA Issue description |
| 15 | + |
| 16 | + > **Note**: This feature is gated with the config parameter `use_atlassian_document_format` in the config.json file. Set to true to use this feature. |
| 17 | + **Bug**: Atlassian does not accept ADF rich-text formatted description, rather dumps JSON in the issue description. Needs triage and bug fix. |
| 18 | + |
| 19 | +2. Create sub-tasks instead of multi-lines in the JIRA Issue description |
| 20 | + |
| 21 | + > **Note**: This feature is not implemented yet and will be gated with the config parameter `create_sub_tasks` in the config.json file. Set to true to build and test this feature. |
| 22 | +
|
| 23 | +## Usage |
| 24 | + |
| 25 | +1. Copy the `.env.example` file into `.env` |
| 26 | +2. Update the configuration values, both `input` and `jira` values on the `.env` file |
| 27 | +3. Run Docker container using |
| 28 | +`docker run --network host -itd --env-file .env publish-sarif-to-jira:main` |
| 29 | + |
| 30 | +4. The Python script within the Docker container iterates through the SARIF files (files ending with `.sarif` extension or has the term `.sarif` in the filename) and creates JIRA Issues on your JIRA Cloud instance |
| 31 | + |
| 32 | +> This script has not been tested with the self-hosted instances of JIRA |
| 33 | +
|
| 34 | +## Configuration |
| 35 | + |
| 36 | +| `config.json` | Config Environment variable | Description | |
| 37 | +|---------------|-----------------------------|-------------| |
| 38 | +| `input["type"]` | `input_type` | Supported SARIF input types: `file`| |
| 39 | +| `input["format"]` | `input_format` | Supported SARIF format: `sarif` | |
| 40 | +| `jira["cloud_url"]` | `jira_cloud_url` | JIRA Cloud URL: `https://XXXX.atlassian.net/` | |
| 41 | +| `jira["project_key"]` | `jira_project_key` | JIRA Project Key: `PROJ-XYZ` | |
| 42 | +| `jira["auth_email"]` | `jira_auth_email` | Authentication Email: `test@example.com` | |
| 43 | +| `jira["api_token"]` | `jira_api_token` | API token: `<INSERT-YOUR-JIRA-CLOUD-API-TOKEN>` | |
| 44 | +| `jira["default_issue_labels"]` | `jira_default_issue_labels` | For config.json - `["Label1","Label2"]`. For config environment variables, we use comma-separated string like `Label1,Label2` | |
| 45 | +| `jira["use_atlassian_document_format"]` | `jira_use_atlassian_document_format` | Unsupported yet on JIRA Cloud. Defaults to `false`. | |
| 46 | +| `jira["create_sub_tasks"]` | `jira_create_sub_tasks` | Placeholder. Feature yet to be developed. Defaults to `false`. | |
| 47 | + |
| 48 | +## Tool Compatibility |
| 49 | + |
| 50 | +| Tools | Link | Status | |
| 51 | +|-------|------|--------| |
| 52 | +| `cfn-lint` | [aws-cloudformation/cfn-lint](https://github.com/aws-cloudformation/cfn-lint) | √ | |
| 53 | +| `trivy` | [aquasecurity/trivy](https://github.com/aquasecurity/trivy) | √ | |
| 54 | + |
| 55 | +## GitHub Actions |
| 56 | + |
| 57 | +``` |
| 58 | + - name: Create JIRA tickets from SARIF |
| 59 | + uses: GeorgeDavis-Ibexlabs/publish-sarif-to-jira@v0.0.6 |
| 60 | +``` |
| 61 | +Refer to [Create JIRA tickets from SARIF using GitHub Actions](https://github.com/marketplace/actions/create-jira-tickets-from-sarif) |
| 62 | + |
| 63 | +## Work in progress |
| 64 | + |
| 65 | +- #### VSCode Extension |
| 66 | + |
| 67 | + Plans to build this project into a VSCode extension to submit SARIF output to JIRA direct from the IDE and track progress |
| 68 | + |
| 69 | +## Upcoming features |
| 70 | + |
| 71 | +Feature requests are currently tracked by the original author within the source code. Clone this repository, run a search for the term "TODO" to find the list of new features being tracked. |
| 72 | + |
| 73 | +1. Create sub-tasks instead of multi-lines in the JIRA Issue description |
| 74 | +2. Fully support Atlassian Document Format (ADF). Currently, a bug is limiting the ADF from appearing formatted when visiting the JIRA Issue on JIRA Cloud |
| 75 | +3. Create a JIRA Project if the project does not exist (Nice to have so it can be deployed per project all from CI/CD without the need to access JIRA Cloud) |
| 76 | + |
| 77 | +## Contribute |
| 78 | + |
| 79 | +If you encounter a bug or think of a useful feature, or find something confusing in the docs, please create a new issue. |
| 80 | + |
| 81 | +I ♥️ pull requests. If you'd like to fix a bug or contribute to a feature or simply correct a typo, please feel free to do so. |
| 82 | + |
| 83 | +If you're thinking of adding a new feature, consider opening an issue first to discuss it to ensure it aligns with the direction of the project and potentially save yourself some time. |
| 84 | + |
| 85 | +## Development |
| 86 | + |
| 87 | +```sh |
| 88 | +docker login |
| 89 | +``` |
| 90 | + |
| 91 | +```sh |
| 92 | +docker build --no-cache --progress=plain . -f Dockerfile -t publish-sarif-to-jira:main 2>&1 | tee build.log |
| 93 | +``` |
| 94 | + |
| 95 | +```sh |
| 96 | +docker run --network host -itd \ |
| 97 | +--env-file .env \ |
| 98 | +-e LOG_LEVEL='DEBUG' \ |
| 99 | +publish-sarif-to-jira:main |
| 100 | +``` |
0 commit comments