fix(jira): wrap select-field values in {value: ...} for Jira REST API
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

Jira Cloud's REST API rejects a bare string for select-type custom
fields with 'Specify a valid id or name for <field>' — confirmed live
against the real Jira instance. This silently broke Severity, Data
Sensitivity, Attack success, Attack detected, and Attack contained on
every ticket create/update, masked until now by the non-fatal
exception handling around each call.
This commit is contained in:
kitos
2026-07-09 17:08:53 +02:00
parent d726e3adfe
commit 119db6f91d
2 changed files with 19 additions and 9 deletions
+4 -4
View File
@@ -200,7 +200,7 @@ def test_push_rt_submitted_includes_attack_success(mock_get_client, mock_configu
fields = mock_jira.update_issue_field.call_args[1]["fields"]
assert fields[jira_service.JIRA_FIELD_RT_END_DATE]
assert fields[jira_service.JIRA_FIELD_ATTACK_SUCCESS] == "Yes"
assert fields[jira_service.JIRA_FIELD_ATTACK_SUCCESS] == {"value": "Yes"}
@patch("app.services.jira_service.has_admin_jira_configured", return_value=True)
@@ -224,7 +224,7 @@ def test_push_bt_submitted_includes_detection_and_hours(mock_get_client, mock_co
jira_service.push_bt_submitted(db, test)
fields = mock_jira.update_issue_field.call_args[1]["fields"]
assert fields[jira_service.JIRA_FIELD_ATTACK_DETECTED] == "Yes"
assert fields[jira_service.JIRA_FIELD_ATTACK_DETECTED] == {"value": "Yes"}
assert fields[jira_service.JIRA_FIELD_TIME_TO_DETECT] == 2.0
assert fields[jira_service.JIRA_FIELD_TIME_TO_CONTAIN] == 1.5
@@ -242,7 +242,7 @@ def test_push_bt_submitted_includes_attack_contained(mock_get_client, mock_confi
jira_service.push_bt_submitted(db, test)
fields = mock_jira.update_issue_field.call_args[1]["fields"]
assert fields[jira_service.JIRA_FIELD_ATTACK_CONTAINED] == "Partial"
assert fields[jira_service.JIRA_FIELD_ATTACK_CONTAINED] == {"value": "Partial"}
def test_update_test_fields_noop_when_not_configured(db):
@@ -380,7 +380,7 @@ def test_auto_create_test_issue_maps_data_classification_to_real_jira_field(
jira_service.auto_create_test_issue(db, test, actor, technique=technique)
fields = mock_jira.issue_create.call_args.kwargs["fields"]
assert fields["customfield_11814"] == expected_jira_value
assert fields["customfield_11814"] == {"value": expected_jira_value}
def _make_user(**overrides):