Git Product home page Git Product logo

ghas-jira-integration's Introduction

Synchronize GitHub Code Scanning alerts to Jira issues

GitHub's REST API and webhooks give customers the option of exporting alerts to any issue tracker, by allowing users to fetch the data via API endpoints and/or by receiving webhook POST requests to a hosted server.

This repository

This repository gives a quick illustrative example of how to integrate GitHub Code Scanning with Jira. The code is intended as a proof-of-concept, showing the basic operations necessary to handle incoming requests from GitHub. Please feel free to use this as a starting point for your own integration.

Using the GitHub Action

The easiest way to use this tool is via its GitHub Action, which you can add to your workflows. Here is what you need before you can start:

  • A GitHub repository with Code Scanning enabled and a few alerts. Follow this guide to set up Code Scanning.
  • The URL of your Jira Server instance.
  • A Jira project to store your issues. You will need to provide its project key to the action. (Must be Scrum project type; Kanban will not work.)
  • A Jira Server account (username + password) with the following permissions for the abovementioned project:
    • Browse Projects
    • Close Issues
    • Create Issues
    • Delete Issues
    • Edit Issues
    • Transition Issues
  • Depending on where you run your workflow, the Jira Server instance must be accessible from either the GitHub.com IP addresses or the address of your GitHub Enterprise Server instance.

Make sure you safely store all credentials as GitHub Secrets. For accessing the Code Scanning alert data, the action uses the GITHUB_TOKEN which is automatically created for you, so you don't need to provide it. Finally, set up the following workflow in your repository, e.g. by adding the file .github/workflows/jira-sync.yml:

name: "Sync GHAS to Jira"

on:
  schedule:
    - cron: '*/10 * * * *'    # trigger synchronization every 10 minutes

jobs:
  test_job:
    runs-on: ubuntu-latest
    steps:
      - name: Sync alerts to Jira issues
        uses: github/ghas-jira-integration@v1
        with:
          jira_url: '<INSERT JIRA SERVER URL>'
          jira_user: '${{ secrets.JIRA_USER }}'
          jira_token: '${{ secrets.JIRA_TOKEN }}'
          jira_project: '<INSERT JIRA PROJECT KEY>'
          sync_direction: 'gh2jira'

This action will push any changes (new alerts, alerts deleted, alert states changed) to Jira, by creating, deleting or changing the state of the corresponding Jira issues. There are two sync directions for the field sync_direction:

  • gh2jira
  • jira2gh

Using gh2jira means the alerts will sync from GitHub to Jira. If you set sync_direction to jira2gh, it will synchronize the other way. Currently, two-way integration is not yet possible via the action. If you need it, use the CLI's serve command (see below).

Using this Action to synchronize secret scanning alerts

Secret scanning alerts can only be queried with the API in private repositories. For public repositories, there will just be an empty results list. You'll need to pass in a PAT via github_token that has admin rights to access secret scanning alerts. Ensure the PAT has the security_events scope:

        with:
          jira_url: '<INSERT JIRA SERVER URL>'
          jira_user: '${{ secrets.JIRA_USER }}'
          jira_token: '${{ secrets.JIRA_TOKEN }}'
          jira_project: '<INSERT JIRA PROJECT KEY>'
          github_token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
          sync_direction: 'gh2jira'

Other optional features for this Action

Labels

You can also create labels for the Jira issues that are created. By using the example yaml below in your workflow, you can use multiple labels, and spaces will be respected. For example, if you add red-team, blue team, the labels would be created 'red-team' and 'blue team'. If this input is updated in the workflow, the existing JIRE issues will also be updated with the same labels.

with:
  jira_labels: 'red-team,blue-team,green-team'
Custom transition states (end, reopen)

You can customize the end and reopen states if your Jira workflows don't use the default close/reopen states.

with:
  issue_end_state: 'Closed'
  issue_reopen_state: 'red-team-followup'

Using the CLI's sync command

Installation

The easiest way to get the CLI running is with pipenv:

pipenv install
pipenv run ./gh2jira --help

Note: gh2jira requires a minimum of python3.5.

In addition to the usual requirements you also need:

  • the URL for the GitHub API, which is
  • a GitHub personal access token, so that the program can fetch alerts from your repository. Follow this guide to obtain a dedicated token. It will have to have at least the security_events scope and muist have admin rights to access secret scanning alerts.
