Skip to content
Sam MG Harish edited this page Oct 30, 2026 · 3 revisions

Web UI

What ships

The Python package ships the built dashboard in lu77U_MobileSec/web/static/: an index.html entry point plus hashed JS and CSS under assets/. MANIFEST.in includes web/static/* and prunes the frontend source, so an installed copy serves the dashboard without Node present.

FastAPI mounts web/static/assets at /assets and serves everything else through the SPA fallback route.

Source layout

TypeScript throughout.

lu77U_MobileSec/frontend/
├── index.html
├── vite.config.js          builds into ../web/static, dev proxy to :8000,
│                           injects name/version/homepage from pyproject.toml
├── package.json            React 18, react-router-dom 7, recharts, lucide-react, Tailwind
├── package-lock.json       pinned tree, used by npm ci
├── tailwind.config.js, postcss.config.js
├── tsconfig.json           strict, react-jsx, noEmit
└── src/
    ├── main.tsx            root render
    ├── App.tsx             routes
    ├── project.d.ts        types for __APP_NAME__ / __APP_VERSION__ / __APP_HOMEPAGE__
    ├── api.ts              typed API client, ApiError, scanWsUrl
    ├── index.css           Tailwind entry
    ├── lib/
    │   ├── format.ts       severity metadata and formatting helpers
    │   └── useScanStream.ts  WebSocket hook: status, progress, logs
    ├── components/
    │   ├── Layout.tsx      shell and navigation
    │   ├── UploadCard.tsx  APK upload and local-path entry
    │   ├── ScanTable.tsx   scan list with pause / stop / resume / delete
    │   ├── VulnList.tsx    findings, chains, gate results, refuted section
    │   └── ui.tsx          Card, SectionTitle, EmptyState, Spinner, Segmented
    └── pages/
        ├── Dashboard.tsx   totals, severity chart, recent scans (compact table)
        ├── Scans.tsx       full scan list
        ├── ScanDetail.tsx  live progress, log panel, findings, report downloads
        └── Settings.tsx    providers, key pool, models, tool paths, budget, toggles

The whole src/ tree was migrated from JavaScript to TypeScript; jsconfig.json was replaced by tsconfig.json and npm run typecheck runs tsc --noEmit.

Routes

Path Page
/ Dashboard
/scans Scan list
/scans/:id Scan detail
/settings Settings
anything else Dashboard

Client-side routing survives a hard reload because the server's catch-all returns index.html with Cache-Control: no-store for any path that does not match a real static file.

Layout

components/Layout.tsx renders the sidebar, header and routed page for every route above. On desktop the sidebar is position: fixed (not sticky) so it never moves as the page scrolls. It used to be sticky on a flex h-full container, but index.css's html,body,#root{height:100%} resolved that container to exactly 100vh, which gave the sticky element zero scroll travel and made it scroll away with the page like a static one. Taking it out of flow entirely with fixed sidesteps that: the main column reserves md:pl-64 to clear it, and the sidebar carries backdrop-blur since page content now scrolls beneath its translucent background rather than around it. The header stays sticky top-0 and, once the same h-full was dropped from the root container, now actually sticks. The mobile nav drawer is unaffected: it was already fixed.

Scan controls

Pause, Stop and Resume act immediately with no confirmation prompt, since all three are recoverable. Delete confirms.

Control Endpoint Effect
Pause POST /scans/{id}/pause Stops at the next checkpoint, keeps everything
Resume POST /scans/{id}/resume Continues from checkpoint/
Stop POST /scans/{id}/stop Terminal; a partial result is still stored
Delete DELETE /scans/{id} Cancels if running, then removes the folder

A completed scan whose analysis did not run shows a The analysis did not run card with the reason from analysis.error, saying that no findings are listed because the code was not analysed; a scan read in reduced form shows a Reduced coverage card with analysis.limitation. Before, a failed analysis showed only a 0.0 score and "0 findings", and the reason was in the result alone.

A paused scan renders PausedView, which distinguishes four reasons: user ("Scan paused"), interrupted ("Scan interrupted": the server stopped while it was running and its progress was checkpointed; after two failed automatic resumes it says it has given up), provider_quota ("Paused - AI provider quota exhausted") and provider_unreachable ("Paused - AI provider unreachable": no network, or the host is down). The two outage reasons show the time resume_after says it will be retried and how many automatic retries have run.

Log panel

LogPanel is present on every scan-detail state (running, paused, failed, completed). It shows the live stream while a scan runs and the on-disk history otherwise, with a substring filter, a line count, and a download link to GET /scans/{id}/logs/download.

persisted from the logs endpoint distinguishes "no output" from "nothing written down". scan.log is only written when the server runs verbose.

Live scan updates

useScanStream(id, enabled, onTerminal) opens ws://<host>/api/ws/scans/<id> and folds the event stream into {status, progress, logs, error, loadingHistory, logsPersisted}. It fetches the on-disk history from GET /scans/{id}/logs alongside the socket, so a reload mid-scan reconstructs the full log rather than only the backlog. onTerminal fires when a terminal status arrives so the page can refetch the finished result.

Findings rendering

VulnList mirrors the HTML report:

  • Findings grouped by severity, worst first. A long title wraps rather than being cut off, and the expanded card shows the cited file with its line.
  • A Chain badge and a ChainBlock (components + ordered attacker flow) on chain findings. The chain's description is shown without its trailing "Attack path" list, which the block already numbers.
  • A DeviceBlock with the finding's own device verdict: "Verified on a device" or "Refuted on a device" with its evidence, or "Not verified on a device" with the reason, quietly, since that reason is about the test setup rather than the app.
  • A GateBlock on any finding carrying a gate_result: verdict, reasons, warnings, original severity, and a "Part of exploit chain …" back-reference from chained_into. A clean PASS with nothing to say renders nothing.
  • A separate Refuted section for vulnerability_analysis.refuted, holding the findings the mechanical gates rejected before any model call.

Dashboard

The Vulnerabilities total and the severity donut count the same thing, Critical through Low: Informational notes are findings but not vulnerabilities, and the total once said 74 beside a donut that said 47. The recent-scans table is the compact form of the scan list, without the age and per-row actions, which the narrower card had pushed out of view; app names break after their slashes, so a repository path wraps between its parts.

Settings page

Provider picker

The ten backend provider keys (AI providers) are seven real vendors in the UI: /api/settings's vendors field (ai/registry.py's PROVIDER_VENDORS, mirrored as ProviderVendor in api.ts) groups each provider key under its vendor, with api/cli naming which backend(s) reach it. Claude, OpenAI and Google each have both (codex_cli is OpenAI's own CLI backend and antigravity_cli is Google's, not separate vendors), so the picker renders one chip per vendor instead of one per provider key, which used to produce two chips both truncated to "Claude" (display_name.split(" ")[0] collided claude and claude_cli).

A vendor with two backends shows an Access segmented control (Segmented from ui.tsx, the same component as Ollama's cloud/local Mode switch) below the chips: API key or CLI. Selecting a backend remounts ProviderEditor (key={resolved}), which resets its own local state and re-fetches models/CLI status for whichever backend is now selected. Flipping Access also moves active_provider, but only when the vendor being edited already owns it; for any other vendor, flipping just changes what the editor shows, and the existing "Make active" button commits it.

Each chip carries a status dot, shape carrying one axis and colour the other so the state survives with colour perception removed: a filled dot means this vendor is the active provider (emerald if it's actually configured, amber if it isn't: an active-but-unconfigured provider used to render an unconditional green dot on whichever provider merely had a key stored, regardless of which one a scan would use); a hollow ring means configured but not active; nothing means neither. has_api_key (API backends) or cli_found (CLI backends, a cheap PATH lookup, not the live sign-in probe) decide "configured".

Everything else

  • General: the active provider (a select grouped into API-key and subscription-CLI providers), the JADX path with its detection state, and the Generate PDF reports and Auto-resume interrupted scans toggles.
  • Test connection per provider, through POST /api/settings/test.
  • Key pool per provider: masked previews, each with its label when it has one, add with an optional label, a tag button to add, edit or clear a stored key's label in place (Enter saves, Escape cancels), delete by index, and a reveal toggle backed by POST /settings/credentials/{provider}/reveal. Not shown for a CLI backend; see Configuration.
  • max_concurrent_requests per provider, bounded by max_concurrent_requests_range from the snapshot.
  • CLI status block, for a CLI backend: cli_found / signed_in from GET /api/settings/cli-status/{provider}, and a binary_path override field.
  • Optional decompilers: path fields for Blutter, hermes-decomp, react-native-decompiler and Ghidra, each with its detection state from /api/status. None blocks scanning; see Configuration. Below them, Optional add-ons lists Semgrep and mitmproxy as installed, or with the pip install "lu77U-MobileSec[...]" command that adds each.
  • Model field: free text with suggestions from GET /api/settings/models/{provider}, so an empty or stale list never blocks typing a model name. For Ollama cloud the suggestions are the live catalogue.
  • Agent budget: max_steps_per_region and max_minutes, bounded by agent_budget_limits. The file review's max_review_parts is not on this page; it is kept when the page saves the other two.

Prompt overrides and skill uploads have no controls on this page; they are reached through the API (/api/settings/prompts, /api/settings/skills, see HTTP API). Dynamic verification and agent memory are likewise settings without a toggle here; they are changed in settings.json or through PUT /api/settings.

API client

src/api.ts wraps fetch and throws ApiError(message, status, detail) on a non-2xx response, unwrapping FastAPI's detail field, which may be a string or an object with a message. It also declares the response types (ScanMeta, ScanResult, Vulnerability, GateResult, Chain, Settings, StoredApiKey, LogLine, …), which is the closest thing in the repo to a written contract for the API.

Building from source

./scripts/build_frontend.sh      # npm ci (or install) + vite build, into web/static

Or by hand:

cd lu77U_MobileSec/frontend
npm ci
npm run typecheck   # tsc --noEmit
npm run build       # emits into ../web/static
npm run dev         # Vite on :5173, proxying /api (and WebSockets) to 127.0.0.1:8000

For development, run the Python server separately with lu77U-MobileSec --no-browser and use the Vite dev server; the proxy forwards both REST and WebSocket traffic.

Rebuild and commit web/static/ whenever the UI changes; that directory is what the package ships.

Branding

App name, version and repository link are not written into the components. vite.config.js reads pyproject.toml and injects __APP_NAME__, __APP_VERSION__ and __APP_HOMEPAGE__, and substitutes %APP_NAME% in index.html's title. The sidebar prefers the version reported by /api/version and falls back to the injected one.

Clone this wiki locally