How we built a browser front end for Cyber Threat Analyzer using only the server’s existing REST API, and what that shows about building your own.
Cyber Threat Analyzer (CTA) has a desktop console, but the server underneath it is a REST API. We wanted to test a simple claim: if the API is good enough, a new application should need no changes to the server at all. So we built a web console from scratch against the API as it already exists. This post covers how that went, and where you can start if you want to build your own.
Start with the contract, not the code
Before writing any React, we read what the server already publishes:
docs/api.mddescribes each route, its authentication and its error codes.exports/openapi-v1.jsonis a machine-readable OpenAPI description of the whole/api/v1surface.- The router source shows exactly how authentication and permissions are enforced.
Reading these first meant we could pick the routes we needed before touching the front end. For a first version, five were enough:
| Purpose | Route |
|---|---|
| Is the server up? | GET /healthz |
| Sign in / sign out | POST /api/v1/auth/login, POST /api/v1/auth/logoff |
| Dashboard figures | GET /api/v1/dashboard/summary |
| Alerts | GET /api/v1/alerts?limit=100 |
| Endpoints | GET /api/v1/agents |
Authentication is the whole integration
Most of the work in any app built on an API is getting authentication right. CTA’s model is simple:
- Send a username and password to
/api/v1/auth/login. - The server checks them against the same user table and password rules the desktop app uses, then returns an opaque token.
- Send that token on every later request as
Authorization: Bearer <token>.
Because the web console reuses the existing login, existing users keep their existing credentials. Account lockouts, deactivated accounts and role permissions all behave as they do in the desktop app.
We put all of this in one small file, src/api/client.js. It attaches the token, turns the server’s error messages into readable text, and ends the session when the server answers 401. The server decides when a session is over, so the front end never guesses at expiry.
One screen for the splash and the login
The desktop app shows a splash screen and then a login dialog. In the browser we merged them into one screen: product logo, “Powered by” credit and sign-in form together. The splash’s “Starting up…” message now comes from a real health check against /healthz. If the server is unreachable, you find out before you type a password.
A dashboard that answers one question
The dashboard leads with a plain-language line, such as “7 alerts waiting for review”, and a bar showing how those alerts split by severity. Under it are the summary figures, the latest alerts and the endpoint list, with offline hosts first.
Each panel loads independently. If your role lacks permission for one of them, say alerts, that panel explains which access is missing, and the rest of the dashboard still works. If a refresh fails, the last good data stays on screen with a short warning instead of going blank.
Things we learned that you will meet too
The server sends no CORS headers. A browser app on a different origin can’t call it directly. During development we proxy /api and /healthz through the dev server, which needs no server changes. In production, serve your app from the same origin as the API, or put both behind one reverse proxy.
Multi-customer accounts need a header. MSSP accounts must send X-CTA-Tenant-ID on customer-scoped requests. We load the list from GET /api/v1/tenants and show a customer picker. Plan for this early if your users manage more than one organization.
Some counts are capped. The summary endpoint counts at most the latest 100 alerts and cases. We show those figures as “100+” at the cap rather than implying an exact total.
Timestamps carry no timezone. Alert times come back without one, so “4 minutes ago” is only right when browser and server share a timezone. Worth knowing before you build anything time-sensitive.
First-run setup isn’t in the API. The first administrator is created in the desktop app, so the web console can’t do that.
Build your own
You don’t need our console to use any of this. The recipe:
- Read
docs/api.mdand the OpenAPI file to find the routes you need. - Sign in once, keep the token for the session, and send it as a bearer token.
- Handle 401 (sign in again), 403 (this role can’t do that) and 429 (slow down) as separate cases.
- Treat the server’s error text as user-facing; it is usually specific.
- Sort out CORS or same-origin hosting before you design anything else.
The same approach works for a ticketing integration, a wall-mounted status display, a mobile viewer or a customer-facing report page. All of them sit on the same API and the same permission model, so they respect the same roles as the desktop console.
Caveats
We built and unit-tested the console’s API client and helpers, and previewed the layouts, but we haven’t yet run it end to end against a live server in every configuration, MSSP accounts included. Treat it as a working starting point, not a finished product.
We are open to this kind of arrangement(see picture below) that is why we published this as a guide.



No comments:
Post a Comment