pipenv run ./gh2jira sync \
                 --gh-url "<INSERT GITHUB API URL>" \
                 --gh-token "<INSERT GITHUB PERSONAL ACCESS TOKEN>" \
                 --gh-org "<INSERT REPO ORGANIZATON>" \
                 --gh-repo "<INSERT REPO NAME>" \
                 --jira-url "<INSERT JIRA SERVER INSTANCE URL>" \
                 --jira-user "<INSERT JIRA USER>" \
                 --jira-token "<INSERT JIRA PASSWORD>" \
                 --jira-project "<INSERT JIRA PROJECT KEY>" \
                 --direction gh2jira

Note: Instead of the --gh-token and --jira-token options, you may also set the GH2JIRA_GH_TOKEN and GH2JIRA_JIRA_TOKEN environment variables. The above command could be invoked via a cronjob every X minutes, to make sure issues and alerts are kept in sync.

Other optional features for the CLI

There is an optional parameter you can use for creating labels in your Jira issues. As previously mentioned, spaces within the double quotes will be respected and saved. Just like the GitHub Actions way, the custom transition states are also optional when using the CLI.

--jira-labels "red-team,blue-team,green-team"
--issue-end-state "Closed"
--issue-reopen-state "blue-team-reopen"

Here's an example for a two-way integration:

pipenv run ./gh2jira sync \
                 --gh-url "<INSERT GITHUB API URL>" \
                 --gh-token "<INSERT GITHUB PERSONAL ACCESS TOKEN>" \
                 --gh-org "<INSERT REPO ORGANIZATON>" \
                 --gh-repo "<INSERT REPO NAME>" \
                 --jira-url "<INSERT JIRA SERVER INSTANCE URL>" \
                 --jira-user "<INSERT JIRA USER>" \
                 --jira-token "<INSERT JIRA PASSWORD>" \
                 --jira-project "<INSERT JIRA PROJECT KEY>" \
                 --state-file myrepository-state.json \
                 --direction both

In this case the repository's state is stored in a JSON file (which will be created if it doesn't already exist). Alternatively, the state can also be stored in a dedicated Jira issue via --state-issue - (this will automatically generate and update a storage issue within the same Jira project). If the storage issue should be in a separate Jira project, you can specify --state-issue KEY-OF-THE-STORAGE-ISSUE.

Other CLI sync options

The serve command

Using the CLI's serve command

The following method is the most involved one, but currently the only one which allows two-way integration (i.e. changes to Code Scanning alerts trigger changes to Jira issues and vice versa). It uses a lightweight Flask server to handle incoming Jira and GitHub webhooks. The server is meant to be an example and not production-ready.

In addition to the usual requirements you also need:

  • A machine with an address that can be reached from GitHub.com or your GitHub Enterprise Server instance and your Jira Server instance. This machine will run the server.
  • Webhooks set up, both, on GitHub and Jira. On GitHub only repository or organization owners can do so. On Jira, it requires administrator access.
  • A secret which will be used to verify webhook requests.

First, create a GitHub webhook with the following event triggers:

This can be either a repository or an organization-wide hook. Set the Payload URL to https://<the machine>/github, the Content type to application/json and insert your webhook Secret. Make sure to Enable SSL verification.

Second, register a webhook on Jira. Give your webhook a Name and enter the URL: https://<the machine>/jira?secret_token=<INSERT WEBHOOK SECRET>. In the Events section specify All issues and mark the boxes created, updated and deleted. Click Save.

Finally, start the server:

pipenv run ./gh2jira serve \
                 --gh-url "<INSERT GITHUB API URL>" \
                 --gh-token "<INSERT GITHUB PERSONAL ACCESS TOKEN>" \
                 --jira-url "<INSERT JIRA SERVER INSTANCE URL>" \
                 --jira-user "<INSERT JIRA USER>" \
                 --jira-token "<INSERT JIRA PASSWORD>" \
                 --jira-project "<INSERT JIRA PROJECT KEY>" \
                 --secret "<INSERT WEBHOOK SECRET>" \
                 --port 5000 \
                 --direction both

This will enable two-way integration between GitHub and Jira. Note: Instead of the --secret option, you may also set the GH2JIRA_SECRET environment variable.

Contributing

See CONTRIBUTING.md

License

Apache V2

ghas-jira-integration's People

Contributors

aibaars avatar chaoscypher avatar daverlo avatar dependabot[bot] avatar haby0 avatar hentisemmle avatar johnlugton avatar lindseybocatto avatar mdavidoff0 avatar nickfyson avatar semmledocs-ac avatar sennap avatar tibbes avatar zkoppert avatar zrohrbach-qb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ghas-jira-integration's Issues

