Skip to content

[PERF]: execute XPIA injection handle activation concurrently - #165

Merged
Nina Chikanov (nina-msft) merged 6 commits into
microsoft:mainfrom
apocalypse9949:XPIA
Aug 21, 2026
Merged

[PERF]: execute XPIA injection handle activation concurrently#165
Nina Chikanov (nina-msft) merged 6 commits into
microsoft:mainfrom
apocalypse9949:XPIA

Conversation

@apocalypse9949

@apocalypse9949 prudhvi (apocalypse9949) commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This PR improves XPIA attack setup performance by initializing injection handles concurrently.

Performance: Concurrent XPIA Handle Initialization

XPIAExecution._activate_handles_async previously initialized injection handles sequentially. For attacks involving multiple injection surfaces, this caused independent asynchronous setup operations to execute serially.

This change uses asyncio.gather(..., return_exceptions=True) so independent setup operations such as remote file uploads proceed in parallel. A failing handle does not cancel siblings, which lets successful activations finish enter_async_context and register __aexit__ cleanup before the first error is re-raised.

The existing readiness wait remains concurrent via asyncio.TaskGroup.

Impact

Local testing showed approximately 45% lower activation time for multi-surface scenarios compared with the sequential implementation.

Testing

  • uv run pytest tests/unit/attacks/test_xpia.py -v — passed
  • Added a regression test where one handle fails and a delayed sibling still registers cleanup
  • Verified existing test behavior and exception handling remain unchanged

Files Changed

  • rampart/attacks/_xpia.py — concurrent handle activation via non-cancelling asyncio.gather
  • tests/unit/attacks/test_xpia.py — partial-failure cleanup coverage

Also includes feature addition for exposing trial group aggregation metadata to json reports.
Also includes feature addition for exposing trial group aggregation metadata to json reports.
Also includes feature addition for exposing trial group aggregation metadata to json reports.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@apocalypse9949
prudhvi (apocalypse9949) requested a review from a team August 13, 2026 14:24
@apocalypse9949

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@apocalypse9949 prudhvi (apocalypse9949) changed the title perf: execute XPIA injection handle activation concurrently [PERF]: execute XPIA injection handle activation concurrently Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions, prudhvi (@apocalypse9949). I will still leave this open for comment from others 😄

Comment thread rampart/attacks/_xpia.py Outdated
Comment thread rampart/pytest_plugin/_session.py Outdated
Comment thread rampart/attacks/_xpia.py Outdated
@nina-msft

Copy link
Copy Markdown
Contributor

Please update the PR description to match the scoped implementation :-)

Comment thread rampart/attacks/_xpia.py Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@nina-msft Nina Chikanov (nina-msft) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution prudhvi (@apocalypse9949)!

@nina-msft
Nina Chikanov (nina-msft) merged commit 3d219d8 into microsoft:main Aug 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants