Spaces:
Running
Running
| import{o as e}from"./chunk-CMxvf4Kt.js";import{t}from"./react-DrNXigiH.js";import{C as n}from"./index-Caa1r77e.js";import{t as r}from"./layout-BtJ5ShnN.js";import{c as i,r as a,s as o,u as s}from"./ui-Ddu9t0Or.js";import{i as c,n as l,r as u,t as d}from"./DefenseDataState-C9G93yfx.js";var f=e(t(),1),p=n(),m={surface:`rgba(255,255,255,0.025)`,border:`rgba(255,255,255,0.08)`,text:`#f5f5f5`,dim:`#8a8a8a`,muted:`#5e5e5e`,accent:`#c9b787`},h={verified:`#c9b787`,rotating:`#3b82f6`,anomalous:`#ef4444`,suspended:`#f59e0b`},g={agent:`⬡`,service:`◈`,connector:`◆`,"tool-server":`◇`,human:`●`},_={minimal:`#5e5e5e`,standard:`#8a8a8a`,elevated:`#c9b787`,admin:`#f5f5f5`},v={critical:`#ef4444`,high:`#f59e0b`,medium:`#3b82f6`,low:`#8a8a8a`};function y(){let[e,t]=(0,f.useState)(`inventory`),[n,y]=(0,f.useState)(null),[b,x]=(0,f.useState)(0),{data:S,loading:C,error:w,lastUpdated:T,refresh:E}=c(`/api/internal/a11oy/defense/agent-zero-trust`),D=S?.identities??[],O=S?.anomalies??[];(0,f.useEffect)(()=>{if(D.length===0)return;let e=setInterval(()=>x(e=>(e+1)%D.length),3e3);return()=>clearInterval(e)},[D.length]);let k=D.filter(e=>e.type!==`human`).length,A=D.filter(e=>e.type===`human`).length,j=A>0?Math.round(k/A):k,M=D.filter(e=>e.status===`anomalous`).length,N=D.find(e=>e.id===n);return(0,p.jsxs)(r,{children:[(0,p.jsx)(i,{label:`AGENT ZERO TRUST`,title:`Identity-First Agent Security`,subtitle:`Every agent identity is untrusted by default — inspired by PANW's 82:1 machine-to-human identity ratio finding. Credential rotation, MCP token scoping, least-privilege enforcement, and behavioral anomaly detection.`,status:`LIVE`}),(0,p.jsx)(u,{loading:C,error:w,lastUpdated:T,onRefresh:E}),!S&&C?(0,p.jsx)(l,{label:`Loading agent identity inventory…`}):!S&&w?(0,p.jsx)(d,{error:w,onRetry:E}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 mb-8`,children:[(0,p.jsx)(o,{label:`IDENTITIES`,value:D.length,sub:`registered`,accent:m.accent}),(0,p.jsx)(o,{label:`MACHINE:HUMAN`,value:`${j}:1`,sub:`identity ratio`,accent:m.accent}),(0,p.jsx)(o,{label:`VERIFIED`,value:D.filter(e=>e.status===`verified`).length,sub:`active`,accent:m.accent}),(0,p.jsx)(o,{label:`ANOMALOUS`,value:M,sub:`flagged`,accent:M>0?`#ef4444`:m.accent}),(0,p.jsx)(o,{label:`MCP TOKENS`,value:D.reduce((e,t)=>e+t.mcpTokens,0),sub:`scoped`,accent:m.dim}),(0,p.jsx)(o,{label:`AVG TRUST`,value:D.length?Math.round(D.reduce((e,t)=>e+t.trustScore,0)/D.length):0,sub:`score`,accent:m.accent})]}),(0,p.jsxs)(`div`,{className:`p-4 rounded-lg mb-6`,style:{background:`rgba(201,183,135,0.04)`,border:`1px solid rgba(201,183,135,0.15)`},children:[(0,p.jsx)(`div`,{className:`text-[9px] font-mono uppercase tracking-widest mb-2`,style:{color:m.accent},children:`MACHINE-TO-HUMAN IDENTITY RATIO`}),(0,p.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsxs)(`div`,{className:`flex gap-0.5 flex-wrap`,children:[D.filter(e=>e.type!==`human`).map((e,t)=>(0,p.jsx)(`div`,{className:`w-3 h-3 rounded-sm transition-all`,style:{background:t===b?m.accent:`rgba(201,183,135,0.15)`,border:`1px solid ${t===b?m.accent:`rgba(201,183,135,0.08)`}`}},t)),D.filter(e=>e.type===`human`).map((e,t)=>(0,p.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{background:m.text,border:`1px solid ${m.text}`}},`h-${t}`))]}),(0,p.jsxs)(`div`,{className:`text-[10px] mt-2`,style:{color:m.dim},children:[k,` machine identities for every `,A,` human — each is an attack surface that requires zero-trust verification`]})]}),(0,p.jsxs)(`div`,{className:`text-3xl font-mono font-bold flex-shrink-0`,style:{color:m.accent},children:[j,`:1`]})]})]}),(0,p.jsx)(`div`,{className:`flex gap-1 mb-6`,children:[`inventory`,`rotation`,`mcp-matrix`,`anomalies`].map(n=>(0,p.jsx)(`button`,{onClick:()=>t(n),className:`px-4 py-2 text-[10px] font-mono uppercase tracking-widest rounded-md transition-all`,style:{background:e===n?`rgba(201,183,135,0.1)`:`transparent`,color:e===n?m.accent:m.muted,border:`1px solid ${e===n?`rgba(201,183,135,0.2)`:`transparent`}`,cursor:`pointer`},children:n.replace(`-`,` `)},n))}),e===`inventory`&&(0,p.jsxs)(`div`,{className:`grid lg:grid-cols-3 gap-6`,children:[(0,p.jsxs)(`div`,{className:`lg:col-span-2 space-y-2`,children:[(0,p.jsx)(s,{children:`Agent Identity Inventory`}),D.map(e=>(0,p.jsx)(`button`,{onClick:()=>y(e.id),className:`w-full text-left rounded-lg p-4 transition-all`,style:{background:n===e.id?`rgba(201,183,135,0.05)`:m.surface,border:`1px solid ${n===e.id?`rgba(201,183,135,0.2)`:e.status===`anomalous`?`rgba(239,68,68,0.3)`:m.border}`},children:(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`span`,{className:`text-lg`,style:{color:h[e.status]},children:g[e.type]}),(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium`,style:{color:m.text},children:e.name}),(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 rounded`,style:{background:`${h[e.status]}15`,color:h[e.status]},children:e.status}),(0,p.jsx)(`span`,{className:`text-[9px] font-mono`,style:{color:m.muted},children:e.type})]}),(0,p.jsxs)(`div`,{className:`text-[10px] font-mono mt-0.5`,style:{color:m.dim},children:[e.credentialType,` · Trust: `,e.trustScore,` · Privilege: `,(0,p.jsx)(`span`,{style:{color:_[e.privilegeLevel]},children:e.privilegeLevel})]})]}),(0,p.jsxs)(`div`,{className:`text-right`,children:[(0,p.jsxs)(`div`,{className:`text-[10px] font-mono`,style:{color:e.anomalyCount>0?`#ef4444`:m.accent},children:[e.mcpTokens,` tokens`]}),(0,p.jsx)(`div`,{className:`text-[9px] font-mono`,style:{color:m.muted},children:e.anomalyCount>0?`${e.anomalyCount} anomalies`:`clean`})]})]})},e.id))]}),(0,p.jsx)(`div`,{children:N?(0,p.jsxs)(`div`,{className:`rounded-lg p-5 sticky top-4`,style:{background:m.surface,border:`1px solid ${m.border}`},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,p.jsx)(`span`,{className:`text-lg`,style:{color:h[N.status]},children:g[N.type]}),(0,p.jsx)(`div`,{className:`text-sm font-medium`,style:{color:m.text},children:N.name})]}),(0,p.jsxs)(`div`,{className:`text-[10px] font-mono mb-4`,style:{color:m.dim},children:[N.id,` · `,N.type]}),(0,p.jsxs)(`div`,{className:`space-y-3 text-[10px]`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Credential Type:`}),` `,(0,p.jsx)(`span`,{style:{color:m.text},children:N.credentialType})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Privilege Level:`}),` `,(0,p.jsx)(`span`,{style:{color:_[N.privilegeLevel]},children:N.privilegeLevel})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Trust Score:`}),` `,(0,p.jsx)(`span`,{className:`font-mono font-bold`,style:{color:N.trustScore>=90?m.accent:N.trustScore>=50?m.dim:`#ef4444`},children:N.trustScore})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Rotation Interval:`}),` `,(0,p.jsxs)(`span`,{style:{color:m.text},children:[N.rotationIntervalHrs,`h`]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Last Rotation:`}),` `,(0,p.jsx)(`span`,{style:{color:m.dim},children:N.lastRotation})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{style:{color:m.muted},children:`Next Rotation:`}),` `,(0,p.jsx)(`span`,{style:{color:m.accent},children:N.nextRotation})]}),N.mcpScopes.length>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`mb-1`,style:{color:m.muted},children:[`MCP Scopes (`,N.mcpScopes.length,`):`]}),(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:N.mcpScopes.map(e=>(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 rounded`,style:{background:`rgba(201,183,135,0.08)`,color:m.accent},children:e},e))})]}),N.anomalyCount>0&&(0,p.jsx)(`div`,{className:`p-2 rounded`,style:{background:`rgba(239,68,68,0.06)`,border:`1px solid rgba(239,68,68,0.15)`},children:(0,p.jsxs)(`span`,{style:{color:`#ef4444`},children:[N.anomalyCount,` anomalies detected`]})})]})]}):(0,p.jsx)(`div`,{className:`rounded-lg p-8 text-center`,style:{background:m.surface,border:`1px solid ${m.border}`},children:(0,p.jsx)(`div`,{className:`text-xs`,style:{color:m.muted},children:`Select an identity to inspect`})})})]}),e===`rotation`&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{children:`Credential Rotation Schedule`}),(0,p.jsx)(`p`,{className:`text-xs mb-4`,style:{color:m.dim},children:`All agent credentials rotate on enforced schedules. High-privilege identities rotate more frequently. Expired credentials are automatically revoked.`}),(0,p.jsx)(`div`,{className:`rounded-lg overflow-hidden mb-8`,style:{border:`1px solid ${m.border}`},children:(0,p.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsx)(`tr`,{style:{background:`rgba(255,255,255,0.02)`},children:[`Identity`,`Type`,`Credential`,`Interval`,`Last Rotation`,`Next Rotation`,`Status`].map(e=>(0,p.jsx)(`th`,{className:`text-left px-4 py-2.5 font-mono text-[9px] uppercase tracking-wider`,style:{color:m.muted,borderBottom:`1px solid ${m.border}`},children:e},e))})}),(0,p.jsx)(`tbody`,{children:D.map(e=>(0,p.jsxs)(`tr`,{style:{borderBottom:`1px solid rgba(255,255,255,0.04)`},children:[(0,p.jsx)(`td`,{className:`px-4 py-2.5 font-medium`,style:{color:m.text},children:e.name}),(0,p.jsx)(`td`,{className:`px-4 py-2.5 font-mono`,style:{color:m.dim},children:e.type}),(0,p.jsx)(`td`,{className:`px-4 py-2.5 font-mono`,style:{color:m.dim},children:e.credentialType}),(0,p.jsxs)(`td`,{className:`px-4 py-2.5 font-mono`,style:{color:m.accent},children:[e.rotationIntervalHrs,`h`]}),(0,p.jsx)(`td`,{className:`px-4 py-2.5 font-mono`,style:{color:m.dim},children:e.lastRotation===`—`?`—`:new Date(e.lastRotation).toLocaleTimeString()}),(0,p.jsx)(`td`,{className:`px-4 py-2.5 font-mono`,style:{color:m.accent},children:e.nextRotation===`—`?`—`:new Date(e.nextRotation).toLocaleTimeString()}),(0,p.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 rounded`,style:{background:`${h[e.status]}15`,color:h[e.status]},children:e.status})})]},e.id))})]})})]}),e===`mcp-matrix`&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{children:`MCP Token Scope Matrix`}),(0,p.jsx)(`p`,{className:`text-xs mb-4`,style:{color:m.dim},children:`Every MCP tool server token is scoped to specific capabilities. Agents can only invoke tools within their granted scopes. No wildcard access permitted.`}),(0,p.jsx)(`div`,{className:`space-y-3 mb-8`,children:D.filter(e=>e.mcpTokens>0).map(e=>(0,p.jsxs)(a,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{style:{color:h[e.status]},children:g[e.type]}),(0,p.jsx)(`span`,{className:`text-xs font-medium`,style:{color:m.text},children:e.name}),(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 rounded`,style:{background:`${_[e.privilegeLevel]}15`,color:_[e.privilegeLevel]},children:e.privilegeLevel})]}),(0,p.jsxs)(`span`,{className:`text-[10px] font-mono`,style:{color:m.accent},children:[e.mcpTokens,` tokens`]})]}),(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.mcpScopes.map(e=>(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-2 py-1 rounded`,style:{background:`rgba(201,183,135,0.06)`,border:`1px solid rgba(201,183,135,0.12)`,color:m.accent},children:e},e))})]},e.id))}),(0,p.jsxs)(a,{children:[(0,p.jsx)(`div`,{className:`text-[9px] font-mono uppercase tracking-widest mb-3`,style:{color:m.muted},children:`LEAST-PRIVILEGE ENFORCEMENT`}),(0,p.jsx)(`div`,{className:`space-y-2 text-[10px]`,children:[{rule:`No wildcard MCP scopes — every tool call requires explicit scope grant`,status:`enforced`},{rule:`Agent privilege cannot exceed its credential type ceiling`,status:`enforced`},{rule:`Cross-agent tool sharing requires bilateral scope approval`,status:`enforced`},{rule:`Elevated privileges auto-expire after 4 hours without renewal`,status:`enforced`},{rule:`Human admin required for any privilege elevation request`,status:`enforced`},{rule:`All scope changes logged to Proof Ledger with cryptographic hash`,status:`enforced`}].map(e=>(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{style:{color:m.accent},children:`✓`}),(0,p.jsx)(`span`,{style:{color:m.dim},children:e.rule})]},e.rule))})]})]}),e===`anomalies`&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{children:`Behavioral Anomaly Timeline`}),(0,p.jsx)(`p`,{className:`text-xs mb-4`,style:{color:m.dim},children:`Continuous behavioral fingerprinting detects identity anomalies — credential replay, scope escalation attempts, behavioral pattern mismatches, and unverified agent registration.`}),(0,p.jsx)(`div`,{className:`space-y-3 mb-8`,children:O.map(e=>(0,p.jsxs)(a,{style:{borderLeft:`3px solid ${v[e.severity]}`},children:[(0,p.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-mono`,style:{color:m.dim},children:e.id}),(0,p.jsx)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 rounded`,style:{background:`${v[e.severity]}18`,color:v[e.severity]},children:e.severity}),(0,p.jsx)(`span`,{className:`text-[9px] font-mono`,style:{color:m.muted},children:e.type})]}),(0,p.jsx)(`div`,{className:`text-xs font-medium mb-1`,style:{color:m.text},children:e.agentName}),(0,p.jsx)(`p`,{className:`text-[10px]`,style:{color:m.dim},children:e.description})]}),(0,p.jsx)(`div`,{className:`text-[9px] font-mono flex-shrink-0`,style:{color:m.muted},children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,p.jsxs)(`div`,{className:`p-2 rounded mt-2`,style:{background:`rgba(201,183,135,0.04)`,border:`1px solid rgba(201,183,135,0.1)`},children:[(0,p.jsx)(`span`,{className:`text-[9px] font-mono`,style:{color:m.accent},children:`ACTION:`}),(0,p.jsx)(`span`,{className:`text-[10px] ml-1.5`,style:{color:m.dim},children:e.action})]})]},e.id))})]}),(0,p.jsxs)(`div`,{className:`p-3 rounded-lg text-xs flex items-center gap-2`,style:{background:`rgba(201,183,135,0.04)`,border:`1px solid rgba(201,183,135,0.15)`,color:m.muted},children:[(0,p.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:m.accent}}),` Agent Zero Trust — every identity verified, every credential rotated, every scope enforced, every anomaly detected. No implicit trust.`]})]})]})}export{y as AgentZeroTrust}; |