unable to fetch alerts from github

Hey there,
Having a lot of issues with fetching the alerts from my repo. (in Github Cloud Enterprise)
the error i keep getting:

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/<org-name>/<repo-name>/secret-scanning/alerts?per_page=100

i tried running curl locally with GITHUB_TOKEN exported and it worked.

here's the action.yml (tried a few variants)

jobs:
  jira-sync:
    name: Jira Sync
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
#    needs: [ analyze ]
    steps:
      - name: Sync alerts to Jira issues
#        env:
#          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        uses: github/ghas-jira-integration@v1
        with:
          jira_url: 'http://<org>.atlassian.net'
          jira_token: ${{ secrets.JIRA_TOKEN }}
          jira_user: 'myuser'
          jira_project: 'myproject'
          jira_labels: 'code-scanning'
          sync_direction: 'gh2jira'

Issue type support

Any thoughts on supporting custom issue types? Referring to a security vulnerability as a bug seems odd to me, and I would like to report these tickets as something other than such.

Feature Request - include additional details in the jira ticket

Feature request to add details from the Github's code scanning page such as file (line/col), recommendations, code snippets (path of exploitation), examples, etc in the jira ticket. The majority of this information looks to be available on the API and presented in markdown.

Support for custom fields

Some feedback that was given to us from an open source developer 😸

Based on the Jira python library being used, the actual customfields themselves are just an additional key/value pair passed to the fields object: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#creating-an-issue-using-custom-fields

Here - https://github.com/github/ghas-jira-integration/blob/main/jiralib.py#L168 this method is where we would pass something like field={“customfield_0000”: “my_value”}

Ideally the custom field would be an arbitrary map the user passes into the github action.

Support for Dependabot alerts

It would be great to include support for the other types of GHAS alerts:

  • Dependabot Security alerts
  • Secret Scanning alerts

Add paths/paths-ignore to CLI and Actions

Delegate alerts based on paths specified to particular Jira backlogs. For instance, some engineering teams split Action workflows for a monorepo to speed up run time, whether those workflows are used for building, linting and/or running security scanners. In this particular case, We want to fetch code scanning alerts from a monorepo and take subsets of them to post to particular Jira backlogs. We want to take the familiar concept of paths and paths-ignore to this integration.

Take this as an example:

test-repo => MAIN_JIRA_BOARD
|
| -/some_path_1/** => JIRA_BOARD_FOR_SOME_PATH_1
|
| -/some_path_2/** => JIRA_BOARD_FOR_SOME_PATH_2
|
| -/some_path_3/** => JIRA_BOARD_FOR_SOME_PATH_3
  • MAIN_JIRA_BOARD will have all alerts except any paths we define for either paths and/or paths-ignore
    • For paths-ignore, exclude specific subdirs meant for JIRA_BOARD_FOR_SOME_PATH_1 and similar
    • For paths, include all paths except paths meant for JIRA_BOARD_FOR_SOME_PATH_1 and similar
  • For JIRA_BOARD_FOR_SOME_PATH_1 and similar boards, in this case we want to use paths to include alerts for specific subdirs.

403 when accessing secret scanning alerts

I was able to run this action/post jira issues just fine when my repo was public (thus no secret scanning alerts), but once I switch to public and run this in the octodemo org, I get this error:

DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /repos/octodemo/sennap-ghas-jira/secret-scanning/alerts?per_page=100 HTTP/1.1" 403 None

fulls logs including SecurityEvents: write permission for my GitHub_token:
logs_14.zip

workflow file in case you don't have access to the octodemo org:

name: "Sync GHAS to Jira"

on: workflow_dispatch
# on:
#   schedule:
#     - cron: '*/10 * * * *'    # trigger synchronization every 10 minutes

jobs:
  test_job:
    runs-on: ubuntu-latest
    steps:
      - name: Sync alerts to Jira issues
        uses: github/ghas-jira-integration@v1
        with:
          jira_url: 'https://githubtraining.atlassian.net/'
          jira_user: '${{ secrets.JIRA_USER }}'
          jira_token: '${{ secrets.JIRA_TOKEN }}'
          jira_project: 'SGJ'
          sync_direction: 'gh2jira'

secret scanning alert that I can see in the UI as org admin:
Screen Shot 2021-12-02 at 7 55 42 PM

cc @cmboling @zbazztian as I saw you added secret scanning support recently 🙏🏻

Workflow enhancements .

Hello Team,

