Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ENHANCEMENTS:
* Pin all GitHub Actions workflow steps to full commit SHAs to prevent supply chain attacks plus update to latest releases ([#4886](https://github.com/microsoft/AzureTRE/pull/4886))
* Add Windows Server 2025 image support to Guacamole. ([#4890](https://github.com/microsoft/AzureTRE/issues/4890))

BUG FIXES:
* Fix to enhance service bus handling of invalid JSON in receive_message function
Comment thread
JC-wk marked this conversation as resolved.
Outdated

## (0.28.0) (March 2, 2026)
**BREAKING CHANGES**
* Sonatype Nexus shared service now requires explicit EULA acceptance (`accept_nexus_eula: true`) when deploying. This ensures compliance with Sonatype Nexus Community Edition licensing. ([#4842](https://github.com/microsoft/AzureTRE/issues/4842))
Expand Down
2 changes: 1 addition & 1 deletion resource_processor/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.3"
__version__ = "0.13.4"
26 changes: 26 additions & 0 deletions resource_processor/tests_rp/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,32 @@ async def test_receive_message(mock_invoke_porter_action, mock_service_bus_clien
mock_service_bus_client_instance.get_queue_receiver.assert_called_once_with(queue_name="test_queue", max_wait_time=1, session_id=ServiceBusSessionFilter.NEXT_AVAILABLE)


@pytest.mark.asyncio
async def test_receive_message_bad_json(mock_service_bus_client, mock_auto_lock_renewer):
mock_service_bus_client_instance = mock_service_bus_client.return_value

# Set up the lock renewer mock correctly
mock_renewer = AsyncMock()
mock_renewer.register = Mock()
mock_auto_lock_renewer.return_value.__aenter__.return_value = mock_renewer

mock_receiver = AsyncMock()
mock_receiver.__aenter__.return_value = mock_receiver
mock_receiver.__aexit__.return_value = None
mock_receiver.session.session_id = "test_session_id"
mock_receiver.__aiter__.return_value = ["invalid_json_string"]

mock_service_bus_client_instance.get_queue_receiver.return_value.__aenter__.return_value = mock_receiver

run_once = Mock(side_effect=[True, False])

config = {"resource_request_queue": "test_queue"}

await receive_message(mock_service_bus_client_instance, config, keep_running=run_once)
mock_receiver.dead_letter_message.assert_called_once_with("invalid_json_string", reason="InvalidJSON")
mock_receiver.complete_message.assert_not_called()
Comment thread
JC-wk marked this conversation as resolved.
Outdated


@pytest.mark.asyncio
async def test_receive_message_unknown_exception(mock_auto_lock_renewer, mock_service_bus_client, mock_logger):
"""Test receiving a message with an unknown exception."""
Expand Down
2 changes: 2 additions & 0 deletions resource_processor/vmss_porter/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ async def receive_message(service_bus_client, config: dict, keep_running=lambda:
message = json.loads(str(msg))
except (json.JSONDecodeError) as e:
logger.error(f"Received bad service bus resource request message: {e}")
await receiver.dead_letter_message(msg, reason="InvalidJSON")
Comment thread
JC-wk marked this conversation as resolved.
Outdated
continue

with tracer.start_as_current_span("receive_message") as current_span:
current_span.set_attribute("resource_id", message["id"])
Expand Down
Loading