ai newsDi., 1. Dez.

Automating an AI Security Analyst with Claude and Playwright: What We Built and What We Found

Juno is Uptycs' AI security analyst: you ask a question, and it plans an investigation, runs queries across your telemetry and connected tools, and writes up what it found. We built an end-to-end regression suite for it on Playwright and Node.js, written and maintained largely with Claude Code. It

dev.toDienstag 07:31 · 01.12.6 Min. Lesezeit
Bild: dev.to

Juno is Uptycs' AI security analyst: you ask a question, and it plans an investigation, runs queries across your telemetry and connected tools, and writes up what it found. We built an end-to-end regression suite for it on Playwright and Node.js, written and maintained largely with Claude Code. It runs from Jenkins against live stacks and covers almost every Juno feature: investigations, playbooks, connectors, calibrations, projects, Discovery AI filters, Hunting AI (natural language to SQL), configuration pages and usage billing.

AI plays two roles. During development, Claude Code reads the runners, drives the live UI, and writes or repairs tests. At run time, Claude on AWS Bedrock acts as a generator and judge: it writes connector queries, scores Juno's answers against ground truth, and grades investigations against a rubric. This matters because Juno's output is non-deterministic text, which a fixed string assertion cannot check.

The framework is a set of independent Node scripts, one per suite, sharing a helper library and driven by one master runner from Jenkins. Claude appears twice: Claude Code writes and repairs suites at development time, and Claude on Bedrock judges Juno's answers at run time.

Jenkins pipeline ──► Master runner Claude Code (dev time) (parallel lanes, codegen, screenshots, traces usage capture) new suites, locator fixes │ │ writes, repairs ▼ │ ┌──────────────────────────────────────────────┐ │ │ Suites: 26 classic (T*) + 28 standalone (SA*) │◄───────┘ │ one runner each: own browser context, │ │ recordTest() per case, cleanup │ └──────────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────┐ results/ │ lib/ shared helpers │ ──► markdown, JUnit XML, │ login + storageState, page_ready, grid_wait, │ screenshots, traces │ investigation_wait, lifecycle, API, judge │ │ └──────────────────────────────────────────────┘ ▼ │ │ │ Reporting ▼ ▼ ▼ test base (SQLite + JSONL), Juno web UI Uptycs API Claude (Bedrock) ReportPortal, Confluence (Chromium via (ground truth, judge: rubric, Playwright) cross-checks) coherence, 1–5 Enter fullscreen mode Exit fullscreen mode Key design choices:

AI was used in two separate places: Claude Code as the engineer that builds and repairs the suite, and Claude on Bedrock as a component inside the suite that judges Juno's answers.

At least 39 commits since Sep 11, 2026 carry a Claude co-author trailer; earlier AI-assisted work was not tagged. The repo documents the working pattern in its README under "Working with Claude Code".

Fix T10.09: the thumbs buttons moved. Open the page, screenshot the current UI, update the locator in the T10 runner, and run the suite. Enter fullscreen mode Exit fullscreen mode Claude on Bedrock as the judge inside the suite Juno answers in free text that changes between releases, so string matching cannot tell a good investigation from a bad one. The suite calls Claude through AWS Bedrock at run time for five jobs:

The judge was built with guardrails so an LLM failure never turns into a false pass:

The suite uses the Playwright library directly (Chromium) from plain Node scripts, not the Playwright Test runner. Each suite owns its browser context, records its own results, and cleans up what it created.

Authentication. Sessions are saved as Playwright storageState files, so runs skip Google sign-in. A helper creates them once in a headed browser and can deploy them to the Jenkins node. Restricted features use a separate support-role session, and the standalone UI uses a two-stage Keycloak-then-IdP login. A secureFill helper keeps secrets out of traces.

From recording to test. Flows start with npx playwright codegen --load-storage=..., which records clicks against the logged-in app. Claude Code then hardens the draft:

Waiting on an AI product. Juno investigations run for minutes and the UI is heavy, so the waits are explicit and shared in lib/:

UI plus API checks. UI checks (element present, navigation works) are kept separate from logic checks (filter results correct, counts add up). Where possible a UI result is cross-checked against the Uptycs API: created exceptions in Alert Rules, calibrations, usage units, and LLM token cost when bring-your-own-key is configured.

Evidence. Screenshots before and after each action and on failure, plus a Playwright trace that is kept only when a test fails ( npx playwright show-trace ). Every investigation a run creates goes into a ledger with how it was cleaned up.

CI. Each Jenkins build validates the test base, runs suites (optionally in parallel lanes), builds the HTML report, ingests JUnit into the test base, and publishes to ReportPortal and optionally Confluence. The Juno version is recorded on every result.

Every major Juno feature has a suite; the biggest are the configuration page (50 cases), ground-truth accuracy (42) and the sidebar (38). "AI judge" marks the suites that call Claude on Bedrock at run time.

The standalone Juno UI has its own 28 suites, SA0–SA27, forked from the classic ones. Usage is captured before and after every run and reconciled across the license dashboard, the API and the audit log.

The suite surfaced Juno product defects (one reported first by a customer), cases that failed repeatedly across builds, bugs in our own reporting pipeline, and weaknesses in the automation itself. When the test base launched on Sep 10, 2026, 24 cases were failing at the latest run and 45 were flaky (result flips in 20% or more of runs).

One apparent defect turned out not to be one. Usage never moved on the test account because it is support-flagged, and license consumption is a no-op for support requests. The check was changed to report the before and after numbers instead of failing every run.

Across the team's channel, 73 product issues were logged between March and November 2026 from automation runs and manual checks. Most were in connector setup (OAuth flows, forms, deletes), connector use during investigations, audit-log filters, role permissions and UI polish, with a smaller group of investigation failures such as missed inventory tables or a follow-up that ignored a region filter.

Once ReportPortal grouped results under one stable launch name, it ranked the worst cases across 51 builds. Each is a candidate product issue in its area and is tracked build over build in the test base.

Checking reported numbers against the source also found bugs in our own tooling. Several had been reporting wrong data silently.

Coverage gaps found during the test-base migration: date-range validation and RBAC have no automated coverage, and a set of query edge cases (empty submit, long query, special characters, rapid submit, no results) were specified but never automated.

AI made it practical for a small team to keep 54 suites green against a UI that changes daily, but only with screenshots, traces and hard rules around the judge.

Next: port the fail-fast investigation wait to every suite, add a playbook-schedule suite for the standalone UI, cover the new standalone Settings pages (Users, Roles, API Keys), and add RBAC and date-range coverage.

Quelle: dev.to (dev.to). Original öffnen