We need jira tickets for those vulnerabilities which are open/Present in code-scanning alerts. I don't need the tickets for those vulnerabilities which are already closed on code-scanning alerts.

When I run the code scanning alerts workflow , the jira tickets are opened for all the vulnerabilities which are even closed.

Can you please help us improving above???

Thanks,
Shweta.

v1 Release Plan

Part one

  • Test, approve and merge #15
  • Rename default branch to main
  • Retain dummy “master” branch to accommodate existing workflows referencing this branch
  • Notify known users using this workflow for breaking changes

Part two

  • Update README.md
  • Rename repository
  • Release v1 tag
  • Smoke test v1 tag
  • Delete dummy master branch
  • Notify users to use v1

Postponed to minor release (starting week of October 18)

  • Refactor/Improve codebase

Refactor/remove useless code

  • Remove the creation of the Jira bug that as a title of [Code Scanning Issue States]
  • Remove references to the states file from the arg parsing and action inputs
  • Remove reference to Docker builds
    • The CLI can be added to an image but we don't necessarily want the Actions implementation to rely on a Docker build if we can instead rely on the tools already in the GH hosted runner.

Missing Package Running Locally

Overview

When trying to run this locally, I am getting an error that there is a missing module.

Debug Info

Versions

  • Python Version: Python 3.10.9
  • ghas-jira-integration Version - latest/main

Install Output

pipenv install

Creating a virtualenv for this project...
Pipfile: ~/projects/ghas-jira-integration/Pipfile
Using /opt/homebrew/bin/python3 (3.10.9) to create virtualenv...
⠴ Creating virtual environment...created virtual environment CPython3.10.9.final.0-64 in 462ms
  creator CPython3Posix(dest=~/.local/share/virtualenvs/ghas-jira-integration-Np39mDW-, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=~/Library/Application Support/virtualenv)
    added seed packages: pip==22.3.1, setuptools==65.6.3, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: ~/.local/share/virtualenvs/ghas-jira-integration-Np39mDW-
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Locking [dev-packages] dependencies...
Updated Pipfile.lock (4f62b95128be3b692fe61e60ea444eb9d699b7871daa710d5a5f3d344b8ae567)!
Installing dependencies from Pipfile.lock (8ae567)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

Error Output

pipenv run ./gh2jira --help

Traceback (most recent call last):
  File "~/projects/ghas-jira-integration/cli.py", line 11, in <module>
    import anticrlf
ModuleNotFoundError: No module named 'anticrlf'

Default GITHUB_TOKEN permissions are not not enough to fetch alerts

The README mentions that "For accessing the Code Scanning alert data, the action uses the GITHUB_TOKEN which is automatically created for you, so you don't need to provide it".

But in reality i had to manually create another PAT and use it like that for the actions to successfully fetch security alerts:

jobs:
jira-sync:
name: Jira Sync
runs-on: ubuntu-latest
steps:
- name: Sync alerts to Jira issues
uses: github/ghas-jira-integration@v1
with:
github_token: ${{ secrets.TEST_GITHUB_TOKEN }}
jira_token: ${{ secrets.JIRA_TOKEN }}
jira_url: 'https://apiseq.atlassian.net'
jira_user: '[email protected]'
jira_project: ${{ github.event.inputs.project }}
jira_labels: 'code-scanning'
sync_direction: 'gh2jira'

when not adding the manually created PAT i get the following error:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/neosec-com/neosec-frontend/secret-scanning/alerts?per_page=100

Add Jira Labels

Add a flag to include labels to send to Jira for all new/existing security vulnerabilities

Custom end state

Not all Jira issues use the "Done" state when an issue/severity alert is closed. Some use a custom state, such as "Closed". Provide a custom flag that will support this.

Re-Open Jira issues

In some workflows, code scanning or secrets scanning alerts get closed with various statuses (false positive, fixed, etc.), and then re-opened. Right now this integration can only move Jira issues from Open to Done. It would be great if the integration could change the status of 'Done' issues back to 'Open' if they are re-opened for any reason.

SSLError on Jira api connect

Tried running action against our jira account and...

WARNING:root:Got recoverable error from GET ***/rest/api/2/serverInfo, will retry [1/3] in 12.502317084188054s. Err: HTTPSConnectionPool(host='imaware.atlassian.net', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))

Not sure what to do here as our GitHub is permitted with jira and am using other jira GitHub Actions to create tickets.

Minor improvements to repository

