Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/LogsAndThreats.jsx
Browse files
frontend/src/pages/LogsAndThreats.jsx
CHANGED
|
@@ -533,14 +533,14 @@ ${threat.affected_targets.join('\n')}`;
|
|
| 533 |
const activeSev = severityColorMap[sevKey] || severityColorMap.medium;
|
| 534 |
|
| 535 |
return (
|
| 536 |
-
<div className="fixed inset-0 bg-slate-950/
|
| 537 |
-
<div className={`bg-
|
| 538 |
|
| 539 |
{/* Header Banner */}
|
| 540 |
-
<div className="bg-
|
| 541 |
<button
|
| 542 |
onClick={() => setSelectedThreat(null)}
|
| 543 |
-
className="absolute top-4 right-4 text-
|
| 544 |
title="Close"
|
| 545 |
>
|
| 546 |
<X className="w-5 h-5" />
|
|
@@ -551,109 +551,109 @@ ${threat.affected_targets.join('\n')}`;
|
|
| 551 |
<ShieldAlert className="w-3.5 h-3.5" />
|
| 552 |
{selectedThreat.severity} SEVERITY
|
| 553 |
</span>
|
| 554 |
-
<span className="bg-cyan-500/10 text-cyan-
|
| 555 |
CVSS {selectedThreat.cvss}
|
| 556 |
</span>
|
| 557 |
-
<span className="bg-purple-500/10 text-purple-
|
| 558 |
{selectedThreat.cwe}
|
| 559 |
</span>
|
| 560 |
-
<span className="bg-emerald-500/10 text-emerald-
|
| 561 |
<Clock className="w-3 h-3" />
|
| 562 |
{selectedThreat.sla}
|
| 563 |
</span>
|
| 564 |
-
<span className="bg-red-500/10 text-red-
|
| 565 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"></span>
|
| 566 |
{selectedThreat.count} Detections
|
| 567 |
</span>
|
| 568 |
</div>
|
| 569 |
|
| 570 |
-
<h2 className="text-xl sm:text-2xl font-extrabold text-
|
| 571 |
{selectedThreat.title}
|
| 572 |
</h2>
|
| 573 |
</div>
|
| 574 |
|
| 575 |
{/* Modal Body: Spacious Executive View (Zero Scrollbar) */}
|
| 576 |
-
<div className="p-4 sm:p-5 px-5 sm:px-6 space-y-3.5 text-sm bg-
|
| 577 |
|
| 578 |
{/* Top Row: Category, OWASP Standard & Attack Vector Badges */}
|
| 579 |
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
| 580 |
-
<div className="bg-
|
| 581 |
-
<div className="w-7 h-7 rounded-lg bg-primary/
|
| 582 |
<Layers className="w-3.5 h-3.5" />
|
| 583 |
</div>
|
| 584 |
<div className="truncate">
|
| 585 |
-
<span className="text-[9.5px] font-bold text-
|
| 586 |
-
<span className="font-bold text-
|
| 587 |
</div>
|
| 588 |
</div>
|
| 589 |
|
| 590 |
-
<div className="bg-
|
| 591 |
-
<div className="w-7 h-7 rounded-lg bg-indigo-500/
|
| 592 |
<Shield className="w-3.5 h-3.5" />
|
| 593 |
</div>
|
| 594 |
<div className="truncate">
|
| 595 |
-
<span className="text-[9.5px] font-bold text-
|
| 596 |
-
<span className="font-bold text-indigo-
|
| 597 |
</div>
|
| 598 |
</div>
|
| 599 |
|
| 600 |
-
<div className="bg-
|
| 601 |
-
<div className="w-7 h-7 rounded-lg bg-rose-500/
|
| 602 |
<Radio className="w-3.5 h-3.5" />
|
| 603 |
</div>
|
| 604 |
<div className="truncate">
|
| 605 |
-
<span className="text-[9.5px] font-bold text-
|
| 606 |
-
<span className="font-bold text-rose-
|
| 607 |
</div>
|
| 608 |
</div>
|
| 609 |
</div>
|
| 610 |
|
| 611 |
{/* Middle Grid: Threat Overview & Exploitation Risk */}
|
| 612 |
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
|
| 613 |
-
<div className="bg-
|
| 614 |
-
<h3 className="font-bold text-
|
| 615 |
<Shield className="w-3.5 h-3.5 text-primary" /> Threat Overview
|
| 616 |
</h3>
|
| 617 |
-
<p className="text-
|
| 618 |
{selectedThreat.description}
|
| 619 |
</p>
|
| 620 |
</div>
|
| 621 |
|
| 622 |
-
<div className="bg-
|
| 623 |
-
<h3 className="font-bold text-amber-
|
| 624 |
<AlertTriangle className="w-3.5 h-3.5" /> Exploitation & Impact Risk
|
| 625 |
</h3>
|
| 626 |
-
<p className="text-
|
| 627 |
{selectedThreat.impact}
|
| 628 |
</p>
|
| 629 |
</div>
|
| 630 |
</div>
|
| 631 |
|
| 632 |
{/* Code Remediation Terminal Box */}
|
| 633 |
-
<div className="bg-
|
| 634 |
-
<div className="bg-
|
| 635 |
-
<h3 className="font-bold text-
|
| 636 |
-
<Terminal className="w-3.5 h-3.5 text-green-
|
| 637 |
</h3>
|
| 638 |
|
| 639 |
<button
|
| 640 |
onClick={() => copyToClipboard(selectedThreat.remediation)}
|
| 641 |
-
className="flex items-center gap-1.5 px-2.5 py-1 bg-
|
| 642 |
>
|
| 643 |
-
{copiedCode ? <Check className="w-3.5 h-3.5 text-green-
|
| 644 |
{copiedCode ? 'Copied' : 'Copy Code Snippet'}
|
| 645 |
</button>
|
| 646 |
</div>
|
| 647 |
|
| 648 |
-
<div className="bg-[#
|
| 649 |
{selectedThreat.remediation}
|
| 650 |
</div>
|
| 651 |
</div>
|
| 652 |
|
| 653 |
{/* Affected Target Endpoints */}
|
| 654 |
{selectedThreat.affected_targets && selectedThreat.affected_targets.length > 0 && (
|
| 655 |
-
<div className="bg-
|
| 656 |
-
<h3 className="font-bold text-
|
| 657 |
<ExternalLink className="w-3.5 h-3.5 text-primary" /> Affected Target Endpoints ({selectedThreat.affected_targets.length})
|
| 658 |
</h3>
|
| 659 |
<div className="flex flex-wrap gap-1.5">
|
|
@@ -663,14 +663,14 @@ ${threat.affected_targets.join('\n')}`;
|
|
| 663 |
href={url}
|
| 664 |
target="_blank"
|
| 665 |
rel="noopener noreferrer"
|
| 666 |
-
className="bg-
|
| 667 |
>
|
| 668 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500"></span>
|
| 669 |
{url}
|
| 670 |
</a>
|
| 671 |
))}
|
| 672 |
{selectedThreat.affected_targets.length > 4 && (
|
| 673 |
-
<span className="bg-
|
| 674 |
+{selectedThreat.affected_targets.length - 4} more
|
| 675 |
</span>
|
| 676 |
)}
|
|
@@ -680,14 +680,14 @@ ${threat.affected_targets.join('\n')}`;
|
|
| 680 |
</div>
|
| 681 |
|
| 682 |
{/* Actions Footer */}
|
| 683 |
-
<div className="p-3 px-5 sm:px-6 bg-
|
| 684 |
<button
|
| 685 |
onClick={() => {
|
| 686 |
const query = selectedThreat.title;
|
| 687 |
setSelectedThreat(null);
|
| 688 |
openFullLogsView(query);
|
| 689 |
}}
|
| 690 |
-
className="px-3.5 py-1.5 bg-primary/
|
| 691 |
>
|
| 692 |
<Search className="w-4 h-4" />
|
| 693 |
Filter Audit Logs for this Threat
|
|
@@ -696,16 +696,16 @@ ${threat.affected_targets.join('\n')}`;
|
|
| 696 |
<div className="flex items-center gap-2">
|
| 697 |
<button
|
| 698 |
onClick={() => copyBriefToClipboard(selectedThreat)}
|
| 699 |
-
className="px-3.5 py-1.5 bg-
|
| 700 |
title="Copy Executive Threat Brief to Clipboard"
|
| 701 |
>
|
| 702 |
-
{copiedBrief ? <Check className="w-4 h-4 text-green-
|
| 703 |
{copiedBrief ? 'Brief Copied!' : 'Copy Threat Brief'}
|
| 704 |
</button>
|
| 705 |
|
| 706 |
<button
|
| 707 |
onClick={() => setSelectedThreat(null)}
|
| 708 |
-
className="px-5 py-1.5 bg-primary text-white hover:brightness-110 rounded-xl font-bold text-xs sm:text-sm cursor-pointer border-0 shadow-md shadow-primary/
|
| 709 |
>
|
| 710 |
Close Window
|
| 711 |
</button>
|
|
|
|
| 533 |
const activeSev = severityColorMap[sevKey] || severityColorMap.medium;
|
| 534 |
|
| 535 |
return (
|
| 536 |
+
<div className="fixed inset-0 bg-slate-950/85 backdrop-blur-md flex items-center justify-center p-4 sm:p-6 z-[9999] animate-fade-in overflow-hidden">
|
| 537 |
+
<div className={`bg-[#0b0f1a] text-slate-100 border border-slate-800 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}`}>
|
| 538 |
|
| 539 |
{/* Header Banner */}
|
| 540 |
+
<div className="bg-[#111827]/90 p-4 sm:p-5 px-5 sm:px-6 border-b border-slate-800/80 relative">
|
| 541 |
<button
|
| 542 |
onClick={() => setSelectedThreat(null)}
|
| 543 |
+
className="absolute top-4 right-4 text-slate-400 hover:text-white bg-[#1e293b] p-1.5 rounded-full transition-all cursor-pointer border border-slate-700 hover:scale-105"
|
| 544 |
title="Close"
|
| 545 |
>
|
| 546 |
<X className="w-5 h-5" />
|
|
|
|
| 551 |
<ShieldAlert className="w-3.5 h-3.5" />
|
| 552 |
{selectedThreat.severity} SEVERITY
|
| 553 |
</span>
|
| 554 |
+
<span className="bg-cyan-500/10 text-cyan-400 text-[11px] font-black px-2.5 py-0.5 rounded-md border border-cyan-500/30 font-mono">
|
| 555 |
CVSS {selectedThreat.cvss}
|
| 556 |
</span>
|
| 557 |
+
<span className="bg-purple-500/10 text-purple-400 text-[11px] font-black px-2.5 py-0.5 rounded-md border border-purple-500/30 font-mono">
|
| 558 |
{selectedThreat.cwe}
|
| 559 |
</span>
|
| 560 |
+
<span className="bg-emerald-500/10 text-emerald-400 text-[11px] font-black px-2.5 py-0.5 rounded-md border border-emerald-500/30 flex items-center gap-1">
|
| 561 |
<Clock className="w-3 h-3" />
|
| 562 |
{selectedThreat.sla}
|
| 563 |
</span>
|
| 564 |
+
<span className="bg-red-500/10 text-red-400 text-[11px] font-black px-2.5 py-0.5 rounded-md border border-red-500/30 flex items-center gap-1">
|
| 565 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"></span>
|
| 566 |
{selectedThreat.count} Detections
|
| 567 |
</span>
|
| 568 |
</div>
|
| 569 |
|
| 570 |
+
<h2 className="text-xl sm:text-2xl font-extrabold text-white tracking-tight leading-snug font-display">
|
| 571 |
{selectedThreat.title}
|
| 572 |
</h2>
|
| 573 |
</div>
|
| 574 |
|
| 575 |
{/* Modal Body: Spacious Executive View (Zero Scrollbar) */}
|
| 576 |
+
<div className="p-4 sm:p-5 px-5 sm:px-6 space-y-3.5 text-sm bg-[#0b0f1a] overflow-hidden">
|
| 577 |
|
| 578 |
{/* Top Row: Category, OWASP Standard & Attack Vector Badges */}
|
| 579 |
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
| 580 |
+
<div className="bg-[#131c2e] p-2.5 px-3 rounded-xl border border-slate-800 flex items-center gap-2.5">
|
| 581 |
+
<div className="w-7 h-7 rounded-lg bg-primary/20 text-primary flex items-center justify-center shrink-0">
|
| 582 |
<Layers className="w-3.5 h-3.5" />
|
| 583 |
</div>
|
| 584 |
<div className="truncate">
|
| 585 |
+
<span className="text-[9.5px] font-bold text-slate-400 uppercase tracking-wider block leading-none mb-0.5">Category</span>
|
| 586 |
+
<span className="font-bold text-slate-100 text-[12px] truncate block">{selectedThreat.category}</span>
|
| 587 |
</div>
|
| 588 |
</div>
|
| 589 |
|
| 590 |
+
<div className="bg-[#131c2e] p-2.5 px-3 rounded-xl border border-slate-800 flex items-center gap-2.5">
|
| 591 |
+
<div className="w-7 h-7 rounded-lg bg-indigo-500/20 text-indigo-400 flex items-center justify-center shrink-0">
|
| 592 |
<Shield className="w-3.5 h-3.5" />
|
| 593 |
</div>
|
| 594 |
<div className="truncate">
|
| 595 |
+
<span className="text-[9.5px] font-bold text-slate-400 uppercase tracking-wider block leading-none mb-0.5">OWASP Standard</span>
|
| 596 |
+
<span className="font-bold text-indigo-400 text-[12px] truncate block">{selectedThreat.owasp}</span>
|
| 597 |
</div>
|
| 598 |
</div>
|
| 599 |
|
| 600 |
+
<div className="bg-[#131c2e] p-2.5 px-3 rounded-xl border border-slate-800 flex items-center gap-2.5">
|
| 601 |
+
<div className="w-7 h-7 rounded-lg bg-rose-500/20 text-rose-400 flex items-center justify-center shrink-0">
|
| 602 |
<Radio className="w-3.5 h-3.5" />
|
| 603 |
</div>
|
| 604 |
<div className="truncate">
|
| 605 |
+
<span className="text-[9.5px] font-bold text-slate-400 uppercase tracking-wider block leading-none mb-0.5">Attack Vector</span>
|
| 606 |
+
<span className="font-bold text-rose-400 text-[12px] truncate block">{selectedThreat.attackVector}</span>
|
| 607 |
</div>
|
| 608 |
</div>
|
| 609 |
</div>
|
| 610 |
|
| 611 |
{/* Middle Grid: Threat Overview & Exploitation Risk */}
|
| 612 |
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
|
| 613 |
+
<div className="bg-[#131c2e] p-3 px-3.5 rounded-xl border-l-4 border-l-primary border border-slate-800">
|
| 614 |
+
<h3 className="font-bold text-slate-100 text-xs mb-1 flex items-center gap-1.5">
|
| 615 |
<Shield className="w-3.5 h-3.5 text-primary" /> Threat Overview
|
| 616 |
</h3>
|
| 617 |
+
<p className="text-slate-300 leading-relaxed text-[12px] line-clamp-3">
|
| 618 |
{selectedThreat.description}
|
| 619 |
</p>
|
| 620 |
</div>
|
| 621 |
|
| 622 |
+
<div className="bg-[#131c2e] p-3 px-3.5 rounded-xl border-l-4 border-l-amber-500 border border-slate-800">
|
| 623 |
+
<h3 className="font-bold text-amber-400 text-xs mb-1 flex items-center gap-1.5">
|
| 624 |
<AlertTriangle className="w-3.5 h-3.5" /> Exploitation & Impact Risk
|
| 625 |
</h3>
|
| 626 |
+
<p className="text-slate-300 leading-relaxed text-[12px] line-clamp-3">
|
| 627 |
{selectedThreat.impact}
|
| 628 |
</p>
|
| 629 |
</div>
|
| 630 |
</div>
|
| 631 |
|
| 632 |
{/* Code Remediation Terminal Box */}
|
| 633 |
+
<div className="bg-[#131c2e] rounded-xl border border-slate-800 overflow-hidden">
|
| 634 |
+
<div className="bg-[#1e293b]/70 px-3.5 py-1.5 border-b border-slate-800 flex items-center justify-between">
|
| 635 |
+
<h3 className="font-bold text-slate-200 text-xs flex items-center gap-2 font-mono">
|
| 636 |
+
<Terminal className="w-3.5 h-3.5 text-green-400" /> Recommended Security Fix
|
| 637 |
</h3>
|
| 638 |
|
| 639 |
<button
|
| 640 |
onClick={() => copyToClipboard(selectedThreat.remediation)}
|
| 641 |
+
className="flex items-center gap-1.5 px-2.5 py-1 bg-[#0f172a] hover:bg-slate-800 text-slate-200 rounded-md text-xs font-bold border border-slate-700 cursor-pointer transition-all active:scale-95 shadow-2xs"
|
| 642 |
>
|
| 643 |
+
{copiedCode ? <Check className="w-3.5 h-3.5 text-green-400" /> : <Copy className="w-3.5 h-3.5 text-primary" />}
|
| 644 |
{copiedCode ? 'Copied' : 'Copy Code Snippet'}
|
| 645 |
</button>
|
| 646 |
</div>
|
| 647 |
|
| 648 |
+
<div className="bg-[#030712] text-[#38bdf8] font-mono text-[11.5px] p-2.5 leading-relaxed whitespace-pre-wrap max-h-16 overflow-hidden">
|
| 649 |
{selectedThreat.remediation}
|
| 650 |
</div>
|
| 651 |
</div>
|
| 652 |
|
| 653 |
{/* Affected Target Endpoints */}
|
| 654 |
{selectedThreat.affected_targets && selectedThreat.affected_targets.length > 0 && (
|
| 655 |
+
<div className="bg-[#131c2e] p-2.5 px-3.5 rounded-xl border border-slate-800">
|
| 656 |
+
<h3 className="font-bold text-slate-200 text-xs mb-1 flex items-center gap-1.5">
|
| 657 |
<ExternalLink className="w-3.5 h-3.5 text-primary" /> Affected Target Endpoints ({selectedThreat.affected_targets.length})
|
| 658 |
</h3>
|
| 659 |
<div className="flex flex-wrap gap-1.5">
|
|
|
|
| 663 |
href={url}
|
| 664 |
target="_blank"
|
| 665 |
rel="noopener noreferrer"
|
| 666 |
+
className="bg-[#1e293b] border border-slate-700 hover:border-primary text-slate-200 font-mono text-[11px] px-2 py-0.5 rounded-md flex items-center gap-1 transition-all"
|
| 667 |
>
|
| 668 |
<span className="w-1.5 h-1.5 rounded-full bg-red-500"></span>
|
| 669 |
{url}
|
| 670 |
</a>
|
| 671 |
))}
|
| 672 |
{selectedThreat.affected_targets.length > 4 && (
|
| 673 |
+
<span className="bg-[#1e293b] text-slate-400 font-mono text-[11px] px-2 py-0.5 rounded-md font-bold border border-slate-700">
|
| 674 |
+{selectedThreat.affected_targets.length - 4} more
|
| 675 |
</span>
|
| 676 |
)}
|
|
|
|
| 680 |
</div>
|
| 681 |
|
| 682 |
{/* Actions Footer */}
|
| 683 |
+
<div className="p-3 px-5 sm:px-6 bg-[#111827] border-t border-slate-800/80 flex items-center justify-between flex-wrap gap-2.5">
|
| 684 |
<button
|
| 685 |
onClick={() => {
|
| 686 |
const query = selectedThreat.title;
|
| 687 |
setSelectedThreat(null);
|
| 688 |
openFullLogsView(query);
|
| 689 |
}}
|
| 690 |
+
className="px-3.5 py-1.5 bg-primary/20 hover:bg-primary/30 text-sky-400 border border-primary/40 rounded-xl font-bold text-xs sm:text-sm flex items-center gap-2 cursor-pointer transition-all active:scale-95"
|
| 691 |
>
|
| 692 |
<Search className="w-4 h-4" />
|
| 693 |
Filter Audit Logs for this Threat
|
|
|
|
| 696 |
<div className="flex items-center gap-2">
|
| 697 |
<button
|
| 698 |
onClick={() => copyBriefToClipboard(selectedThreat)}
|
| 699 |
+
className="px-3.5 py-1.5 bg-[#1e293b] hover:bg-slate-700 text-slate-200 rounded-xl font-bold text-xs sm:text-sm cursor-pointer border border-slate-700 flex items-center gap-1.5 transition-all active:scale-95"
|
| 700 |
title="Copy Executive Threat Brief to Clipboard"
|
| 701 |
>
|
| 702 |
+
{copiedBrief ? <Check className="w-4 h-4 text-green-400" /> : <FileText className="w-4 h-4 text-sky-400" />}
|
| 703 |
{copiedBrief ? 'Brief Copied!' : 'Copy Threat Brief'}
|
| 704 |
</button>
|
| 705 |
|
| 706 |
<button
|
| 707 |
onClick={() => setSelectedThreat(null)}
|
| 708 |
+
className="px-5 py-1.5 bg-primary text-white hover:brightness-110 rounded-xl font-bold text-xs sm:text-sm cursor-pointer border-0 shadow-md shadow-primary/30 transition-all active:scale-95"
|
| 709 |
>
|
| 710 |
Close Window
|
| 711 |
</button>
|