tenable / integration-jira-cloud

69 stars 51 forks source link

Error The priority selected is invalid #230

Closed MelvinVMathew closed 7 months ago

MelvinVMathew commented 1 year ago

2023-08-04 03:04:12,101 restfly.errors.BadRequestError ERROR [400: POST] https://abc.atlassian.net/rest/api/3/issue?update_history=False body=b'{"errorMessages":[],"errors":{"priority":"The priority selected is invalid."}}'

It seems that in our Jira environment there is no priority with ID:1. The ones we have are,

Critical - 2 Major - 3 Minor - 4 Needs Defined - 5 Blocker – 6

How can we modify the script to use Priority with ID 2 rather than ID 1?

rishuzz commented 1 year ago

HI @MelvinVMathew you can define this mapping in config

 tenable: 
  severity_prioritization:
      critical: 1
      high: 2
      medium: 3
      low: 4

complete list of properties that can be modified has be documented here

MelvinVMathew commented 1 year ago

I tried adding them,

tenable: severity_prioritization: critical: 2 high: 3 medium: 4 low: 5 but now it throws more error.

Traceback (most recent call last): File "/root/tenable_Jira/bin/tenable-jira", line 11, in load_entry_point('tenable-jira-cloud==1.2.3', 'console_scripts', 'tenable-jira')() File "/root/tenable_Jira/lib64/python3.6/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/root/tenable_Jira/lib64/python3.6/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/root/tenable_Jira/lib64/python3.6/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/root/tenable_Jira/lib64/python3.6/site-packages/click/core.py", line 754, in invoke return __callback(args, **kwargs) File "/root/tenable_Jira/lib64/python3.6/site-packages/tenable_jira/cli.py", line 67, in cli config_from_file = yaml.safe_load(configfile) File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/init.py", line 125, in safe_load return load(stream, SafeLoader) File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/init.py", line 81, in load return loader.get_single_data() File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() File "/root/tenable_Jira/lib64/python3.6/site-packages/yaml/parser.py", line 439, in parse_block_mapping_key "expected , but found %r" % token.id, token.start_mark) yaml.parser.ParserError: while parsing a block mapping in "config.yaml", line 1, column 1 expected , but found '' in "config.yaml", line 27, column 2

rishuzz commented 1 year ago

looks like script not able to parse config.yaml now can you please check config around these lines

parse_block_mapping_key
"expected , but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
in **"config.yaml", line 1, column 1**
expected , but found ''
**in "config.yaml", line 27, column 2**

and validate if recents changes are added under right node

MelvinVMathew commented 1 year ago

This is the error we are getting now.

-- 2023-09-14 12:28:07,216 urllib3.connectionpool DEBUG https://x:443 "GET /rest/query/39636?fields=filters HTTP/1.1" 200 294 2023-09-14 12:28:07,217 tenable.sc.TenableSC DEBUG Request: {"method": "POST", "url": "https://X:443/rest/analysis", "params": {}, "body": {"type": "vuln", "sourceType": "cumulative", "query": {"tool": "vulndetails", "type": "vuln", "filters": [{"filterName": "vprScore", "operator": "=", "value": "9-10"}, {"filterName": "severity", "operator": "=", "value": [{"id": "4", "name": "Critical", "description": "Critical Severity"}]}, {"filterName": "lastSeen", "operator": "=", "value": "1683983242-1694708886"}], "startOffset": 0, "endOffset": 1000}}} 2023-09-14 12:28:09,747 urllib3.connectionpool DEBUG https://X:443 "POST /rest/analysis HTTP/1.1" 200 None 2023-09-14 12:28:09,931 tenable_jira.transform.Tio2Jira DEBUG Setting Vuln Sev to critical 2023-09-14 12:28:09,932 tenable_jira.transform.Tio2Jira DEBUG Setting Finding Sev to critical 2023-09-14 12:28:09,954 tenable_jira.jira.Jira DEBUG Request: {"method": "POST", "url": "https://kx.atlassian.net/rest/api/3/search", "params": {}, "body": {"jql": "project = \"VULN\" and issuetype = \"Task\" and status not in (Closed, Done, Resolved) and \"Tenable Plugin ID\" ~ \"154993\""}} 2023-09-14 12:28:10,435 urllib3.connectionpool DEBUG https://x.atlassian.net:443 "POST /rest/api/3/search HTTP/1.1" 200 None 2023-09-14 12:28:10,436 tenable_jira.jira.Jira DEBUG Request: {"method": "POST", "url": "https://x.atlassian.net/rest/api/3/issue", "params": {"update_history": false}, "body": {"fields": {"project": {"key": "VULN"}, "issuetype": {"id": 6}, "customfield_17745": , "customfield_17746": "7.7", "customfield_17747": "6.7", "customfield_17748": "9.0", "customfield_17749": "8.6", "customfield_17750": "1636477200", "customfield_17751": "154993", "}]}]}}}} 2023-09-14 12:28:10,997 urllib3.connectionpool DEBUG https://x.atlassian.net:443 "POST /rest/api/3/issue?update_history=False HTTP/1.1" 400 None 2023-09-14 12:28:11,000 restfly.errors.BadRequestError ERROR [400: POST] https://x.atlassian.net/rest/api/3/issue?update_history=False body=b'{"errorMessages":[],"errors":{"priority":"The priority selected is invalid."}}'

Some part has been redacted

fabiolanza commented 1 year ago

I am having the same error on invalid priority. I updated the values in the config file, but I am still getting the error. How can I know what are the priority IDs that we have in our instance of Jira?

SteveMcGrath commented 7 months ago

https://support.atlassian.com/jira-cloud-administration/docs/configure-priorities-for-projects/