Although these are minor improvements, they are breaking changes:

  • Renaming the repository
    • GHAS licensing consists of both code scanning and secret scanning, so once we are tracking each type of alert, we can change the name to ghas-jira-integration. There's also an issue 'round here requesting support for other issue tracking platforms (Azure boards or even our native GitHub issues). We may need to settle on a more generic name, such asghas-issue-tracking-integration.
  • Change default branch from master to main
    • Also remove master reference in READme's.
  • Use version branches/tags so we don't use main/master branches to refer to different versions of the integration

ImportError: cannot import name 'url_quote' from 'werkzeug.urls'

Issue Summary 🚨

On October 1st, the ghas-jira-integration pipeline failed due to an ImportError linked to the Werkzeug package.

Error Message 🛑

ImportError: cannot import name 'url_quote' from 'werkzeug.urls'

Diagnostic Details

  • Issue Identified: The problem is related to an upgrade in the Werkzeug package.

    • Reasoning: Import statement in code is incompatible with the latest version of Werkzeug.
  • Version Info:

    • Working Version: Werkzeug-2.3.7
    • Problematic Version: Werkzeug-3.0.0
    • How Discovered: Compared logs from a successful run to a failed run to pinpoint the version discrepancy.

Jira access token

Why on earth you've the argument named token while you expecting password string instead?

--jira-token "<INSERT JIRA PASSWORD>

How can I use JIRA token which is supposed to access its APIs?
Request should be sent by adding the header Authorization: Bearer MYJIRATOKEN

Jira ticket Priority

Since code scanning alerts that are associated with a database vulnerability contain the severity level, I believe that these should be applied to the priority of the ticket. For things that are not associated with a database vulnerability and are from a code scanning alert, they should remain a medium priority, and for Secret scanning alerts these should be labeled with the Highest priority. It will allow for the tickets created through the action to be used with Jira automation and send out notifications based on priority level and length of time in limbo. Let me know what you think. I can take a shot and creating a PR for it.

Weird behavior when trying to sync alerts to jira

When trying to sync alerts to jira im running into this weird behavior by the action, for some reason it runs a jql query looking for issues with the project key name AND description which is an auto generated hash. this doesn't return an error though, just this message:

https://<myserver>.atlassian.net:443 "GET /rest/api/2/search?jql=project%3D%22PROT%22+and+description+~+%229ace02b988f4e7c7be80674a50ba912cdbaa3ca9a3df87440d795ce9fa82156e%22&startAt=0&validateQuery=True HTTP/1.1" 200 None
Search project="PROT" and description ~ "9ace02b988f4e7c7be80674a50ba912cdbaa3ca9a3df87440d795ce9fa82156e" returned 0 results.

Support for Azure Boards

I was recently approached by a colleague who suggested we might want to add support for Azure Boards, given that it has currently more than 1.2M monthly users. It is an interesting proposition and could serve as a proof that the integration can be more generic and support multiple platforms. One caveat is that we would have to, once again, rename the repository :-)

There are currently still a few outstanding items we should address for the JIRA integration, but if we can gather customer / prospect interest, then this might be an interesting project.

Feature Request | Jira Priority

I would like the severity of the code scanning alert (Error, Warning, Info) to map to a priority in the Jira bug that is opened.

Error = High
Warning = Medium
Info = Low

This would make it easier for product owners, scrum masters, etc to be able to prioritize the bugs they see in their backlog at a glance. This would also prevent having to look at the code scanning alerts, and match them up with the bugs. Or have to click the individual links inside the bugs to be brought to the specific alert, to then look at the severity that it has.

Workflows failing with "The issue type selected is invalid"

I am filing this on behalf of my customer @Shweta4398 who has successfully set up a workflow with this Action. Every time they run the workflow, it fails with the same error text: The issue type selected is invalid.

Here is the Action they provided:

image

If there is no issue type, the error occurs, or if they add an issue type, same error. jira_issue_type does not appear to be a criteria you can populate with this Action.

Looking at a portion of the logs, it appears that somewhere along the way, the rest/api path is picked up and the Action seems to identify this as an issue type:

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://appdirect.jira.com/rest/api/2/issue
	text: The issue type selected is invalid.
	
	response headers = {'Date': 'Mon, 10 Apr 2023 06:09:59 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '*', 'X-Arequestid': 'e3f409a204a7400ac8bb8f63346850f5', 'X-Aaccountid': '628dac6ff2261e00682a1d81', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': '8a5f7da3d11568d8', 'Report-To': '{"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Transfer-Encoding': 'chunked'}
	response text = {"errorMessages":[],"errors":{"issuetype":"The issue type selected is invalid."}}
