Skip to content

Fix simulation results shown as 'Simulation Failed' in web app - #1453

Open
sparcstation wants to merge 1 commit into
splunk:developfrom
sparcstation:fix/simulate-output-rendering
Open

sparcstation wants to merge 1 commit into
splunk:developfrom
sparcstation:fix/simulate-output-rendering

Conversation

@sparcstation

Copy link
Copy Markdown

Summary

Running an Atomic Red Team simulation from the web app shows "Simulation Failed — t is not iterable" even though the simulation succeeds (API returns 200, execution_status: success).

Since da6bde0 the simulate API returns execution_output as {status, summary, results, by_host} (built by _extract_atomic_simulation_output), but app/src/pages/attack-ranges/[id].astro still iterated it as the old {host: [{technique, output}]} shape. Iterating the summary object throws, and the catch block reports it as a failed simulation.

Changes

  • Render results from by_host (falling back to top-level results): per-atomic pass/fail, return code, stdout/stderr (and error on failure), plus an overall x/y succeeded line.
  • HTML-escape atomic output before inserting it into the page (it was previously injected as raw HTML).
  • Update SimulateResponse in app/src/utils/api.ts to match the API (execution_status, execution_summary, execution_output).
  • Add app/tests/e2e/simulate.spec.ts Playwright regression test using the real response shape.

Testing

  • npm run build succeeds; Playwright suite: 6/6 passed (in mcr.microsoft.com/playwright:v1.58.2-noble).
  • The new test fails against develop with "Simulation Failed" and passes with this change.
  • Reproduced originally by running T1197 against an Azure splunk_ad_azure range (API log: status=success total=1 succeeded=1, UI: "Simulation Failed").

The simulate API returns execution_output as
{status, summary, results, by_host} (since da6bde0), but the detail page
still iterated it as {host: [{technique, output}]}. Iterating the summary
object threw 'not iterable', so successful simulations were shown as
'Simulation Failed'.

Render per-host results from by_host with pass/fail, return code and
stdout/stderr, plus an overall summary. Escape atomic output before
inserting it into the page. Update the SimulateResponse type to match the
API and add a Playwright regression test.
@sparcstation

Copy link
Copy Markdown
Author

Verified manually: with this change, re-running T1197 from the web app against an Azure splunk_ad_azure range renders the execution output correctly (previously "Simulation Failed — t is not iterable").

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.

1 participant