Kahozue/thesis-admin-console
GitHub: Kahozue/thesis-admin-console
Stars: 0 | Forks: 0
# thesis-admin-console
Admin console MVP for a privacy-preserving social engineering detection system in enterprise instant messaging (Microsoft Teams). Developed as the implementation artifact for a master's thesis on LLM-assisted threat detection.
## Overview
This frontend dashboard supports three analyst roles — Security Analyst (SA), Compliance Manager (CM), and Authorized Re-identifier (AR) — in reviewing pseudonymized chat conversations flagged by the LLM risk scoring pipeline, and authorizing controlled identity re-identification under a strict audit trail.
The system deliberately operates on **pseudonymized data only**: real user identities are never exposed unless a full CM approval + AR reveal workflow completes and is logged in the audit trail.
## Architecture Context
Microsoft Teams
↓
System A (data collection + PII filtering + token mapping)
↓ pseudonymized text only
System B (LLM risk scoring) ← this UI consumes System B output
↓
Admin Console (this repo) — dashboard / alerts / re-identify / audit
The PII detection pipeline (System A component) lives in [thesis-pii-pipeline](https://github.com/KahoKozue/thesis-pii-pipeline).
## Tech Stack
- React 18.3 + TypeScript 5.4 (strict)
- Vite 5.4, Tailwind CSS 3.4, shadcn/ui
- react-router-dom 6, TanStack Query 5, Zustand 4
- react-hook-form 7 + Zod 3
- Recharts 2 (line charts, doughnut, custom heatmap)
- MSW 2 (Service Worker mocks — no backend required to run)
- Vitest 2 + Testing Library 16 (46 unit/component tests)
## Getting Started
npm install
npm run dev # http://localhost:5173
npm run test # run test suite
npm run typecheck # tsc --noEmit
npm run build # production build
Copy `.env.example` to `.env.local` (defaults work out of the box with MSW mocks):
VITE_USE_MOCK=true
VITE_API_BASE_URL=/api/v1
## Demo Walkthrough
1. Open `http://localhost:5173` → redirects to `/login`
2. Select role:
- **SA** — direct login, can view dashboard and alerts
- **CM** — triggers MFA dialog (enter `000000`)
- **AR** — same as CM
3. Full re-identification flow:
1. SA: `/dashboard` → heatmap → click high-risk event → `/alerts/{id}`
2. SA: click "Initiate Re-identification" (requires ≥ 20-char justification)
3. CM login → `/reidentify/queue` → approve → MFA
4. AR login → `/reidentify` → Reveal → second MFA → view real identity
5. AR: "End session & clear" → `/audit` shows 5-entry trail
Edge state testing:
/dashboard?mockState=empty
/dashboard?mockState=5xx
/dashboard?mockState=forbidden
/dashboard?mockState=delayed
## PII Pipeline Integration
When running alongside the PII API server, the Ingest page shows live pseudonymization:
# Terminal 1: PII API
cd ../thesis-pii-pipeline/pii && python api_server.py # port 8503
# Terminal 2: this app
npm run dev
Navigate to `/ingest`, load built-in samples, and inspect the alias map showing `PERSON_A`, `EMAIL_B`, etc.
## Project Structure
src/
├── pages/ 11 pages (dashboard, alerts, reidentify, audit, settings, ...)
├── components/
│ ├── ui/ shadcn/ui base components
│ └── domain/ heatmap, stability indicator, identity badge
├── features/
│ ├── auth/ roleStore (Zustand) + AR candidate list
│ └── dashboard/ risk trend and distribution charts
├── api/ 12 endpoint modules (aligned to spec)
├── types/ graph / analysis / audit / api / role / common
├── schemas/ Zod runtime validators
├── mocks/ MSW handlers + in-memory store + scenario data
└── lib/ permissions / alias / dateTime / risk / queryClient
## Implemented Features
| ID | Feature | Status |
|----|---------|--------|
| F-1 | Login + MFA trigger | Done — role switcher replaces SSO; CM/AR require 000000 |
| F-2 | Dashboard heatmap | Done — Tailwind grid, click-through to filtered alert list |
| F-3 | Risk trend line chart | Done — High/Mid/Low, D/W/M toggle |
| F-4 | Risk distribution doughnut | Done — sector click filters alert list |
| F-5 | Alert list with pagination and filters | Done |
| F-6 | Event context page | Done — pseudonymized, three-panel layout |
| F-7 | Threat message highlight + reason sync | Done — bidirectional scrollIntoView |
| F-8 | Re-identification request | Done — RHF + Zod, ≥ 20-char reason, audit write |
| F-9 | Approval queue + MFA | Done — CM-only |
| F-10 | AR reveal (one-time token) | Done — state-only, countdown, beforeunload cleanup |
| F-11 | Rejection path | Done — mandatory reason + second MFA |
| F-12 | Mark as handled | Done — irreversible, audit write |
| F-13 | Audit trail query | Done — SA/AR see own; CM sees all |
| F-14 | Report export | Done (CSV) |
| F-15 | System settings (CM) | Done (frontend state) |
## Known MVP Limitations
| Item | Reason |
|------|--------|
| Real SSO (SAML/OIDC) | Out of MVP scope; frontend uses role switcher |
| Session idle timeout | Requires backend session; reveal 15-min countdown is implemented |
| Real backend API | Full MSW mock; Zod schemas ready for direct API wiring |
| XLSX report export | Deferred pending spec clarification |
标签:自动化攻击