Error: Process completed with exit code 1.

Logs:

1_Set up job.txt
2_Sync CodeQL alerts to Jira issues.txt
4_Complete job.txt

Weird error when fetching from JIRA

Hello we are trying to get this setup for our repo and seeing this error

DEBUG:urllib3.connectionpool:[https://tranecortex.atlassian.net:443](https://tranecortex.atlassian.net/) "GET /rest/api/2/search?jql=project%3D%22DWA%22+and+description+~+%22290af322f9cb4b0a321b692b164f150b157f047a83168febf076db55717ab1de%22&startAt=0&validateQuery=True HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/home/runner/work/_actions/github/ghas-jira-integration/v1/cli.py", line 321, in <module>
    main()
  File "/home/runner/work/_actions/github/ghas-jira-integration/v1/cli.py", line 318, in main
    args.func(args)
  File "/home/runner/work/_actions/github/ghas-jira-integration/v1/cli.py", line 104, in sync
    s.sync_repo(repo_id, states=state)
  File "/home/runner/work/_actions/github/ghas-jira-integration/v1/sync.py", line 115, in sync_repo
    for i in self.jira.fetch_issues(repo.get_key()):
  File "/home/runner/work/_actions/github/ghas-jira-integration/v1/jiralib.py", line 221, in fetch_issues
    for raw in self.j.search_issues(issue_search, maxResults=0)
  File "/home/runner/.local/lib/python3.8/site-packages/jira/client.py", line 2523, in search_issues
    issues = self._fetch_pages(
  File "/home/runner/.local/lib/python3.8/site-packages/jira/client.py", line 636, in _fetch_pages
    resource = self._get_json(request_path, params=page_params, base=base)
  File "/home/runner/.local/lib/python3.8/site-packages/jira/client.py", line 3139, in _get_json
    r = self._session.get(url, params=params)
  File "/home/runner/.local/lib/python3.8/site-packages/jira/resilientsession.py", line 172, in get
    return self.__verb("GET", url, **kwargs)
  File "/home/runner/.local/lib/python3.8/site-packages/jira/resilientsession.py", line 168, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/home/runner/.local/lib/python3.8/site-packages/jira/resilientsession.py", line 53, in raise_on_error
    raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://tranecortex.atlassian.net/rest/api/2/search?jql=project%3D%22DWA%22+and+description+~+%22290af322f9cb4b0a321b692b164f150b157f047a[83](https://github.com/nexiahome/nexia_dealer/runs/7568634532?check_suite_focus=true#step:2:85)168febf076db55717ab1de%22&startAt=0&validateQuery=True
	text: The value 'DWA' does not exist for the field 'project'.
	
	response headers = {'Date': 'Thu, 28 Jul 2022 21:02:49 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'globaledge-envoy', 'Timing-Allow-Origin': '*', 'X-Arequestid': 'cdcb4620-33a4-487d-9b33-0a397e3d4cf3', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Envoy-Upstream-Service-Time': '66', 'Expect-Ct': 'report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400', 'Strict-Transport-Security': 'max-age=63072000; preload', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': '0ba9a73c174f24[85](https://github.com/nexiahome/nexia_dealer/runs/7568634532?check_suite_focus=true#step:2:87)', 'Report-To': '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net/"}], "include_subdomains": true}', 'Nel': '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": 0.001}', 'Transfer-Encoding': 'chunked'}
	response text = {"errorMessages":["The value 'DWA' does not exist for the field 'project'.","Field 'description' does not exist or this field cannot be viewed by anonymous users."],"warningMessages":[]}
Error: Process completed with exit code 1.

Our configuration looks as follows:


name: "Sync GHAS to Jira"

on:
  workflow_dispatch:
  # schedule:
    # - cron: '*/9 * * * *'    # trigger synchronization every 9 minutes

jobs:
  test_job:
    runs-on: ubuntu-latest
    steps:
      - name: Sync alerts to Jira issues
        uses: github/ghas-jira-integration@v1
        with:
          jira_url: 'https://tranecortex.atlassian.net'
          jira_user: '${{ secrets.JIRA_USER }}'
          jira_token: '${{ secrets.JIRA_TOKEN }}'
          jira_project: 'DWA'
          github_token: '${{ secrets.GH_TO_JIRA_SEC_TOKEN }}'
          sync_direction: 'gh2jira'

Add tests

We currently have neither any unit nor integration tests. The bigger and more complex the project grows, the more problematic this will become, so we should address this soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.