Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/LogsAndThreats.jsx
Browse files
frontend/src/pages/LogsAndThreats.jsx
CHANGED
|
@@ -498,124 +498,128 @@ const LogsAndThreats = () => {
|
|
| 498 |
const activeSev = severityColorMap[sevKey] || severityColorMap.medium;
|
| 499 |
|
| 500 |
return (
|
| 501 |
-
<div className="fixed inset-0 bg-slate-950/80 backdrop-blur-md flex items-center justify-center p-
|
| 502 |
-
<div className={`bg-surface border border-outline-variant/80 rounded-2xl max-w-
|
| 503 |
|
| 504 |
{/* Header Banner */}
|
| 505 |
-
<div className="bg-surface-container-low p-
|
| 506 |
<button
|
| 507 |
onClick={() => setSelectedThreat(null)}
|
| 508 |
-
className="absolute top-
|
| 509 |
title="Close"
|
| 510 |
>
|
| 511 |
-
<X className="w-
|
| 512 |
</button>
|
| 513 |
|
| 514 |
-
<div className="flex items-center gap-2 flex-wrap mb-
|
| 515 |
-
<span className={`px-
|
| 516 |
-
<ShieldAlert className="w-3 h-3" />
|
| 517 |
-
{selectedThreat.severity}
|
| 518 |
</span>
|
| 519 |
-
<span className="bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 text-[
|
| 520 |
CVSS {selectedThreat.cvss}
|
| 521 |
</span>
|
| 522 |
-
<span className="bg-red-500/10 text-red-600 dark:text-red-400 text-[
|
| 523 |
-
<span className="w-
|
| 524 |
-
{selectedThreat.count} Detections
|
| 525 |
</span>
|
| 526 |
</div>
|
| 527 |
|
| 528 |
-
<h2 className="text-
|
| 529 |
{selectedThreat.title}
|
| 530 |
</h2>
|
| 531 |
</div>
|
| 532 |
|
| 533 |
-
{/* Modal Body:
|
| 534 |
-
<div className="p-
|
| 535 |
|
| 536 |
-
{/* Top Row: Category & OWASP */}
|
| 537 |
-
<div className="grid grid-cols-2 gap-
|
| 538 |
-
<div className="bg-surface-container-lowest p-
|
| 539 |
-
<
|
|
|
|
|
|
|
| 540 |
<div className="truncate">
|
| 541 |
-
<span className="text-[
|
| 542 |
-
<span className="font-bold text-on-surface text-
|
| 543 |
</div>
|
| 544 |
</div>
|
| 545 |
|
| 546 |
-
<div className="bg-surface-container-lowest p-
|
| 547 |
-
<
|
|
|
|
|
|
|
| 548 |
<div className="truncate">
|
| 549 |
-
<span className="text-[
|
| 550 |
-
<span className="font-bold text-indigo-500 text-
|
| 551 |
</div>
|
| 552 |
</div>
|
| 553 |
</div>
|
| 554 |
|
| 555 |
-
{/* Middle Grid: Overview &
|
| 556 |
-
<div className="grid grid-cols-1 sm:grid-cols-2 gap-
|
| 557 |
-
<div className="bg-surface-container-lowest p-
|
| 558 |
-
<h3 className="font-bold text-on-surface text-
|
| 559 |
-
<Shield className="w-
|
| 560 |
</h3>
|
| 561 |
-
<p className="text-on-surface-variant leading-
|
| 562 |
{selectedThreat.description}
|
| 563 |
</p>
|
| 564 |
</div>
|
| 565 |
|
| 566 |
-
<div className="bg-surface-container-lowest p-
|
| 567 |
-
<h3 className="font-bold text-amber-600 dark:text-amber-400 text-
|
| 568 |
-
<AlertTriangle className="w-
|
| 569 |
</h3>
|
| 570 |
-
<p className="text-on-surface-variant leading-
|
| 571 |
{selectedThreat.impact}
|
| 572 |
</p>
|
| 573 |
</div>
|
| 574 |
</div>
|
| 575 |
|
| 576 |
-
{/* Code Remediation Box */}
|
| 577 |
-
<div className="bg-surface-container-lowest rounded-
|
| 578 |
-
<div className="bg-surface-container-high/60 px-
|
| 579 |
-
<h3 className="font-bold text-on-surface text-
|
| 580 |
-
<Terminal className="w-3 h-3 text-green-500" /> Recommended Fix
|
| 581 |
</h3>
|
| 582 |
|
| 583 |
<button
|
| 584 |
onClick={() => copyToClipboard(selectedThreat.remediation)}
|
| 585 |
-
className="flex items-center gap-1 px-
|
| 586 |
>
|
| 587 |
-
{copiedCode ? <Check className="w-3 h-3 text-green-500" /> : <Copy className="w-3 h-3 text-primary" />}
|
| 588 |
-
{copiedCode ? 'Copied' : 'Copy'}
|
| 589 |
</button>
|
| 590 |
</div>
|
| 591 |
|
| 592 |
-
<div className="bg-[#090d16] text-[#38bdf8] font-mono text-[
|
| 593 |
{selectedThreat.remediation}
|
| 594 |
</div>
|
| 595 |
</div>
|
| 596 |
|
| 597 |
-
{/* Affected Endpoints */}
|
| 598 |
{selectedThreat.affected_targets && selectedThreat.affected_targets.length > 0 && (
|
| 599 |
-
<div className="bg-surface-container-lowest p-
|
| 600 |
-
<h3 className="font-bold text-on-surface text-
|
| 601 |
-
<ExternalLink className="w-3 h-3 text-primary" /> Affected
|
| 602 |
</h3>
|
| 603 |
-
<div className="flex flex-wrap gap-
|
| 604 |
-
{selectedThreat.affected_targets.slice(0,
|
| 605 |
<a
|
| 606 |
key={idx}
|
| 607 |
href={url}
|
| 608 |
target="_blank"
|
| 609 |
rel="noopener noreferrer"
|
| 610 |
-
className="bg-surface-container border border-outline-variant/70 text-on-surface font-mono text-
|
| 611 |
>
|
| 612 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500"></span>
|
| 613 |
{url}
|
| 614 |
</a>
|
| 615 |
))}
|
| 616 |
-
{selectedThreat.affected_targets.length >
|
| 617 |
-
<span className="bg-surface-container text-on-surface-variant font-mono text-
|
| 618 |
-
+{selectedThreat.affected_targets.length -
|
| 619 |
</span>
|
| 620 |
)}
|
| 621 |
</div>
|
|
@@ -623,25 +627,25 @@ const LogsAndThreats = () => {
|
|
| 623 |
)}
|
| 624 |
</div>
|
| 625 |
|
| 626 |
-
{/*
|
| 627 |
-
<div className="p-
|
| 628 |
<button
|
| 629 |
onClick={() => {
|
| 630 |
const query = selectedThreat.title;
|
| 631 |
setSelectedThreat(null);
|
| 632 |
openFullLogsView(query);
|
| 633 |
}}
|
| 634 |
-
className="px-
|
| 635 |
>
|
| 636 |
-
<Search className="w-
|
| 637 |
Filter Audit Logs for this Threat
|
| 638 |
</button>
|
| 639 |
|
| 640 |
<button
|
| 641 |
onClick={() => setSelectedThreat(null)}
|
| 642 |
-
className="px-
|
| 643 |
>
|
| 644 |
-
Close
|
| 645 |
</button>
|
| 646 |
</div>
|
| 647 |
</div>
|
|
|
|
| 498 |
const activeSev = severityColorMap[sevKey] || severityColorMap.medium;
|
| 499 |
|
| 500 |
return (
|
| 501 |
+
<div className="fixed inset-0 bg-slate-950/80 backdrop-blur-md flex items-center justify-center p-4 sm:p-6 z-[9999] animate-fade-in overflow-hidden">
|
| 502 |
+
<div className={`bg-surface border border-outline-variant/80 rounded-2xl max-w-3xl lg:max-w-4xl w-full shadow-2xl relative overflow-hidden flex flex-col transition-all duration-200 transform animate-in fade-in zoom-in-95 border-t-4 ${activeSev.border}`}>
|
| 503 |
|
| 504 |
{/* Header Banner */}
|
| 505 |
+
<div className="bg-surface-container-low p-4 sm:p-5 px-5 sm:px-6 border-b border-outline-variant/70 relative">
|
| 506 |
<button
|
| 507 |
onClick={() => setSelectedThreat(null)}
|
| 508 |
+
className="absolute top-4 right-4 text-on-surface-variant hover:text-on-surface bg-surface-container-high p-1.5 rounded-full transition-all cursor-pointer border border-outline-variant/60 hover:scale-105"
|
| 509 |
title="Close"
|
| 510 |
>
|
| 511 |
+
<X className="w-5 h-5" />
|
| 512 |
</button>
|
| 513 |
|
| 514 |
+
<div className="flex items-center gap-2.5 flex-wrap mb-2 pr-10">
|
| 515 |
+
<span className={`px-3 py-1 rounded-md text-[11px] font-black uppercase tracking-wider border flex items-center gap-1.5 ${getSeverityBadgeClass(selectedThreat.severity)}`}>
|
| 516 |
+
<ShieldAlert className="w-3.5 h-3.5" />
|
| 517 |
+
{selectedThreat.severity} SEVERITY
|
| 518 |
</span>
|
| 519 |
+
<span className="bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 text-[11px] font-black px-3 py-1 rounded-md border border-cyan-500/30 font-mono">
|
| 520 |
CVSS {selectedThreat.cvss}
|
| 521 |
</span>
|
| 522 |
+
<span className="bg-red-500/10 text-red-600 dark:text-red-400 text-[11px] font-black px-3 py-1 rounded-md border border-red-500/30 flex items-center gap-1.5">
|
| 523 |
+
<span className="w-2 h-2 rounded-full bg-red-500 animate-pulse"></span>
|
| 524 |
+
{selectedThreat.count} Detections Recorded
|
| 525 |
</span>
|
| 526 |
</div>
|
| 527 |
|
| 528 |
+
<h2 className="text-xl sm:text-2xl font-extrabold text-on-surface tracking-tight leading-snug font-display">
|
| 529 |
{selectedThreat.title}
|
| 530 |
</h2>
|
| 531 |
</div>
|
| 532 |
|
| 533 |
+
{/* Modal Body: Spacious Executive View (Zero Scrollbar) */}
|
| 534 |
+
<div className="p-4 sm:p-5 px-5 sm:px-6 space-y-3.5 text-sm bg-surface overflow-hidden">
|
| 535 |
|
| 536 |
+
{/* Top Row: Category & OWASP Standard Badges */}
|
| 537 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
|
| 538 |
+
<div className="bg-surface-container-lowest p-3 px-4 rounded-xl border border-outline-variant/60 flex items-center gap-3">
|
| 539 |
+
<div className="w-8 h-8 rounded-lg bg-primary/10 text-primary flex items-center justify-center shrink-0">
|
| 540 |
+
<Layers className="w-4 h-4" />
|
| 541 |
+
</div>
|
| 542 |
<div className="truncate">
|
| 543 |
+
<span className="text-[10.5px] font-bold text-on-surface-variant uppercase tracking-wider block leading-none mb-1">Vulnerability Category</span>
|
| 544 |
+
<span className="font-bold text-on-surface text-sm truncate block">{selectedThreat.category}</span>
|
| 545 |
</div>
|
| 546 |
</div>
|
| 547 |
|
| 548 |
+
<div className="bg-surface-container-lowest p-3 px-4 rounded-xl border border-outline-variant/60 flex items-center gap-3">
|
| 549 |
+
<div className="w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-500 flex items-center justify-center shrink-0">
|
| 550 |
+
<Shield className="w-4 h-4" />
|
| 551 |
+
</div>
|
| 552 |
<div className="truncate">
|
| 553 |
+
<span className="text-[10.5px] font-bold text-on-surface-variant uppercase tracking-wider block leading-none mb-1">OWASP Standard</span>
|
| 554 |
+
<span className="font-bold text-indigo-500 text-sm truncate block">{selectedThreat.owasp}</span>
|
| 555 |
</div>
|
| 556 |
</div>
|
| 557 |
</div>
|
| 558 |
|
| 559 |
+
{/* Middle Grid: Threat Overview & Exploitation Risk */}
|
| 560 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
|
| 561 |
+
<div className="bg-surface-container-lowest p-3.5 px-4 rounded-xl border-l-4 border-l-primary border border-outline-variant/60">
|
| 562 |
+
<h3 className="font-bold text-on-surface text-sm mb-1.5 flex items-center gap-2">
|
| 563 |
+
<Shield className="w-4 h-4 text-primary" /> Threat Overview
|
| 564 |
</h3>
|
| 565 |
+
<p className="text-on-surface-variant leading-relaxed text-[12.5px] sm:text-[13px] line-clamp-3">
|
| 566 |
{selectedThreat.description}
|
| 567 |
</p>
|
| 568 |
</div>
|
| 569 |
|
| 570 |
+
<div className="bg-surface-container-lowest p-3.5 px-4 rounded-xl border-l-4 border-l-amber-500 border border-outline-variant/60">
|
| 571 |
+
<h3 className="font-bold text-amber-600 dark:text-amber-400 text-sm mb-1.5 flex items-center gap-2">
|
| 572 |
+
<AlertTriangle className="w-4 h-4" /> Exploitation & Impact Risk
|
| 573 |
</h3>
|
| 574 |
+
<p className="text-on-surface-variant leading-relaxed text-[12.5px] sm:text-[13px] line-clamp-3">
|
| 575 |
{selectedThreat.impact}
|
| 576 |
</p>
|
| 577 |
</div>
|
| 578 |
</div>
|
| 579 |
|
| 580 |
+
{/* Code Remediation Terminal Box */}
|
| 581 |
+
<div className="bg-surface-container-lowest rounded-xl border border-outline-variant/60 overflow-hidden">
|
| 582 |
+
<div className="bg-surface-container-high/60 px-3.5 py-1.5 border-b border-outline-variant/60 flex items-center justify-between">
|
| 583 |
+
<h3 className="font-bold text-on-surface text-xs flex items-center gap-2 font-mono">
|
| 584 |
+
<Terminal className="w-3.5 h-3.5 text-green-500" /> Recommended Security Fix
|
| 585 |
</h3>
|
| 586 |
|
| 587 |
<button
|
| 588 |
onClick={() => copyToClipboard(selectedThreat.remediation)}
|
| 589 |
+
className="flex items-center gap-1.5 px-2.5 py-1 bg-surface-container hover:bg-surface-container-highest text-on-surface rounded-md text-xs font-bold border border-outline-variant/70 cursor-pointer transition-all active:scale-95 shadow-2xs"
|
| 590 |
>
|
| 591 |
+
{copiedCode ? <Check className="w-3.5 h-3.5 text-green-500" /> : <Copy className="w-3.5 h-3.5 text-primary" />}
|
| 592 |
+
{copiedCode ? 'Copied' : 'Copy Code Snippet'}
|
| 593 |
</button>
|
| 594 |
</div>
|
| 595 |
|
| 596 |
+
<div className="bg-[#090d16] text-[#38bdf8] font-mono text-[12px] p-3 leading-relaxed whitespace-pre-wrap max-h-20 overflow-hidden">
|
| 597 |
{selectedThreat.remediation}
|
| 598 |
</div>
|
| 599 |
</div>
|
| 600 |
|
| 601 |
+
{/* Affected Target Endpoints */}
|
| 602 |
{selectedThreat.affected_targets && selectedThreat.affected_targets.length > 0 && (
|
| 603 |
+
<div className="bg-surface-container-lowest p-3 px-4 rounded-xl border border-outline-variant/60">
|
| 604 |
+
<h3 className="font-bold text-on-surface text-xs mb-1.5 flex items-center gap-2">
|
| 605 |
+
<ExternalLink className="w-3.5 h-3.5 text-primary" /> Affected Target Endpoints ({selectedThreat.affected_targets.length})
|
| 606 |
</h3>
|
| 607 |
+
<div className="flex flex-wrap gap-2">
|
| 608 |
+
{selectedThreat.affected_targets.slice(0, 4).map((url, idx) => (
|
| 609 |
<a
|
| 610 |
key={idx}
|
| 611 |
href={url}
|
| 612 |
target="_blank"
|
| 613 |
rel="noopener noreferrer"
|
| 614 |
+
className="bg-surface-container border border-outline-variant/70 hover:border-primary text-on-surface font-mono text-xs px-2.5 py-1 rounded-md flex items-center gap-1.5 transition-all"
|
| 615 |
>
|
| 616 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500"></span>
|
| 617 |
{url}
|
| 618 |
</a>
|
| 619 |
))}
|
| 620 |
+
{selectedThreat.affected_targets.length > 4 && (
|
| 621 |
+
<span className="bg-surface-container text-on-surface-variant font-mono text-xs px-2.5 py-1 rounded-md font-bold">
|
| 622 |
+
+{selectedThreat.affected_targets.length - 4} more
|
| 623 |
</span>
|
| 624 |
)}
|
| 625 |
</div>
|
|
|
|
| 627 |
)}
|
| 628 |
</div>
|
| 629 |
|
| 630 |
+
{/* Actions Footer */}
|
| 631 |
+
<div className="p-3.5 px-5 sm:px-6 bg-surface-container-lowest border-t border-outline-variant/70 flex items-center justify-between flex-wrap gap-3">
|
| 632 |
<button
|
| 633 |
onClick={() => {
|
| 634 |
const query = selectedThreat.title;
|
| 635 |
setSelectedThreat(null);
|
| 636 |
openFullLogsView(query);
|
| 637 |
}}
|
| 638 |
+
className="px-4 py-2 bg-primary/10 hover:bg-primary/20 text-primary border border-primary/30 rounded-xl font-bold text-xs sm:text-sm flex items-center gap-2 cursor-pointer transition-all active:scale-95"
|
| 639 |
>
|
| 640 |
+
<Search className="w-4 h-4" />
|
| 641 |
Filter Audit Logs for this Threat
|
| 642 |
</button>
|
| 643 |
|
| 644 |
<button
|
| 645 |
onClick={() => setSelectedThreat(null)}
|
| 646 |
+
className="px-6 py-2 bg-primary text-white hover:brightness-110 rounded-xl font-bold text-xs sm:text-sm cursor-pointer border-0 shadow-md shadow-primary/20 transition-all active:scale-95"
|
| 647 |
>
|
| 648 |
+
Close Diagnostic Window
|
| 649 |
</button>
|
| 650 |
</div>
|
| 651 |
</div>
|