3.0 KiB
3.0 KiB
Iteration Log - 2026-07-24-1126-adhoc-branding-and-site-isolation
Request
Address branding leaks (BackOne logos and titles showing up on the Nexus site) and eliminate cross-tenant data leakage (SIAB agents and data appearing on the Nexus site). Ensure that data isolation is strict, so that non-global admins can only query data belonging to their respective sites.
Steps Taken
- Created Branding Detection System:
- Added branding.ts to detect whether the user is on the "Nexus", "SIAB", or "BackOne" site based on URL hostname, localStorage, and query arguments.
- Branded Login Page:
- Updated login/page.tsx to dynamically choose the correct logo and text headings matching the host domain.
- Reactive Sidebar Branding & Title Replacement:
- Refactored Sidebar.tsx to auto-lock the selected site state based on the logged-in user's site UUID if they are a
TENANT_ADMINorAGENT_VIEWER. - Intercepted
document.titleon the client side usingObject.definePropertyto dynamically rewrite tab titles (e.g. replacing "BackOne" with "Nexus" when on the Nexus tenant site).
- Refactored Sidebar.tsx to auto-lock the selected site state based on the logged-in user's site UUID if they are a
- Site-Isolated Server Action:
- Secured
getAgentsin agents.ts by verifying the session cookie inside Next.js Server Actions using a new helpergetAuthUser(). Restricts the queried site UUID to the tenant admin's site UUID.
- Secured
- Site-Isolated Backend REST Endpoints:
- Updated
/api/dashboard/agents/uptimeand/api/dashboard/agents/storageto enforce strict site filtering. In particular, the storage stats endpoint now filters out any agent IDs that do not belong to the active site.
- Updated
- Automated Site Isolation Testing:
- Created test-site-isolation.js to assert that logging in as Nexus Admin only exposes Nexus agents, with zero SIAB data leakages.
Outcome
- TDD Integration Verification:
node test/test-site-isolation.jspassed successfully. Uptime and storage keys returned strictly contain Nexus agents (2N-ID-VQ-AL,1T-5Q-RC-AS), with 0 leaks from SIAB. - Dynamic Branding: The login page and dashboard sidebar correctly switch logos and page tab titles dynamically when navigating under the Nexus site.
- Production Build and Deployment: The Next.js production build succeeded locally. The remote deployment was fully uploaded to PM2 server, and reloads completed without errors.
Considerations for Next Time
- Whenever adding new dashboards or sub-routers in
backend/routes/dashboard/, always usegetBaseFilter(req)or verify that JWT/role site overrides are applied correctly so that site-scoped admins are restricted.