Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(web): stop the 404 page offering demo data a build does not have (#997)
Beenu Aroraa2a752e38987
diff --git a/apps/web/src/app/not-found.test.tsx b/apps/web/src/app/not-found.test.tsxnew file mode 100644index 000000000..73c0e18f4--- /dev/null+++ b/apps/web/src/app/not-found.test.tsx@@ -0,0 +1,84 @@+/**+ * The 404 page must not offer demo data on a build that has none.+ *+ * Its dashboard card advertised "Anonymous, pre-seeded investigation. No+ * signup. Demo data resets daily at 00:00 UTC." unconditionally. On a+ * self-hosted build with demo mode off that is an offer of seeded data that+ * does not exist and a reset schedule nothing runs — the same class of defect+ * as a console announcing demo resets over somebody's real alerts, pointing+ * the other way.+ *+ * Both directions, because deleting the copy outright would pass a one-sided+ * suite and quietly remove the one thing a visitor to the hosted demo most+ * wants to know.+ */+import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';+import { cleanup, render, screen } from '@testing-library/react';+import { __setDemoModeForTests } from '@/lib/demoMode';++vi.mock('next/link', () => ({+ __esModule: true,+ default: ({ children, href }: { children: React.ReactNode; href: string }) => <a href={href}>{children}</a>,+}));++vi.mock('@/components/landing/sections/StickyNav', () => ({+ __esModule: true,+ StickyNav: () => null,+}));++vi.mock('@/components/landing/sections/Footer', () => ({+ __esModule: true,+ Footer: () => null,+}));++import NotFoundPage from './not-found';++/** Every phrase that promises demo data exists. */+const DEMO_PROMISES = [/pre-seeded/i, /resets daily/i, /no signup/i, /00:00 UTC/i];++afterEach(() => {+ cleanup();+ __setDemoModeForTests(null);+});++describe('with demo mode off', () => {+ beforeEach(() => __setDemoModeForTests(false));++ it('promises no demo data', () => {+ render(<NotFoundPage />);+ for (const promise of DEMO_PROMISES) {+ expect(screen.queryByText(promise), `"${promise}" offers demo data this build does not have`).toBeNull();+ }+ });++ it('still points at the dashboard, and says what it actually is', () => {+ // Gating the copy must not cost the destination. A 404 page whose links+ // disappear is worse than one with an over-eager blurb.+ render(<NotFoundPage />);+ expect(screen.getAllByRole('link', { name: /open the dashboard/i }).length).toBeGreaterThan(0);+ expect(screen.getByText(/sign in to continue/i)).toBeInTheDocument();+ });++ it('does not call it "live"', () => {+ render(<NotFoundPage />);+ expect(screen.queryByText(/open the live dashboard/i)).toBeNull();+ });++ it('keeps the rest of the destinations', () => {+ render(<NotFoundPage />);+ for (const label of [/see pricing/i, /read the docs/i, /contact the team/i]) {+ expect(screen.getByRole('link', { name: label })).toBeInTheDocument();+ }+ });+});++describe('with demo mode on', () => {+ beforeEach(() => __setDemoModeForTests(true));++ it('says the demo is seeded and resets, because there it is true', () => {+ render(<NotFoundPage />);+ expect(screen.getByText(/pre-seeded/i)).toBeInTheDocument();+ expect(screen.getByText(/resets daily at 00:00 UTC/i)).toBeInTheDocument();+ expect(screen.getAllByRole('link', { name: /open the live dashboard/i }).length).toBeGreaterThan(0);+ });+});diff --git a/apps/web/src/app/not-found.tsx b/apps/web/src/app/not-found.tsxindex accda47b7..de10279c3 100644--- a/apps/web/src/app/not-found.tsx+++ b/apps/web/src/app/not-found.tsx@@ -4,6 +4,7 @@ import { ArrowRight, Telescope } from 'lucide-react';import { StickyNav } from '@/components/landing/sections/StickyNav';import { Footer } from '@/components/landing/sections/Footer';import { docs } from '@/lib/docs';+import { isDemoMode } from '@/lib/demoMode';/*** Global 404 fallback.@@ -33,7 +34,7 @@ import { docs } from '@/lib/docs';export const metadata: Metadata = {title: '404 — page not found · AiSOC',description:- 'That URL is not part of the AiSOC marketing site. Jump back to the homepage, open the interactive demo, or pick one of the popular destinations below.',+ 'That URL is not part of the AiSOC site. Jump back to the homepage, open the dashboard, or pick one of the popular destinations below.',// Tell crawlers we know this is a 404 surface; do not let them index it.robots: { index: false, follow: false },};@@ -45,33 +46,60 @@ interface Destination {external?: boolean;}-const DESTINATIONS: ReadonlyArray<Destination> = [- {- label: 'Open the live dashboard',- href: '/dashboard',- blurb:- 'Anonymous, pre-seeded investigation. No signup. Demo data resets daily at 00:00 UTC.',- },- {- label: 'See pricing',- href: '/pricing',- blurb: 'Free to self-host. Pay only when we host.',- },- {- label: 'Read the docs',- href: docs('intro'),- blurb: 'Architecture, agent contract, deployment recipes, connector SDK.',- external: true,- },- {- label: 'Contact the team',- href: '/contact',- blurb:- 'Sovereign deployments, design-partner conversations, security disclosures.',- },-];+/**+ * The dashboard card, which is the only one whose copy depends on the+ * deployment.+ *+ * It advertised "Anonymous, pre-seeded investigation. No signup. Demo data+ * resets daily at 00:00 UTC." unconditionally — on a self-hosted build with+ * demo mode off, an offer of seeded data that does not exist and a reset+ * schedule nothing runs. Same class of defect as a console announcing demo+ * resets over somebody's real alerts, pointing the other way.+ *+ * `isDemoMode()` is the flag the rest of the product gates on, and this file+ * is a Server Component, so it reads `AISOC_DEMO_MODE` from the running+ * container before falling back to the value compiled in at build time.+ */+function dashboardDestination(demo: boolean): Destination {+ return demo+ ? {+ label: 'Open the live dashboard',+ href: '/dashboard',+ blurb: 'Anonymous, pre-seeded investigation. No signup. Demo data resets daily at 00:00 UTC.',+ }+ : {+ label: 'Open the dashboard',+ href: '/dashboard',+ blurb: 'Alerts, cases and investigations for this deployment. Sign in to continue.',+ };+}++function destinations(demo: boolean): ReadonlyArray<Destination> {+ return [+ dashboardDestination(demo),+ {+ label: 'See pricing',+ href: '/pricing',+ blurb: 'Free to self-host. Pay only when we host.',+ },+ {+ label: 'Read the docs',+ href: docs('intro'),+ blurb: 'Architecture, agent contract, deployment recipes, connector SDK.',+ external: true,+ },+ {+ label: 'Contact the team',+ href: '/contact',+ blurb: 'Sovereign deployments, design-partner conversations, security disclosures.',+ },+ ];+}export default function NotFoundPage() {+ const demo = isDemoMode();+ const DESTINATIONS = destinations(demo);+return (<maindata-theme="dark"@@ -105,7 +133,7 @@ export default function NotFoundPage() {href="/dashboard"className="inline-flex h-11 items-center gap-2 rounded-md border border-white/15 bg-white/[0.02] px-5 text-sm font-semibold text-white transition-colors hover:bg-white/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-300 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base">- Open the live dashboard+ {demo ? 'Open the live dashboard' : 'Open the dashboard'}</Link></div></div>