Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e2a60e2
Send an empty outputs list when Porter outputs cannot be read (#5297)
JayDoubleu Oct 23, 2026
641336d
Give each resource processor worker its own Azure CLI folder (#5297)
JayDoubleu Oct 24, 2026
78bdfa3
Return the trace ID of each API request in a Request-Id header (#5202)
JayDoubleu Oct 24, 2026
5e60909
Run each resource processor step once after a session lock loss (#5236)
JayDoubleu Oct 24, 2026
5aca6d4
Send the first step message again after an API stop (#5236)
JayDoubleu Oct 27, 2026
9ecfcb7
Refuse an upgrade after an uninstall and fail a step without storage …
JayDoubleu Oct 29, 2026
299a63c
Let the first run replace a failure that the API wrote (#5236)
JayDoubleu Oct 29, 2026
f5f94e5
Store a placeholder for sensitive values when the API saves an update…
JayDoubleu Oct 30, 2026
6ec6580
Add an E2E case for a sensitive property after an update (#5298)
JayDoubleu Oct 30, 2026
961eae1
Give the first step of a pipeline the real sensitive values (#5298)
JayDoubleu Oct 30, 2026
02096e1
Describe a schema error without the submitted values (#5298)
JayDoubleu Oct 30, 2026
b0e0e81
Check the session after the lease wait and let an upgrade repair a lo…
JayDoubleu Oct 30, 2026
867049e
Fail an unsent first step without a change to other resources (#5236)
JayDoubleu Oct 30, 2026
e8c1142
Count a later request on the first child of a pending cascade (#5236)
JayDoubleu Oct 31, 2026
68d7210
Ask for the sensitive values again after a failed request (#5298)
JayDoubleu Oct 31, 2026
55fcbc3
Add tests that fail if the earlier fixes go back (#5236, #5298)
JayDoubleu Oct 31, 2026
54f6914
Tell operators to replace a secret from a failed create (#5298)
JayDoubleu Oct 31, 2026
60ea0c1
Fail a step when the Porter output list is not valid JSON (#5297)
JayDoubleu Nov 1, 2026
e3d8418
Fail an upgrade when the Porter installation lookup fails (#5236)
JayDoubleu Nov 1, 2026
93d3ae5
Keep a newer execution record after the lease expired (#5236)
JayDoubleu Nov 1, 2026
8679abe
Keep the results of earlier steps in the execution record (#5236)
JayDoubleu Nov 1, 2026
c8ca534
Describe when a copy of a step runs Porter again (#5236)
JayDoubleu Nov 1, 2026
e356eae
Write a result over a running record of the same step (#5236)
JayDoubleu Nov 1, 2026
fb3fcdf
Clear the execution ID of a step for a status without one (#5236)
JayDoubleu Nov 1, 2026
d30f21e
Fail an unsent step only if the operation did not change after the cl…
JayDoubleu Nov 1, 2026
a73d2d6
Keep a property sensitive if one of its declarations is sensitive (#5…
JayDoubleu Nov 1, 2026
275b33a
Mask sensitive values in array items (#5298)
JayDoubleu Nov 1, 2026
d2b92c4
Mask an update with the template of the target version (#5298)
JayDoubleu Nov 1, 2026
adfdc97
Describe the known limits of the execution lease and the resend (#5236)
JayDoubleu Nov 1, 2026
ffb3016
Describe two runs after a worker stops during a Porter action (#5236)
JayDoubleu Nov 1, 2026
9590aad
Name the status that a workspace keeps after a failed resend (#5236)
JayDoubleu Nov 1, 2026
59b0758
Describe the new failures and the masked bundle values in the CHANGELOG
JayDoubleu Nov 1, 2026
65fe1f1
Add the issue links to the new CHANGELOG entries (#5297, #5298)
JayDoubleu Nov 2, 2026
8c471e8
Use the next core version after the VM size change
JayDoubleu Nov 2, 2026
bf72548
Add an appended array item only once if the API prepares a step again…
JayDoubleu Nov 2, 2026
204e74d
Give a null sensitive value to the first step of a pipeline
JayDoubleu Nov 2, 2026
32bbf9f
Patch a document in the migration only if it did not change after the…
JayDoubleu Nov 2, 2026
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
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048))
* `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost.
Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* A bundle gets `REDACTED` for a sensitive property in a later action that does not give a new value for it. This now also applies after an update that set the property.
It also applies to a sensitive property in an array item. It also applies to a property with more than one declaration in the template, if one declaration has `sensitive`.
If a custom bundle needs such a value in a later action, make the bundle keep it, for example in Key Vault. The base workspace does this for its client secret. (`api` 0.29.0) ([#5298](https://github.com/microsoft/AzureTRE/issues/5298))

ENHANCEMENTS:
* Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150))
* Add a private MySQL lifecycle check. A Nexus-backed Linux VM writes a row through private DNS, the SKU changes from Burstable to General Purpose, and the VM reads the row again. ([#5148](https://github.com/microsoft/AzureTRE/issues/5148))
* Run the `stop`, `start` and `reset_password` actions in the Guacamole Linux VM check, and make sure of the VM power state and the new Key Vault secret version through Azure. ([#5145](https://github.com/microsoft/AzureTRE/issues/5145))
* Add a private Gitea lifecycle check. A workspace VM uses the Gitea API through private DNS, gets HTTP 401 without credentials and with a wrong password, and commits a file to a private repository.
The VM reads the file again after an update, a change of the OIDC client ID, a stop and a start of the app. The check also makes sure that the OIDC change stops Gitea one time and that the console log of the web app shows no secret. ([#5141](https://github.com/microsoft/AzureTRE/issues/5141))
* Add a `Request-Id` header with the trace ID to each API response, also to an HTTP 500. The E2E operation poll already logs this header, so a failed poll can be found in App Insights. (`api` 0.29.0) ([#5202](https://github.com/microsoft/AzureTRE/issues/5202))
* Select individual bundle tests and record lifecycle evidence for base workspaces, private Azure SQL, Airlock, Linux VMs and certificate reuse across reinstallation. ([#5255](https://github.com/microsoft/AzureTRE/pull/5255))
* Enable `user_management_enabled`, `auto_workspace_group_creation`, and `auto_grant_workspace_consent` by default in `config.sample.yaml` for a better out-of-the-box experience ([#5050](https://github.com/microsoft/AzureTRE/issues/5050))
* Add shared repository instructions and TRE-prefixed component skills for agent-assisted development, security review, validation and troubleshooting. ([#5111](https://github.com/microsoft/AzureTRE/issues/5111))
Expand Down Expand Up @@ -56,6 +60,34 @@ BUG FIXES:
The workspace start script gives the OIDC source the current client secret at each start, and it stops Gitea one time when the OIDC settings change. The web app reads the client secret through a Key Vault reference. (`tre-workspace-service-gitea` 2.0.0, `tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Send an empty outputs list when the resource processor cannot read the Porter outputs. The API rejected the empty dict, so a pipeline step that failed to read its outputs, for example after a transient container registry login failure, stayed in progress until the caller stopped waiting.
The resource processor also sends the failed status for the step if the output text of Porter is not a JSON list. (`resource_processor` 0.13.16) ([#5297](https://github.com/microsoft/AzureTRE/issues/5297))
* Give each resource processor worker its own Azure CLI folder. Each worker signs in before each Porter action. When two workers did this at the same time, one worker read the shared profile file while the other wrote it, and the next `az acr login` failed with `Please run 'az login'`. The action then failed after 3 seconds. (`resource_processor` 0.13.16)
([#5297](https://github.com/microsoft/AzureTRE/issues/5297))
* Prevent a second run of a resource processor step when Service Bus gives its message to a second worker. The resource processor renews the session lock with retries, and a blob lease lets one worker at a time run Porter for a resource. The API ignores a status from another run of a finished step.
An upgrade no longer installs a resource that Porter uninstalled. An upgrade also fails with `updating_failed` if the resource processor cannot read the Porter installation in 30 seconds.
A worker that lost its session while it waited for the lease does not run Porter.
Two runs can still overlap if a worker loses the lease and its session during one Porter run. They can also overlap if a worker stops and its Porter action continues. The resource processor document gives the [known limits](docs/tre-developers/resource-processor.md#known-limits).
(`core` 0.19.1, `resource_processor` 0.13.16, `api` 0.29.0) ([#5236](https://github.com/microsoft/AzureTRE/issues/5236))
* Send the first step message of a request again if the API stops after it writes the operation and before it sends the message. The API keeps a `pendingDispatch` entry in the operation until the send, and the deployment status updater handles older entries every 5 minutes.
If that message has sensitive values from an install or an update, the request fails with a clear message, because the API does not store these values.
The resend does not change a resource that a later request changed, and it does not change the resource of a first step on another resource.
The `append` array action of a pipeline step does not add an item that the array already has. So if the API prepares a step again, for example at a resend after the patch of the resource, the array does not get the same item two times.
(`api` 0.29.0) ([#5236](https://github.com/microsoft/AzureTRE/issues/5236))
* Store a placeholder for each sensitive property when the API saves an update of a resource, as it already does at the install. The new value goes to the resource processor only in the request message.
Before this change, an update stored the new value of a sensitive property in Cosmos DB and in the resource history. An example is the `client_secret` of a workspace.
API responses with the resource properties then included this value.
A database migration replaces the values that earlier updates stored. If an update set the client secret of a workspace before this version, you can create a new secret for the workspace application.
Then update the workspace with the new secret, and delete the old secret.
If that update fails, send it again with the new secret. The update form shows `REDACTED`, and an update with `REDACTED` keeps the earlier secret.
Delete the old secret only after an update with the new secret succeeds.
The placeholder also covers a sensitive property in an array item, at the install too. In a later action that does not give a new value for such a property, the bundle gets `REDACTED`, as for other sensitive properties.
If a template declares a property in more than one branch, one declaration with `sensitive` is enough. At an update that changes the template version, the new version decides which properties are sensitive.
For a template whose action has more steps than `main`, for example the unrestricted workspace, the first message now also gets the real sensitive values at an install. (`api` 0.29.0) ([#5298](https://github.com/microsoft/AzureTRE/issues/5298))
* Describe a schema error of a resource request without the submitted values. The API logged the full jsonschema error text and returned it in the HTTP 400 response of a create request.
The create route of an Airlock review VM did the same in its HTTP 500 response.
That text contains the submitted properties, for example a client secret. The response now names the property and the template rule.
The API also wrote this text to its console log, which the core Log Analytics workspace keeps for 30 days by default. If a create request with a client secret got a schema error before this version, create a new secret for the workspace application. (`api` 0.29.0) ([#5298](https://github.com/microsoft/AzureTRE/issues/5298))
* Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274))
* Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270))
* Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266))
Expand Down
2 changes: 1 addition & 1 deletion api_app/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.28.9"
__version__ = "0.29.0"
36 changes: 36 additions & 0 deletions api_app/api/request_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from opentelemetry import trace
from starlette.types import ASGIApp, Message, Receive, Scope, Send

HEADER = b"request-id"


def current_request_id() -> str:
"""Return the trace of this request in the Application Insights Request-Id format.

App Insights stores the trace ID as OperationId, so a client can find the server logs of a failed request.
"""
context = trace.get_current_span().get_span_context()
if not context.is_valid:
return ""
return f"|{context.trace_id:032x}.{context.span_id:016x}."


class RequestIdMiddleware:
"""Add the Request-Id header to each HTTP response, also to a response for an unhandled exception."""

def __init__(self, app: ASGIApp) -> None:
self.app = app

async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http":
await self.app(scope, receive, send)
return

async def send_with_request_id(message: Message) -> None:
if message["type"] == "http.response.start":
request_id = current_request_id()
if request_id:
message["headers"] = [*message.get("headers", []), (HEADER, request_id.encode())]
await send(message)

await self.app(scope, receive, send_with_request_id)
12 changes: 10 additions & 2 deletions api_app/api/routes/airlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
require_airlock_manager,
)

from .resource_helpers import construct_location_header
from .resource_helpers import construct_location_header, validation_error_detail

from services.airlock import (
create_review_vm,
Expand Down Expand Up @@ -276,7 +276,15 @@ async def create_review_user_resource(
detail=f"Failed to retrieve Airlock Review configuration for workspace {workspace.id}.\
Please ask your TRE administrator to check the configuration. Details: {str(e)}",
)
except (ValidationError, ValueError) as e:
except ValidationError as e:
# Do not log or return str(e). It contains the input of the review VM, with the SAS URL of the request.
logger.warning(f"The review VM input does not match the template: {validation_error_detail(e)}")
raise HTTPException(
status_code=status_code.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Invalid configuration for creating user resource. Please contact your TRE administrator. "
f"Details: {validation_error_detail(e)}",
)
except ValueError as e:
logger.exception("Failed create user resource model instance due to validation error")
raise HTTPException(
status_code=status_code.HTTP_500_INTERNAL_SERVER_ERROR,
Expand Down
18 changes: 18 additions & 0 deletions api_app/api/routes/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from auth.rbac import require_tre_admin
from resources import strings
from models.schemas.migrations import Migration, MigrationOutList
from db.repositories.resource_templates import ResourceTemplateRepository
from db.repositories.resources import ResourceRepository
from db.repositories.resources_history import ResourceHistoryRepository
from db.repositories.workspaces import WorkspaceRepository
from services.logging import logger

Expand All @@ -28,6 +31,21 @@ async def migrate_database():
Migration(issueNumber="5048", status=f"Set airlock_version=1 on {len(migrated_ids)} legacy workspace(s)")
)

# Updates stored real sensitive values before the API masked them, as it does at the install.
resource_repo = await ResourceRepository.create()
changed_resources, changed_history_items = await resource_repo.mask_stored_sensitive_values(
await ResourceTemplateRepository.create(), await ResourceHistoryRepository.create()
)
logger.info(
f"Masked sensitive values in {changed_resources} resource(s) and {changed_history_items} history item(s)."
)
migrations.append(
Migration(
issueNumber="5298",
status=f"Masked sensitive values in {changed_resources} resource(s) and {changed_history_items} history item(s)",
)
)

return MigrationOutList(migrations=migrations)
except Exception as e:
logger.exception("Failed to migrate database")
Expand Down
71 changes: 27 additions & 44 deletions api_app/api/routes/resource_helpers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from datetime import datetime, UTC
import semantic_version
from copy import deepcopy
from typing import Dict, Any, List, Optional
from typing import List, Optional

from fastapi import HTTPException, status
from jsonschema.exceptions import ValidationError
from db.repositories.user_resources import UserResourceRepository
from models.domain.user_resource import UserResource
from models.domain.workspace_service import WorkspaceService
from models.schemas.resource import ResourcePatch
from db.repositories.resources import ResourceRepository
from db.repositories.resources import ResourceRepository, mask_sensitive_properties
from db.repositories.resources_history import ResourceHistoryRepository
from models.domain.resource_template import ResourceTemplate
from models.domain.authentication import User
Expand Down Expand Up @@ -126,48 +127,30 @@ async def save_and_deploy_resource(
)


def mask_sensitive_properties(properties: Dict[str, Any], template: ResourceTemplate) -> dict:
updated_resource_parameters = deepcopy(properties)

flattened_template_props = {}

# recusrse the template and flatten all properties into a list
def flatten_template_props(template_fragment: dict):
if template_fragment is None:
return

for prop_name, prop in template_fragment.items():
if prop_name == "pipeline":
continue

if prop_name == "properties" and template_fragment["properties"] is not None:
for inner_prop_name, inner_prop in template_fragment["properties"].items():
flattened_template_props[inner_prop_name] = inner_prop

if isinstance(prop, list) and len(prop) > 0:
for p in prop:
if isinstance(p, dict):
flatten_template_props(p)

if isinstance(prop, dict) and prop_name != "if":
flatten_template_props(prop)

flatten_template_props(template.model_dump())

def recurse_input_props(prop_dict: dict):
for prop_name, prop in prop_dict.items():
if (
prop_name in flattened_template_props
and "sensitive" in flattened_template_props[prop_name]
and flattened_template_props[prop_name]["sensitive"] is True
):
prop_dict[prop_name] = strings.REDACTED_SENSITIVE_VALUE
if isinstance(prop, dict):
recurse_input_props(prop)

recurse_input_props(updated_resource_parameters)

return updated_resource_parameters
# The messages of these validators name properties only, not the submitted values.
NAME_ONLY_VALIDATORS = {"required", "additionalProperties", "unevaluatedProperties", "dependentRequired"}
# The rule of these validators is a list of schemas, which is too long for a message.
SCHEMA_LIST_VALIDATORS = {"allOf", "anyOf", "oneOf", "not", "if", "then", "else"}


def validation_error_detail(error: ValidationError) -> str:
"""Describe a schema error without the submitted values, because a value can be a secret.

str(error) can contain the whole input, and error.message can contain the value that failed.
"""
location = "/".join(str(part) for part in error.absolute_path) or "properties"
if error.validator is None:
# A false subschema allows no value. Its message repeats the submitted value.
return f"The template does not allow a value at '{location}'"
if not isinstance(error.validator, str) or error.validator in NAME_ONLY_VALIDATORS:
# An error that the API raises itself has no validator and a message without input values.
return error.message
if error.validator in SCHEMA_LIST_VALIDATORS:
return f"'{location}' does not match the '{error.validator}' rule of the template"
rule = repr(error.validator_value)
if len(rule) > 200:
rule = rule[:200] + "..."
return f"'{location}' does not match the '{error.validator}' rule of the template: {rule}"


def construct_location_header(operation: Operation) -> str:
Expand Down
Loading