@wallarm-org/design-system 4.10.0-rc-feat-parser.1 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/Badge/generateBadgeVariants.js +9 -28
- package/dist/components/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/components/Checkbox/CheckboxGroup.js +16 -13
- package/dist/components/CodeSnippet/internal/FoldToggle.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/Radio/RadioGroup.d.ts +2 -1
- package/dist/components/Radio/RadioGroup.js +16 -13
- package/dist/components/SimpleCharts/Chart/classes.js +1 -1
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.js +1 -1
- package/dist/components/SimpleCharts/Metric/classes.d.ts +2 -2
- package/dist/components/SimpleCharts/Metric/classes.js +2 -2
- package/dist/components/Table/TableBody/TableBodyCell.js +4 -1
- package/dist/guidelines/patterns/complex-drawer.md +1084 -0
- package/dist/guidelines/patterns/confirmation-dialogs.md +3 -11
- package/dist/guidelines/patterns/detail-drawer.md +31 -13
- package/dist/guidelines/patterns/empty-states.md +6 -5
- package/dist/guidelines/patterns/entity-table.md +25 -29
- package/dist/guidelines/patterns/feedback-toasts.md +3 -11
- package/dist/guidelines/patterns/resource-list-page.md +14 -16
- package/dist/guidelines/rules.md +6 -5
- package/dist/guidelines/templates/ai-assistant.md +1133 -0
- package/dist/guidelines/templates/api-inventory.md +905 -0
- package/dist/guidelines/templates/attack-events.md +2722 -0
- package/dist/guidelines/templates/incident-detail.md +2085 -0
- package/dist/guidelines/templates/integrations-settings.md +836 -0
- package/dist/guidelines/templates/page-states.md +798 -0
- package/dist/guidelines/templates/rule-editor.md +886 -0
- package/dist/guidelines/templates/security-dashboard.md +681 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/metadata/components.json +20 -108
- package/dist/metadata/guidelines.json +1204 -37
- package/dist/theme/tokens.test.ts +52 -0
- package/package.json +1 -4
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
- package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
- package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
- package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
- package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
- package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
- package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
- package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
- package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
- package/dist/components/Rules/PointSelector/classes.js +0 -22
- package/dist/components/Rules/PointSelector/index.d.ts +0 -20
- package/dist/components/Rules/PointSelector/index.js +0 -18
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
- package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
- package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
- package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
- package/dist/components/Rules/PointSelector/types.d.ts +0 -304
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
- package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
- package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
- package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/classes.js +0 -18
- package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
- package/dist/components/Rules/RuleBuilder/index.js +0 -11
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
- package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
- package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
- package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
- package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
- package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
- package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
|
@@ -0,0 +1,2722 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Attack events
|
|
3
|
+
description: Use when building a security event log - a filtered, sorted, paged table of detected attacks with bulk triage and a wide event drawer down to the raw request.
|
|
4
|
+
components: [Page, PageHeader, PageHeaderGroup, PageTitle, PageDescription, PageActions, PageToolbar, PageContent, FilterInput, Table, TableActionBar, TableEmptyState, Pagination, PaginationPageSize, PaginationPrevious, PaginationList, PaginationNext, Badge, HttpMethod, ResponseCode, Ip, IpCountry, IpAddress, IpProvider, FormatDateTime, Drawer, DrawerContent, DrawerHeader, DrawerBody, DrawerResizeHandle, Heading, Text, Tabs, TabsList, TabsTrigger, Tooltip, Attribute, AttributeLabel, AttributeValue, Chart, LineChart, BarList, PieChart, ScrollArea, InlineCodeSnippet, CodeSnippetRoot, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetCode, Separator, DropdownMenu, EmptyState, Tag, Button]
|
|
5
|
+
keywords: [attacks, events, event drawer, security events, event log, attack log, detections, threats, traffic log, requests, raw request, payload, block IP, triage, query builder, filter, pagination, bulk actions]
|
|
6
|
+
order: 20
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Attack events
|
|
10
|
+
|
|
11
|
+
A security event log: every attack the filtering nodes detected, narrowed with a query builder, triaged in bulk, and opened one at a time down to the raw HTTP request.
|
|
12
|
+
|
|
13
|
+
## What it shows
|
|
14
|
+
|
|
15
|
+
- The [Resource list page](../patterns/resource-list-page.md) frame with one outline "Export CSV" action and no create button: attacks are never created by hand.
|
|
16
|
+
- [Filtering](../patterns/filtering.md) with `FilterInput` alone in `PageToolbar`: attack type, severity and status with badge values, source IP, host, method, response code and date. Its `ExprNode` drives the rows.
|
|
17
|
+
- An [Entity table](../patterns/entity-table.md): two-line cells, severity and status `Badge`s, `HttpMethod`, `Ip` with flag and provider, `ResponseCode`, a header tooltip, the row menu in the master cell, `TableActionBar` triage (false positive, block source IPs, export) and server-style sorting (`manualSorting`) before paging.
|
|
18
|
+
- `Pagination` with a page-size picker under the table, in a `VStack gap={12}`.
|
|
19
|
+
- A [Complex drawer](../patterns/complex-drawer.md) for the attack, since one attack groups many hits: a summary line (status, blocked count, IPs across countries), Overview with the attribute card, a hits timeline, top IPs and status codes, and Requests with the list and the selected request. The full request marks the attack point with a red line and the payload in bold (`CodeSnippetRoot` `lines`).
|
|
20
|
+
- No-match, load-failed and first-load states from [Empty states](../patterns/empty-states.md).
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
The whole log: a severity filter applied, sorted by time, ten rows a page; tick rows for the bulk bar. Open a row (or "Open event" in its row menu) to see the complex drawer; on Requests, pick a request to see its payload highlighted in the full request.
|
|
25
|
+
|
|
26
|
+
The whole screen: a query-builder filter over a dense, sortable, paged table of attacks.
|
|
27
|
+
Severity and status are badges; the request, source IP and response code use the HTTP and IP
|
|
28
|
+
primitives. Tick rows to triage them from the bulk bar; click an attack to open its event
|
|
29
|
+
drawer: a summary header, Overview with attributes and charts, Requests with the raw request.
|
|
30
|
+
|
|
31
|
+
```tsx story=Default
|
|
32
|
+
import { type MouseEvent, useState } from 'react';
|
|
33
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
34
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
35
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
36
|
+
import { CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
37
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle } from '@wallarm-org/design-system/Drawer';
|
|
38
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
39
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
40
|
+
import { type ExprNode, FilterInput } from '@wallarm-org/design-system/FilterInput';
|
|
41
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
42
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
43
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
44
|
+
import { ArrowDown, CloudOff, Download, Ellipsis, FilterX, Link, RefreshCcw, SearchX, ShieldBan, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
45
|
+
import { Ip, IpAddress, IpCountry, IpProvider } from '@wallarm-org/design-system/Ip';
|
|
46
|
+
import { Page, PageActions, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle, PageToolbar } from '@wallarm-org/design-system/Page';
|
|
47
|
+
import { Pagination, PaginationList, PaginationNext, PaginationPageSize, PaginationPrevious, useClientPagination } from '@wallarm-org/design-system/Pagination';
|
|
48
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
49
|
+
import { ScrollArea, ScrollAreaContent, ScrollAreaScrollbar, ScrollAreaViewport } from '@wallarm-org/design-system/ScrollArea';
|
|
50
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
51
|
+
import { BarList, BarListBar, BarListItem, BarListLabel, BarListPercent, BarListValue, Chart, ChartHeader, ChartTitle, LegendDot, LineChart, LineChartBody, LineChartGrid, LineChartLine, LineChartTooltip, LineChartXAxis, LineChartYAxis, PieChart, PieChartCenter, PieChartCenterLabel, PieChartCenterValue, PieChartDonut, PieChartLegend, PieChartLegendItem, PieChartLegendPercent, PieChartLegendValue, useChartTimeFormatters } from '@wallarm-org/design-system/SimpleCharts';
|
|
52
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
53
|
+
import { type TableColumnDef, type TableRow, type TableRowSelectionState, type TableSortingState, Table, TableActionBar, TableEmptyState } from '@wallarm-org/design-system/Table';
|
|
54
|
+
import { Tabs, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
55
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
56
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
57
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
|
|
58
|
+
|
|
59
|
+
export const Default = ({
|
|
60
|
+
initialFilter = SEVERITY_FILTER,
|
|
61
|
+
isLoading = false,
|
|
62
|
+
loadFailed = false,
|
|
63
|
+
}) => {
|
|
64
|
+
const [filter, setFilter] = useState<ExprNode | null>(initialFilter);
|
|
65
|
+
const [sorting, setSorting] = useState<TableSortingState>([{ id: 'detectedAt', desc: true }]);
|
|
66
|
+
const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});
|
|
67
|
+
const [falsePositiveIds, setFalsePositiveIds] = useState<string[]>([]);
|
|
68
|
+
const [failed, setFailed] = useState(loadFailed);
|
|
69
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
70
|
+
const [open, setOpen] = useState(false);
|
|
71
|
+
const [tab, setTab] = useState('overview');
|
|
72
|
+
const [requestId, setRequestId] = useState<string | null>(null);
|
|
73
|
+
const { formatHour, formatHourWithTimezone } = useChartTimeFormatters();
|
|
74
|
+
|
|
75
|
+
const events = EVENTS.map(event =>
|
|
76
|
+
falsePositiveIds.includes(event.id) ? { ...event, status: 'false-positive' as const } : event,
|
|
77
|
+
);
|
|
78
|
+
const rows =
|
|
79
|
+
isLoading || failed
|
|
80
|
+
? []
|
|
81
|
+
: sortEvents(
|
|
82
|
+
events.filter(event => matchesFilter(event, filter)),
|
|
83
|
+
sorting,
|
|
84
|
+
);
|
|
85
|
+
const { pageData, ...pagination } = useClientPagination(rows, 10);
|
|
86
|
+
const selected = events.find(event => event.id === selectedId) ?? null;
|
|
87
|
+
const requests = selected ? getRequests(selected) : [];
|
|
88
|
+
const request = requests.find(item => item.id === requestId) ?? null;
|
|
89
|
+
const selectedIds = Object.keys(rowSelection).filter(id => rowSelection[id]);
|
|
90
|
+
|
|
91
|
+
const markFalsePositive = (ids: string[]) => setFalsePositiveIds([...falsePositiveIds, ...ids]);
|
|
92
|
+
const openEvent = (id: string) => {
|
|
93
|
+
setSelectedId(id);
|
|
94
|
+
setTab('overview');
|
|
95
|
+
setRequestId(null);
|
|
96
|
+
setOpen(true);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const renderMenuAction = (row: TableRow<AttackEvent>) => {
|
|
100
|
+
const event = row.original;
|
|
101
|
+
const handleOpen = () => openEvent(event.id);
|
|
102
|
+
const handleMarkFalsePositive = () => markFalsePositive([event.id]);
|
|
103
|
+
const handleBlockSource = () => onBlockSources([event.ip]);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<DropdownMenu>
|
|
107
|
+
<DropdownMenuTrigger asChild>
|
|
108
|
+
<Button
|
|
109
|
+
variant='ghost'
|
|
110
|
+
color='neutral'
|
|
111
|
+
size='small'
|
|
112
|
+
aria-label={`Actions for event ${event.id}`}
|
|
113
|
+
>
|
|
114
|
+
<Ellipsis />
|
|
115
|
+
</Button>
|
|
116
|
+
</DropdownMenuTrigger>
|
|
117
|
+
<DropdownMenuContent>
|
|
118
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
119
|
+
<DropdownMenuItemText>Open event</DropdownMenuItemText>
|
|
120
|
+
</DropdownMenuItem>
|
|
121
|
+
<DropdownMenuItem onSelect={handleMarkFalsePositive}>
|
|
122
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
123
|
+
</DropdownMenuItem>
|
|
124
|
+
<DropdownMenuSeparator />
|
|
125
|
+
<DropdownMenuItem variant='destructive' onSelect={handleBlockSource}>
|
|
126
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
127
|
+
</DropdownMenuItem>
|
|
128
|
+
</DropdownMenuContent>
|
|
129
|
+
</DropdownMenu>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const columns: TableColumnDef<AttackEvent>[] = [
|
|
134
|
+
{
|
|
135
|
+
accessorKey: 'attackType',
|
|
136
|
+
header: 'Attack',
|
|
137
|
+
size: 250,
|
|
138
|
+
cell: renderAttack,
|
|
139
|
+
meta: { renderMenuAction },
|
|
140
|
+
},
|
|
141
|
+
{ accessorKey: 'severity', header: 'Severity', size: 100, cell: renderSeverity },
|
|
142
|
+
{ accessorKey: 'status', header: 'Status', size: 130, cell: renderStatus },
|
|
143
|
+
{ accessorKey: 'path', header: 'Request', size: 280, cell: renderRequest },
|
|
144
|
+
{ accessorKey: 'ip', header: 'Source IP', size: 250, cell: renderSource },
|
|
145
|
+
{ accessorKey: 'code', header: 'Code', size: 80, cell: renderCode },
|
|
146
|
+
{
|
|
147
|
+
accessorKey: 'hits',
|
|
148
|
+
header: 'Hits',
|
|
149
|
+
size: 80,
|
|
150
|
+
meta: { description: { type: 'tooltip', content: 'Requests grouped into this attack' } },
|
|
151
|
+
},
|
|
152
|
+
{ accessorKey: 'detectedAt', header: 'Detected', size: 140, cell: renderDetectedAt },
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const handleResetFilters = () => setFilter(null);
|
|
156
|
+
const handleRetry = () => setFailed(false);
|
|
157
|
+
const handleBulkFalsePositive = () => {
|
|
158
|
+
markFalsePositive(selectedIds);
|
|
159
|
+
setRowSelection({});
|
|
160
|
+
};
|
|
161
|
+
const handleBulkBlock = () =>
|
|
162
|
+
onBlockSources(events.filter(event => rowSelection[event.id]).map(event => event.ip));
|
|
163
|
+
const handleBulkExport = () => onExportEvents(selectedIds);
|
|
164
|
+
const handleCopyLink = () => onCopyLink(selected?.id);
|
|
165
|
+
const handleSelectRequest = (event: MouseEvent<HTMLButtonElement>) =>
|
|
166
|
+
setRequestId(event.currentTarget.value);
|
|
167
|
+
const handleRequestFalsePositive = () => selected && markFalsePositive([selected.id]);
|
|
168
|
+
const handleRequestBlock = () => request && onBlockSources([request.source.ip]);
|
|
169
|
+
|
|
170
|
+
const sources = selected ? getSources(selected) : [];
|
|
171
|
+
const countries = new Set(sources.map(source => source.country)).size;
|
|
172
|
+
const ipShares = selected ? getIpShares(selected) : [];
|
|
173
|
+
const statusCodes = selected ? getStatusCodes(selected) : [];
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<Page name='attack-events' fullSize fixedHeight data-testid='attacks-page'>
|
|
177
|
+
<PageHeader>
|
|
178
|
+
<PageHeaderGroup className='flex-1'>
|
|
179
|
+
<PageTitle>Attack events</PageTitle>
|
|
180
|
+
<PageDescription>
|
|
181
|
+
Malicious requests the filtering nodes detected across your applications, and how each
|
|
182
|
+
was handled.
|
|
183
|
+
</PageDescription>
|
|
184
|
+
</PageHeaderGroup>
|
|
185
|
+
<PageActions>
|
|
186
|
+
<Button
|
|
187
|
+
size='medium'
|
|
188
|
+
variant='outline'
|
|
189
|
+
color='neutral'
|
|
190
|
+
onClick={onExportEvents}
|
|
191
|
+
data-testid='attacks-export'
|
|
192
|
+
>
|
|
193
|
+
<Download />
|
|
194
|
+
Export CSV
|
|
195
|
+
</Button>
|
|
196
|
+
</PageActions>
|
|
197
|
+
</PageHeader>
|
|
198
|
+
|
|
199
|
+
<PageToolbar>
|
|
200
|
+
<FilterInput
|
|
201
|
+
fields={FILTER_FIELDS}
|
|
202
|
+
value={filter}
|
|
203
|
+
onChange={setFilter}
|
|
204
|
+
placeholder='Filter by attack type, severity, status, source IP, host or date'
|
|
205
|
+
data-testid='attacks-filter'
|
|
206
|
+
/>
|
|
207
|
+
</PageToolbar>
|
|
208
|
+
|
|
209
|
+
<PageContent>
|
|
210
|
+
<VStack gap={12}>
|
|
211
|
+
<Table
|
|
212
|
+
aria-label='Attack events'
|
|
213
|
+
data={pageData}
|
|
214
|
+
columns={columns}
|
|
215
|
+
getRowId={getEventId}
|
|
216
|
+
isLoading={isLoading}
|
|
217
|
+
sorting={sorting}
|
|
218
|
+
onSortingChange={setSorting}
|
|
219
|
+
manualSorting
|
|
220
|
+
rowSelection={rowSelection}
|
|
221
|
+
onRowSelectionChange={setRowSelection}
|
|
222
|
+
activeRowId={open ? selectedId : null}
|
|
223
|
+
onMasterCellClick={openEvent}
|
|
224
|
+
data-testid='attacks-table'
|
|
225
|
+
>
|
|
226
|
+
<TableActionBar>
|
|
227
|
+
<Button
|
|
228
|
+
variant='ghost'
|
|
229
|
+
color='neutral-alt'
|
|
230
|
+
onClick={handleBulkFalsePositive}
|
|
231
|
+
data-testid='attacks-bulk-false-positive'
|
|
232
|
+
>
|
|
233
|
+
<ShieldCheck /> Mark as false positive
|
|
234
|
+
</Button>
|
|
235
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkBlock}>
|
|
236
|
+
<ShieldBan /> Block source IPs
|
|
237
|
+
</Button>
|
|
238
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkExport}>
|
|
239
|
+
<Download /> Export
|
|
240
|
+
</Button>
|
|
241
|
+
</TableActionBar>
|
|
242
|
+
<TableEmptyState>
|
|
243
|
+
{failed ? (
|
|
244
|
+
<EmptyState data-testid='attacks-error'>
|
|
245
|
+
<EmptyStateIllustration>
|
|
246
|
+
<CloudOff />
|
|
247
|
+
</EmptyStateIllustration>
|
|
248
|
+
<EmptyStateMessage>
|
|
249
|
+
<EmptyStateTitle>Couldn't load attacks</EmptyStateTitle>
|
|
250
|
+
<EmptyStateDescription>
|
|
251
|
+
The server didn't respond. Detection keeps running; try again in a moment.
|
|
252
|
+
</EmptyStateDescription>
|
|
253
|
+
</EmptyStateMessage>
|
|
254
|
+
<EmptyStateActions>
|
|
255
|
+
<Button
|
|
256
|
+
size='medium'
|
|
257
|
+
variant='outline'
|
|
258
|
+
color='neutral'
|
|
259
|
+
onClick={handleRetry}
|
|
260
|
+
data-testid='attacks-retry'
|
|
261
|
+
>
|
|
262
|
+
<RefreshCcw />
|
|
263
|
+
Try again
|
|
264
|
+
</Button>
|
|
265
|
+
</EmptyStateActions>
|
|
266
|
+
</EmptyState>
|
|
267
|
+
) : (
|
|
268
|
+
<EmptyState type='collection-empty' data-testid='attacks-no-results'>
|
|
269
|
+
<EmptyStateIllustration>
|
|
270
|
+
<SearchX />
|
|
271
|
+
</EmptyStateIllustration>
|
|
272
|
+
<EmptyStateMessage>
|
|
273
|
+
<EmptyStateTitle>No results found</EmptyStateTitle>
|
|
274
|
+
<EmptyStateDescription>No attacks match the filter.</EmptyStateDescription>
|
|
275
|
+
</EmptyStateMessage>
|
|
276
|
+
<EmptyStateActions>
|
|
277
|
+
<Button
|
|
278
|
+
size='medium'
|
|
279
|
+
variant='outline'
|
|
280
|
+
color='neutral'
|
|
281
|
+
onClick={handleResetFilters}
|
|
282
|
+
data-testid='attacks-reset-filters'
|
|
283
|
+
>
|
|
284
|
+
<FilterX />
|
|
285
|
+
Reset filters
|
|
286
|
+
</Button>
|
|
287
|
+
</EmptyStateActions>
|
|
288
|
+
</EmptyState>
|
|
289
|
+
)}
|
|
290
|
+
</TableEmptyState>
|
|
291
|
+
</Table>
|
|
292
|
+
{rows.length > 0 && (
|
|
293
|
+
<Pagination
|
|
294
|
+
{...pagination}
|
|
295
|
+
align='right'
|
|
296
|
+
aria-label='Attack events pages'
|
|
297
|
+
data-testid='attacks-pagination'
|
|
298
|
+
>
|
|
299
|
+
<PaginationPageSize options={[10, 25, 50]} />
|
|
300
|
+
<PaginationPrevious />
|
|
301
|
+
<PaginationList />
|
|
302
|
+
<PaginationNext />
|
|
303
|
+
</Pagination>
|
|
304
|
+
)}
|
|
305
|
+
</VStack>
|
|
306
|
+
</PageContent>
|
|
307
|
+
|
|
308
|
+
<Drawer
|
|
309
|
+
open={open}
|
|
310
|
+
onOpenChange={setOpen}
|
|
311
|
+
modal={false}
|
|
312
|
+
overlay={false}
|
|
313
|
+
closeOnOutsideClick={false}
|
|
314
|
+
width={1064}
|
|
315
|
+
data-testid='attack-drawer'
|
|
316
|
+
>
|
|
317
|
+
<DrawerContent>
|
|
318
|
+
<DrawerResizeHandle onResizeEnd={onSaveDrawerWidth} />
|
|
319
|
+
<DrawerHeader>
|
|
320
|
+
<HStack align='start' justify='between' gap={16} fullWidth className='min-w-0'>
|
|
321
|
+
<VStack gap={4} className='min-w-0' data-testid='attack-summary'>
|
|
322
|
+
<Heading as='h2' size='xl' weight='medium' truncate>
|
|
323
|
+
{selected &&
|
|
324
|
+
`${ATTACK_TYPES[selected.attackType]} in ${selected.point} on ${selected.host}`}
|
|
325
|
+
</Heading>
|
|
326
|
+
{selected && (
|
|
327
|
+
<HStack gap={4} align='center'>
|
|
328
|
+
<Badge
|
|
329
|
+
variant='dotted'
|
|
330
|
+
type='secondary'
|
|
331
|
+
size='medium'
|
|
332
|
+
color={STATUS[selected.status].color}
|
|
333
|
+
>
|
|
334
|
+
{STATUS[selected.status].label}
|
|
335
|
+
</Badge>
|
|
336
|
+
<Text size='xs' color='secondary'>
|
|
337
|
+
·
|
|
338
|
+
</Text>
|
|
339
|
+
<Text size='xs' color='secondary'>
|
|
340
|
+
{selected.status === 'blocked' ? selected.hits : 0}/{selected.hits} blocked
|
|
341
|
+
</Text>
|
|
342
|
+
<Text size='xs' color='secondary'>
|
|
343
|
+
·
|
|
344
|
+
</Text>
|
|
345
|
+
<Text size='xs' color='secondary'>
|
|
346
|
+
{sources.length} {sources.length === 1 ? 'IP' : 'IPs'} across {countries}{' '}
|
|
347
|
+
{countries === 1 ? 'country' : 'countries'}
|
|
348
|
+
</Text>
|
|
349
|
+
</HStack>
|
|
350
|
+
)}
|
|
351
|
+
</VStack>
|
|
352
|
+
<Tooltip>
|
|
353
|
+
<TooltipTrigger asChild>
|
|
354
|
+
<Button
|
|
355
|
+
variant='ghost'
|
|
356
|
+
color='neutral'
|
|
357
|
+
size='small'
|
|
358
|
+
aria-label='Copy link'
|
|
359
|
+
onClick={handleCopyLink}
|
|
360
|
+
>
|
|
361
|
+
<Link />
|
|
362
|
+
</Button>
|
|
363
|
+
</TooltipTrigger>
|
|
364
|
+
<TooltipContent>Copy link</TooltipContent>
|
|
365
|
+
</Tooltip>
|
|
366
|
+
</HStack>
|
|
367
|
+
</DrawerHeader>
|
|
368
|
+
<Tabs value={tab} onChange={setTab} data-testid='attack-tabs'>
|
|
369
|
+
<TabsList>
|
|
370
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
371
|
+
<TabsTrigger value='requests'>
|
|
372
|
+
Requests
|
|
373
|
+
<Badge type='secondary' color='slate' size='medium' className='ml-4'>
|
|
374
|
+
{selected && formatCount(selected.hits)}
|
|
375
|
+
</Badge>
|
|
376
|
+
</TabsTrigger>
|
|
377
|
+
</TabsList>
|
|
378
|
+
</Tabs>
|
|
379
|
+
|
|
380
|
+
{selected && tab === 'overview' && (
|
|
381
|
+
<DrawerBody>
|
|
382
|
+
<VStack gap={12} className='py-16' data-testid='attack-overview'>
|
|
383
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'>
|
|
384
|
+
<Attribute>
|
|
385
|
+
<AttributeLabel>Severity</AttributeLabel>
|
|
386
|
+
<AttributeValue>
|
|
387
|
+
<Badge
|
|
388
|
+
type='secondary'
|
|
389
|
+
size='medium'
|
|
390
|
+
color={SEVERITY[selected.severity].color}
|
|
391
|
+
>
|
|
392
|
+
{SEVERITY[selected.severity].label}
|
|
393
|
+
</Badge>
|
|
394
|
+
</AttributeValue>
|
|
395
|
+
</Attribute>
|
|
396
|
+
<Attribute>
|
|
397
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
398
|
+
<AttributeValue>
|
|
399
|
+
<FormatDateTime
|
|
400
|
+
value={getFirstSeen(selected)}
|
|
401
|
+
format='datetime'
|
|
402
|
+
layout='inline'
|
|
403
|
+
/>
|
|
404
|
+
</AttributeValue>
|
|
405
|
+
</Attribute>
|
|
406
|
+
<Attribute>
|
|
407
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
408
|
+
<AttributeValue>
|
|
409
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
410
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
411
|
+
</Badge>
|
|
412
|
+
</AttributeValue>
|
|
413
|
+
</Attribute>
|
|
414
|
+
<Attribute>
|
|
415
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
416
|
+
<AttributeValue>
|
|
417
|
+
<FormatDateTime
|
|
418
|
+
value={selected.detectedAt}
|
|
419
|
+
format='datetime'
|
|
420
|
+
layout='inline'
|
|
421
|
+
/>
|
|
422
|
+
</AttributeValue>
|
|
423
|
+
</Attribute>
|
|
424
|
+
<Attribute>
|
|
425
|
+
<AttributeLabel>Application</AttributeLabel>
|
|
426
|
+
<AttributeValue>
|
|
427
|
+
<Tag>{selected.application}</Tag>
|
|
428
|
+
</AttributeValue>
|
|
429
|
+
</Attribute>
|
|
430
|
+
<Attribute>
|
|
431
|
+
<AttributeLabel>Node</AttributeLabel>
|
|
432
|
+
<AttributeValue>
|
|
433
|
+
<InlineCodeSnippet code={selected.node} size='md' />
|
|
434
|
+
</AttributeValue>
|
|
435
|
+
</Attribute>
|
|
436
|
+
<Attribute className='col-span-2'>
|
|
437
|
+
<AttributeLabel>IPs</AttributeLabel>
|
|
438
|
+
<AttributeValue>
|
|
439
|
+
<HStack gap={8}>
|
|
440
|
+
{sources.map(source => (
|
|
441
|
+
<Ip key={source.ip}>
|
|
442
|
+
<IpCountry code={source.country} />
|
|
443
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
444
|
+
{source.provider && <IpProvider>{source.provider}</IpProvider>}
|
|
445
|
+
</Ip>
|
|
446
|
+
))}
|
|
447
|
+
</HStack>
|
|
448
|
+
</AttributeValue>
|
|
449
|
+
</Attribute>
|
|
450
|
+
</div>
|
|
451
|
+
<Chart>
|
|
452
|
+
<ChartHeader>
|
|
453
|
+
<ChartTitle>Timeline</ChartTitle>
|
|
454
|
+
</ChartHeader>
|
|
455
|
+
<LineChart data={getTimeline(selected)} series={TIMELINE_SERIES} xKey='timestamp'>
|
|
456
|
+
<LineChartBody>
|
|
457
|
+
<LineChartGrid />
|
|
458
|
+
<LineChartXAxis tickFormatter={formatHour} minTickGap={48} />
|
|
459
|
+
<LineChartYAxis />
|
|
460
|
+
<LineChartLine seriesKey='hits' curve='linear' />
|
|
461
|
+
<LineChartTooltip xTickFormatter={formatHourWithTimezone} />
|
|
462
|
+
</LineChartBody>
|
|
463
|
+
</LineChart>
|
|
464
|
+
</Chart>
|
|
465
|
+
<div className='grid grid-cols-2 gap-12'>
|
|
466
|
+
<Chart>
|
|
467
|
+
<ChartHeader>
|
|
468
|
+
<ChartTitle>Top 5 IPs</ChartTitle>
|
|
469
|
+
</ChartHeader>
|
|
470
|
+
<BarList max={sumValues(ipShares)}>
|
|
471
|
+
{ipShares.map(row => (
|
|
472
|
+
<BarListItem key={row.name} value={row.value}>
|
|
473
|
+
<BarListBar />
|
|
474
|
+
<BarListLabel>{row.name}</BarListLabel>
|
|
475
|
+
<BarListValue>
|
|
476
|
+
<BarListPercent />
|
|
477
|
+
</BarListValue>
|
|
478
|
+
</BarListItem>
|
|
479
|
+
))}
|
|
480
|
+
</BarList>
|
|
481
|
+
</Chart>
|
|
482
|
+
<Chart>
|
|
483
|
+
<ChartHeader>
|
|
484
|
+
<ChartTitle>Status codes</ChartTitle>
|
|
485
|
+
</ChartHeader>
|
|
486
|
+
<PieChart data={statusCodes} total={sumValues(statusCodes)}>
|
|
487
|
+
<PieChartDonut>
|
|
488
|
+
<PieChartCenter>
|
|
489
|
+
<PieChartCenterValue>{formatCount(selected.hits)}</PieChartCenterValue>
|
|
490
|
+
<PieChartCenterLabel pluralize={{ one: 'hit', other: 'hits' }} />
|
|
491
|
+
</PieChartCenter>
|
|
492
|
+
</PieChartDonut>
|
|
493
|
+
<PieChartLegend>
|
|
494
|
+
{statusCodes.map(row => (
|
|
495
|
+
<PieChartLegendItem key={row.name} name={row.name}>
|
|
496
|
+
<Badge color={row.color} type='secondary' textVariant='code'>
|
|
497
|
+
{row.name}
|
|
498
|
+
</Badge>
|
|
499
|
+
<PieChartLegendValue>
|
|
500
|
+
{formatCount(row.value)}
|
|
501
|
+
<LegendDot />
|
|
502
|
+
<PieChartLegendPercent />
|
|
503
|
+
</PieChartLegendValue>
|
|
504
|
+
</PieChartLegendItem>
|
|
505
|
+
))}
|
|
506
|
+
</PieChartLegend>
|
|
507
|
+
</PieChart>
|
|
508
|
+
</Chart>
|
|
509
|
+
</div>
|
|
510
|
+
</VStack>
|
|
511
|
+
</DrawerBody>
|
|
512
|
+
)}
|
|
513
|
+
|
|
514
|
+
{selected && tab === 'requests' && (
|
|
515
|
+
<div className='flex min-h-0 flex-1 flex-col' data-testid='attack-requests'>
|
|
516
|
+
<HStack gap={8} className='shrink-0 border-b border-border-primary-light px-16 py-8'>
|
|
517
|
+
<div className='min-w-0 flex-1'>
|
|
518
|
+
<FilterInput placeholder='Filter requests...' />
|
|
519
|
+
</div>
|
|
520
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
521
|
+
<ArrowDown /> Date
|
|
522
|
+
</Button>
|
|
523
|
+
</HStack>
|
|
524
|
+
<div className='flex min-h-0 flex-1'>
|
|
525
|
+
<div className='w-320 shrink-0 border-r border-border-primary-light'>
|
|
526
|
+
<ScrollArea>
|
|
527
|
+
<ScrollAreaViewport>
|
|
528
|
+
<ScrollAreaContent>
|
|
529
|
+
<VStack gap={2} className='p-8' data-testid='attack-request-list'>
|
|
530
|
+
{requests.map(item => (
|
|
531
|
+
<button
|
|
532
|
+
key={item.id}
|
|
533
|
+
type='button'
|
|
534
|
+
value={item.id}
|
|
535
|
+
aria-pressed={item.id === requestId}
|
|
536
|
+
onClick={handleSelectRequest}
|
|
537
|
+
className={
|
|
538
|
+
item.id === requestId
|
|
539
|
+
? 'w-full rounded-8 bg-states-primary-default-alt p-8 text-left'
|
|
540
|
+
: 'w-full rounded-8 p-8 text-left hover:bg-states-primary-hover'
|
|
541
|
+
}
|
|
542
|
+
>
|
|
543
|
+
<VStack gap={2}>
|
|
544
|
+
<HStack gap={4}>
|
|
545
|
+
<FormatDateTime
|
|
546
|
+
value={item.time}
|
|
547
|
+
format='datetime'
|
|
548
|
+
layout='inline'
|
|
549
|
+
/>
|
|
550
|
+
<div className='ml-auto'>
|
|
551
|
+
<ResponseCode code={item.code} />
|
|
552
|
+
</div>
|
|
553
|
+
</HStack>
|
|
554
|
+
<HStack gap={4}>
|
|
555
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
556
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
557
|
+
</Badge>
|
|
558
|
+
</HStack>
|
|
559
|
+
<HStack gap={4}>
|
|
560
|
+
<HttpMethod method={selected.method} />
|
|
561
|
+
<Text size='xs' truncate>
|
|
562
|
+
{selected.path}
|
|
563
|
+
</Text>
|
|
564
|
+
</HStack>
|
|
565
|
+
<Text size='xs' color='secondary' truncate>
|
|
566
|
+
{selected.host}
|
|
567
|
+
</Text>
|
|
568
|
+
</VStack>
|
|
569
|
+
</button>
|
|
570
|
+
))}
|
|
571
|
+
</VStack>
|
|
572
|
+
</ScrollAreaContent>
|
|
573
|
+
</ScrollAreaViewport>
|
|
574
|
+
<ScrollAreaScrollbar />
|
|
575
|
+
</ScrollArea>
|
|
576
|
+
</div>
|
|
577
|
+
<div className='min-w-0 flex-1' data-testid='attack-request'>
|
|
578
|
+
{request ? (
|
|
579
|
+
<ScrollArea>
|
|
580
|
+
<ScrollAreaViewport>
|
|
581
|
+
<ScrollAreaContent>
|
|
582
|
+
<HStack justify='between' className='px-24 py-8'>
|
|
583
|
+
<Text size='md'>Request details</Text>
|
|
584
|
+
<DropdownMenu>
|
|
585
|
+
<DropdownMenuTrigger asChild>
|
|
586
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
587
|
+
Actions
|
|
588
|
+
</Button>
|
|
589
|
+
</DropdownMenuTrigger>
|
|
590
|
+
<DropdownMenuContent>
|
|
591
|
+
<DropdownMenuItem onSelect={handleRequestFalsePositive}>
|
|
592
|
+
<DropdownMenuItemText>
|
|
593
|
+
Mark as false positive
|
|
594
|
+
</DropdownMenuItemText>
|
|
595
|
+
</DropdownMenuItem>
|
|
596
|
+
<DropdownMenuSeparator />
|
|
597
|
+
<DropdownMenuItem
|
|
598
|
+
variant='destructive'
|
|
599
|
+
onSelect={handleRequestBlock}
|
|
600
|
+
>
|
|
601
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
602
|
+
</DropdownMenuItem>
|
|
603
|
+
</DropdownMenuContent>
|
|
604
|
+
</DropdownMenu>
|
|
605
|
+
</HStack>
|
|
606
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-6 px-24 pb-8'>
|
|
607
|
+
<Attribute orientation='horizontal'>
|
|
608
|
+
<AttributeLabel>Source IP</AttributeLabel>
|
|
609
|
+
<AttributeValue>
|
|
610
|
+
<Ip>
|
|
611
|
+
<IpCountry code={request.source.country} />
|
|
612
|
+
<IpAddress>{request.source.ip}</IpAddress>
|
|
613
|
+
</Ip>
|
|
614
|
+
</AttributeValue>
|
|
615
|
+
</Attribute>
|
|
616
|
+
<Attribute orientation='horizontal'>
|
|
617
|
+
<AttributeLabel>Request ID</AttributeLabel>
|
|
618
|
+
<AttributeValue>
|
|
619
|
+
<InlineCodeSnippet code={request.id} size='sm' />
|
|
620
|
+
</AttributeValue>
|
|
621
|
+
</Attribute>
|
|
622
|
+
<Attribute orientation='horizontal' className='col-span-2'>
|
|
623
|
+
<AttributeLabel>URI</AttributeLabel>
|
|
624
|
+
<AttributeValue>
|
|
625
|
+
<HStack gap={6}>
|
|
626
|
+
<HttpMethod method={selected.method} />
|
|
627
|
+
<Text size='sm' truncate>
|
|
628
|
+
{selected.host}
|
|
629
|
+
{selected.path}
|
|
630
|
+
</Text>
|
|
631
|
+
</HStack>
|
|
632
|
+
</AttributeValue>
|
|
633
|
+
</Attribute>
|
|
634
|
+
</div>
|
|
635
|
+
<div className='px-24 py-4'>
|
|
636
|
+
<Separator />
|
|
637
|
+
</div>
|
|
638
|
+
<div className='px-24 py-8'>
|
|
639
|
+
<Text size='md'>Attack</Text>
|
|
640
|
+
</div>
|
|
641
|
+
<div className='grid grid-cols-1 gap-y-6 px-24 pb-8'>
|
|
642
|
+
<Attribute orientation='horizontal'>
|
|
643
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
644
|
+
<AttributeValue>
|
|
645
|
+
<InlineCodeSnippet code={selected.point} size='sm' />
|
|
646
|
+
</AttributeValue>
|
|
647
|
+
</Attribute>
|
|
648
|
+
<Attribute orientation='horizontal'>
|
|
649
|
+
<AttributeLabel>Payload</AttributeLabel>
|
|
650
|
+
<AttributeValue>
|
|
651
|
+
<InlineCodeSnippet code={selected.payload} size='sm' />
|
|
652
|
+
</AttributeValue>
|
|
653
|
+
</Attribute>
|
|
654
|
+
</div>
|
|
655
|
+
<div className='px-24 py-4'>
|
|
656
|
+
<Separator />
|
|
657
|
+
</div>
|
|
658
|
+
<div className='px-24 py-8'>
|
|
659
|
+
<Text size='md'>Full request</Text>
|
|
660
|
+
</div>
|
|
661
|
+
<div className='px-24 pb-16'>
|
|
662
|
+
<CodeSnippetRoot
|
|
663
|
+
code={selected.request}
|
|
664
|
+
language='text'
|
|
665
|
+
lines={getPayloadLines(selected.request, selected.payload)}
|
|
666
|
+
maxLines={15}
|
|
667
|
+
wrapLines
|
|
668
|
+
data-testid='attack-raw-request'
|
|
669
|
+
>
|
|
670
|
+
<CodeSnippetContent>
|
|
671
|
+
<CodeSnippetLineNumbers />
|
|
672
|
+
<CodeSnippetCode />
|
|
673
|
+
</CodeSnippetContent>
|
|
674
|
+
</CodeSnippetRoot>
|
|
675
|
+
</div>
|
|
676
|
+
</ScrollAreaContent>
|
|
677
|
+
</ScrollAreaViewport>
|
|
678
|
+
<ScrollAreaScrollbar />
|
|
679
|
+
</ScrollArea>
|
|
680
|
+
) : (
|
|
681
|
+
<div className='flex h-full items-center justify-center'>
|
|
682
|
+
<Text size='sm' color='secondary'>
|
|
683
|
+
Select a request to view details
|
|
684
|
+
</Text>
|
|
685
|
+
</div>
|
|
686
|
+
)}
|
|
687
|
+
</div>
|
|
688
|
+
</div>
|
|
689
|
+
</div>
|
|
690
|
+
)}
|
|
691
|
+
</DrawerContent>
|
|
692
|
+
</Drawer>
|
|
693
|
+
</Page>
|
|
694
|
+
);
|
|
695
|
+
};
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
The query matched nothing: "No results found" and "Reset filters" clears it.
|
|
699
|
+
|
|
700
|
+
The filter matched nothing: the table keeps its header and says "No results found" with a
|
|
701
|
+
"Reset filters" button that clears the query. The pager hides; there is no create action,
|
|
702
|
+
since attacks are never created by hand.
|
|
703
|
+
|
|
704
|
+
```tsx story=NoResults
|
|
705
|
+
import { type MouseEvent, useState } from 'react';
|
|
706
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
707
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
708
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
709
|
+
import { CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
710
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle } from '@wallarm-org/design-system/Drawer';
|
|
711
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
712
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
713
|
+
import { type ExprNode, FilterInput } from '@wallarm-org/design-system/FilterInput';
|
|
714
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
715
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
716
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
717
|
+
import { ArrowDown, CloudOff, Download, Ellipsis, FilterX, Link, RefreshCcw, SearchX, ShieldBan, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
718
|
+
import { Ip, IpAddress, IpCountry, IpProvider } from '@wallarm-org/design-system/Ip';
|
|
719
|
+
import { Page, PageActions, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle, PageToolbar } from '@wallarm-org/design-system/Page';
|
|
720
|
+
import { Pagination, PaginationList, PaginationNext, PaginationPageSize, PaginationPrevious, useClientPagination } from '@wallarm-org/design-system/Pagination';
|
|
721
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
722
|
+
import { ScrollArea, ScrollAreaContent, ScrollAreaScrollbar, ScrollAreaViewport } from '@wallarm-org/design-system/ScrollArea';
|
|
723
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
724
|
+
import { BarList, BarListBar, BarListItem, BarListLabel, BarListPercent, BarListValue, Chart, ChartHeader, ChartTitle, LegendDot, LineChart, LineChartBody, LineChartGrid, LineChartLine, LineChartTooltip, LineChartXAxis, LineChartYAxis, PieChart, PieChartCenter, PieChartCenterLabel, PieChartCenterValue, PieChartDonut, PieChartLegend, PieChartLegendItem, PieChartLegendPercent, PieChartLegendValue, useChartTimeFormatters } from '@wallarm-org/design-system/SimpleCharts';
|
|
725
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
726
|
+
import { type TableColumnDef, type TableRow, type TableRowSelectionState, type TableSortingState, Table, TableActionBar, TableEmptyState } from '@wallarm-org/design-system/Table';
|
|
727
|
+
import { Tabs, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
728
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
729
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
730
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
|
|
731
|
+
|
|
732
|
+
export const NoResults = ({
|
|
733
|
+
initialFilter = SEVERITY_FILTER,
|
|
734
|
+
isLoading = false,
|
|
735
|
+
loadFailed = false,
|
|
736
|
+
}) => {
|
|
737
|
+
const [filter, setFilter] = useState<ExprNode | null>(initialFilter);
|
|
738
|
+
const [sorting, setSorting] = useState<TableSortingState>([{ id: 'detectedAt', desc: true }]);
|
|
739
|
+
const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});
|
|
740
|
+
const [falsePositiveIds, setFalsePositiveIds] = useState<string[]>([]);
|
|
741
|
+
const [failed, setFailed] = useState(loadFailed);
|
|
742
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
743
|
+
const [open, setOpen] = useState(false);
|
|
744
|
+
const [tab, setTab] = useState('overview');
|
|
745
|
+
const [requestId, setRequestId] = useState<string | null>(null);
|
|
746
|
+
const { formatHour, formatHourWithTimezone } = useChartTimeFormatters();
|
|
747
|
+
|
|
748
|
+
const events = EVENTS.map(event =>
|
|
749
|
+
falsePositiveIds.includes(event.id) ? { ...event, status: 'false-positive' as const } : event,
|
|
750
|
+
);
|
|
751
|
+
const rows =
|
|
752
|
+
isLoading || failed
|
|
753
|
+
? []
|
|
754
|
+
: sortEvents(
|
|
755
|
+
events.filter(event => matchesFilter(event, filter)),
|
|
756
|
+
sorting,
|
|
757
|
+
);
|
|
758
|
+
const { pageData, ...pagination } = useClientPagination(rows, 10);
|
|
759
|
+
const selected = events.find(event => event.id === selectedId) ?? null;
|
|
760
|
+
const requests = selected ? getRequests(selected) : [];
|
|
761
|
+
const request = requests.find(item => item.id === requestId) ?? null;
|
|
762
|
+
const selectedIds = Object.keys(rowSelection).filter(id => rowSelection[id]);
|
|
763
|
+
|
|
764
|
+
const markFalsePositive = (ids: string[]) => setFalsePositiveIds([...falsePositiveIds, ...ids]);
|
|
765
|
+
const openEvent = (id: string) => {
|
|
766
|
+
setSelectedId(id);
|
|
767
|
+
setTab('overview');
|
|
768
|
+
setRequestId(null);
|
|
769
|
+
setOpen(true);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
const renderMenuAction = (row: TableRow<AttackEvent>) => {
|
|
773
|
+
const event = row.original;
|
|
774
|
+
const handleOpen = () => openEvent(event.id);
|
|
775
|
+
const handleMarkFalsePositive = () => markFalsePositive([event.id]);
|
|
776
|
+
const handleBlockSource = () => onBlockSources([event.ip]);
|
|
777
|
+
|
|
778
|
+
return (
|
|
779
|
+
<DropdownMenu>
|
|
780
|
+
<DropdownMenuTrigger asChild>
|
|
781
|
+
<Button
|
|
782
|
+
variant='ghost'
|
|
783
|
+
color='neutral'
|
|
784
|
+
size='small'
|
|
785
|
+
aria-label={`Actions for event ${event.id}`}
|
|
786
|
+
>
|
|
787
|
+
<Ellipsis />
|
|
788
|
+
</Button>
|
|
789
|
+
</DropdownMenuTrigger>
|
|
790
|
+
<DropdownMenuContent>
|
|
791
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
792
|
+
<DropdownMenuItemText>Open event</DropdownMenuItemText>
|
|
793
|
+
</DropdownMenuItem>
|
|
794
|
+
<DropdownMenuItem onSelect={handleMarkFalsePositive}>
|
|
795
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
796
|
+
</DropdownMenuItem>
|
|
797
|
+
<DropdownMenuSeparator />
|
|
798
|
+
<DropdownMenuItem variant='destructive' onSelect={handleBlockSource}>
|
|
799
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
800
|
+
</DropdownMenuItem>
|
|
801
|
+
</DropdownMenuContent>
|
|
802
|
+
</DropdownMenu>
|
|
803
|
+
);
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
const columns: TableColumnDef<AttackEvent>[] = [
|
|
807
|
+
{
|
|
808
|
+
accessorKey: 'attackType',
|
|
809
|
+
header: 'Attack',
|
|
810
|
+
size: 250,
|
|
811
|
+
cell: renderAttack,
|
|
812
|
+
meta: { renderMenuAction },
|
|
813
|
+
},
|
|
814
|
+
{ accessorKey: 'severity', header: 'Severity', size: 100, cell: renderSeverity },
|
|
815
|
+
{ accessorKey: 'status', header: 'Status', size: 130, cell: renderStatus },
|
|
816
|
+
{ accessorKey: 'path', header: 'Request', size: 280, cell: renderRequest },
|
|
817
|
+
{ accessorKey: 'ip', header: 'Source IP', size: 250, cell: renderSource },
|
|
818
|
+
{ accessorKey: 'code', header: 'Code', size: 80, cell: renderCode },
|
|
819
|
+
{
|
|
820
|
+
accessorKey: 'hits',
|
|
821
|
+
header: 'Hits',
|
|
822
|
+
size: 80,
|
|
823
|
+
meta: { description: { type: 'tooltip', content: 'Requests grouped into this attack' } },
|
|
824
|
+
},
|
|
825
|
+
{ accessorKey: 'detectedAt', header: 'Detected', size: 140, cell: renderDetectedAt },
|
|
826
|
+
];
|
|
827
|
+
|
|
828
|
+
const handleResetFilters = () => setFilter(null);
|
|
829
|
+
const handleRetry = () => setFailed(false);
|
|
830
|
+
const handleBulkFalsePositive = () => {
|
|
831
|
+
markFalsePositive(selectedIds);
|
|
832
|
+
setRowSelection({});
|
|
833
|
+
};
|
|
834
|
+
const handleBulkBlock = () =>
|
|
835
|
+
onBlockSources(events.filter(event => rowSelection[event.id]).map(event => event.ip));
|
|
836
|
+
const handleBulkExport = () => onExportEvents(selectedIds);
|
|
837
|
+
const handleCopyLink = () => onCopyLink(selected?.id);
|
|
838
|
+
const handleSelectRequest = (event: MouseEvent<HTMLButtonElement>) =>
|
|
839
|
+
setRequestId(event.currentTarget.value);
|
|
840
|
+
const handleRequestFalsePositive = () => selected && markFalsePositive([selected.id]);
|
|
841
|
+
const handleRequestBlock = () => request && onBlockSources([request.source.ip]);
|
|
842
|
+
|
|
843
|
+
const sources = selected ? getSources(selected) : [];
|
|
844
|
+
const countries = new Set(sources.map(source => source.country)).size;
|
|
845
|
+
const ipShares = selected ? getIpShares(selected) : [];
|
|
846
|
+
const statusCodes = selected ? getStatusCodes(selected) : [];
|
|
847
|
+
|
|
848
|
+
return (
|
|
849
|
+
<Page name='attack-events' fullSize fixedHeight data-testid='attacks-page'>
|
|
850
|
+
<PageHeader>
|
|
851
|
+
<PageHeaderGroup className='flex-1'>
|
|
852
|
+
<PageTitle>Attack events</PageTitle>
|
|
853
|
+
<PageDescription>
|
|
854
|
+
Malicious requests the filtering nodes detected across your applications, and how each
|
|
855
|
+
was handled.
|
|
856
|
+
</PageDescription>
|
|
857
|
+
</PageHeaderGroup>
|
|
858
|
+
<PageActions>
|
|
859
|
+
<Button
|
|
860
|
+
size='medium'
|
|
861
|
+
variant='outline'
|
|
862
|
+
color='neutral'
|
|
863
|
+
onClick={onExportEvents}
|
|
864
|
+
data-testid='attacks-export'
|
|
865
|
+
>
|
|
866
|
+
<Download />
|
|
867
|
+
Export CSV
|
|
868
|
+
</Button>
|
|
869
|
+
</PageActions>
|
|
870
|
+
</PageHeader>
|
|
871
|
+
|
|
872
|
+
<PageToolbar>
|
|
873
|
+
<FilterInput
|
|
874
|
+
fields={FILTER_FIELDS}
|
|
875
|
+
value={filter}
|
|
876
|
+
onChange={setFilter}
|
|
877
|
+
placeholder='Filter by attack type, severity, status, source IP, host or date'
|
|
878
|
+
data-testid='attacks-filter'
|
|
879
|
+
/>
|
|
880
|
+
</PageToolbar>
|
|
881
|
+
|
|
882
|
+
<PageContent>
|
|
883
|
+
<VStack gap={12}>
|
|
884
|
+
<Table
|
|
885
|
+
aria-label='Attack events'
|
|
886
|
+
data={pageData}
|
|
887
|
+
columns={columns}
|
|
888
|
+
getRowId={getEventId}
|
|
889
|
+
isLoading={isLoading}
|
|
890
|
+
sorting={sorting}
|
|
891
|
+
onSortingChange={setSorting}
|
|
892
|
+
manualSorting
|
|
893
|
+
rowSelection={rowSelection}
|
|
894
|
+
onRowSelectionChange={setRowSelection}
|
|
895
|
+
activeRowId={open ? selectedId : null}
|
|
896
|
+
onMasterCellClick={openEvent}
|
|
897
|
+
data-testid='attacks-table'
|
|
898
|
+
>
|
|
899
|
+
<TableActionBar>
|
|
900
|
+
<Button
|
|
901
|
+
variant='ghost'
|
|
902
|
+
color='neutral-alt'
|
|
903
|
+
onClick={handleBulkFalsePositive}
|
|
904
|
+
data-testid='attacks-bulk-false-positive'
|
|
905
|
+
>
|
|
906
|
+
<ShieldCheck /> Mark as false positive
|
|
907
|
+
</Button>
|
|
908
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkBlock}>
|
|
909
|
+
<ShieldBan /> Block source IPs
|
|
910
|
+
</Button>
|
|
911
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkExport}>
|
|
912
|
+
<Download /> Export
|
|
913
|
+
</Button>
|
|
914
|
+
</TableActionBar>
|
|
915
|
+
<TableEmptyState>
|
|
916
|
+
{failed ? (
|
|
917
|
+
<EmptyState data-testid='attacks-error'>
|
|
918
|
+
<EmptyStateIllustration>
|
|
919
|
+
<CloudOff />
|
|
920
|
+
</EmptyStateIllustration>
|
|
921
|
+
<EmptyStateMessage>
|
|
922
|
+
<EmptyStateTitle>Couldn't load attacks</EmptyStateTitle>
|
|
923
|
+
<EmptyStateDescription>
|
|
924
|
+
The server didn't respond. Detection keeps running; try again in a moment.
|
|
925
|
+
</EmptyStateDescription>
|
|
926
|
+
</EmptyStateMessage>
|
|
927
|
+
<EmptyStateActions>
|
|
928
|
+
<Button
|
|
929
|
+
size='medium'
|
|
930
|
+
variant='outline'
|
|
931
|
+
color='neutral'
|
|
932
|
+
onClick={handleRetry}
|
|
933
|
+
data-testid='attacks-retry'
|
|
934
|
+
>
|
|
935
|
+
<RefreshCcw />
|
|
936
|
+
Try again
|
|
937
|
+
</Button>
|
|
938
|
+
</EmptyStateActions>
|
|
939
|
+
</EmptyState>
|
|
940
|
+
) : (
|
|
941
|
+
<EmptyState type='collection-empty' data-testid='attacks-no-results'>
|
|
942
|
+
<EmptyStateIllustration>
|
|
943
|
+
<SearchX />
|
|
944
|
+
</EmptyStateIllustration>
|
|
945
|
+
<EmptyStateMessage>
|
|
946
|
+
<EmptyStateTitle>No results found</EmptyStateTitle>
|
|
947
|
+
<EmptyStateDescription>No attacks match the filter.</EmptyStateDescription>
|
|
948
|
+
</EmptyStateMessage>
|
|
949
|
+
<EmptyStateActions>
|
|
950
|
+
<Button
|
|
951
|
+
size='medium'
|
|
952
|
+
variant='outline'
|
|
953
|
+
color='neutral'
|
|
954
|
+
onClick={handleResetFilters}
|
|
955
|
+
data-testid='attacks-reset-filters'
|
|
956
|
+
>
|
|
957
|
+
<FilterX />
|
|
958
|
+
Reset filters
|
|
959
|
+
</Button>
|
|
960
|
+
</EmptyStateActions>
|
|
961
|
+
</EmptyState>
|
|
962
|
+
)}
|
|
963
|
+
</TableEmptyState>
|
|
964
|
+
</Table>
|
|
965
|
+
{rows.length > 0 && (
|
|
966
|
+
<Pagination
|
|
967
|
+
{...pagination}
|
|
968
|
+
align='right'
|
|
969
|
+
aria-label='Attack events pages'
|
|
970
|
+
data-testid='attacks-pagination'
|
|
971
|
+
>
|
|
972
|
+
<PaginationPageSize options={[10, 25, 50]} />
|
|
973
|
+
<PaginationPrevious />
|
|
974
|
+
<PaginationList />
|
|
975
|
+
<PaginationNext />
|
|
976
|
+
</Pagination>
|
|
977
|
+
)}
|
|
978
|
+
</VStack>
|
|
979
|
+
</PageContent>
|
|
980
|
+
|
|
981
|
+
<Drawer
|
|
982
|
+
open={open}
|
|
983
|
+
onOpenChange={setOpen}
|
|
984
|
+
modal={false}
|
|
985
|
+
overlay={false}
|
|
986
|
+
closeOnOutsideClick={false}
|
|
987
|
+
width={1064}
|
|
988
|
+
data-testid='attack-drawer'
|
|
989
|
+
>
|
|
990
|
+
<DrawerContent>
|
|
991
|
+
<DrawerResizeHandle onResizeEnd={onSaveDrawerWidth} />
|
|
992
|
+
<DrawerHeader>
|
|
993
|
+
<HStack align='start' justify='between' gap={16} fullWidth className='min-w-0'>
|
|
994
|
+
<VStack gap={4} className='min-w-0' data-testid='attack-summary'>
|
|
995
|
+
<Heading as='h2' size='xl' weight='medium' truncate>
|
|
996
|
+
{selected &&
|
|
997
|
+
`${ATTACK_TYPES[selected.attackType]} in ${selected.point} on ${selected.host}`}
|
|
998
|
+
</Heading>
|
|
999
|
+
{selected && (
|
|
1000
|
+
<HStack gap={4} align='center'>
|
|
1001
|
+
<Badge
|
|
1002
|
+
variant='dotted'
|
|
1003
|
+
type='secondary'
|
|
1004
|
+
size='medium'
|
|
1005
|
+
color={STATUS[selected.status].color}
|
|
1006
|
+
>
|
|
1007
|
+
{STATUS[selected.status].label}
|
|
1008
|
+
</Badge>
|
|
1009
|
+
<Text size='xs' color='secondary'>
|
|
1010
|
+
·
|
|
1011
|
+
</Text>
|
|
1012
|
+
<Text size='xs' color='secondary'>
|
|
1013
|
+
{selected.status === 'blocked' ? selected.hits : 0}/{selected.hits} blocked
|
|
1014
|
+
</Text>
|
|
1015
|
+
<Text size='xs' color='secondary'>
|
|
1016
|
+
·
|
|
1017
|
+
</Text>
|
|
1018
|
+
<Text size='xs' color='secondary'>
|
|
1019
|
+
{sources.length} {sources.length === 1 ? 'IP' : 'IPs'} across {countries}{' '}
|
|
1020
|
+
{countries === 1 ? 'country' : 'countries'}
|
|
1021
|
+
</Text>
|
|
1022
|
+
</HStack>
|
|
1023
|
+
)}
|
|
1024
|
+
</VStack>
|
|
1025
|
+
<Tooltip>
|
|
1026
|
+
<TooltipTrigger asChild>
|
|
1027
|
+
<Button
|
|
1028
|
+
variant='ghost'
|
|
1029
|
+
color='neutral'
|
|
1030
|
+
size='small'
|
|
1031
|
+
aria-label='Copy link'
|
|
1032
|
+
onClick={handleCopyLink}
|
|
1033
|
+
>
|
|
1034
|
+
<Link />
|
|
1035
|
+
</Button>
|
|
1036
|
+
</TooltipTrigger>
|
|
1037
|
+
<TooltipContent>Copy link</TooltipContent>
|
|
1038
|
+
</Tooltip>
|
|
1039
|
+
</HStack>
|
|
1040
|
+
</DrawerHeader>
|
|
1041
|
+
<Tabs value={tab} onChange={setTab} data-testid='attack-tabs'>
|
|
1042
|
+
<TabsList>
|
|
1043
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
1044
|
+
<TabsTrigger value='requests'>
|
|
1045
|
+
Requests
|
|
1046
|
+
<Badge type='secondary' color='slate' size='medium' className='ml-4'>
|
|
1047
|
+
{selected && formatCount(selected.hits)}
|
|
1048
|
+
</Badge>
|
|
1049
|
+
</TabsTrigger>
|
|
1050
|
+
</TabsList>
|
|
1051
|
+
</Tabs>
|
|
1052
|
+
|
|
1053
|
+
{selected && tab === 'overview' && (
|
|
1054
|
+
<DrawerBody>
|
|
1055
|
+
<VStack gap={12} className='py-16' data-testid='attack-overview'>
|
|
1056
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'>
|
|
1057
|
+
<Attribute>
|
|
1058
|
+
<AttributeLabel>Severity</AttributeLabel>
|
|
1059
|
+
<AttributeValue>
|
|
1060
|
+
<Badge
|
|
1061
|
+
type='secondary'
|
|
1062
|
+
size='medium'
|
|
1063
|
+
color={SEVERITY[selected.severity].color}
|
|
1064
|
+
>
|
|
1065
|
+
{SEVERITY[selected.severity].label}
|
|
1066
|
+
</Badge>
|
|
1067
|
+
</AttributeValue>
|
|
1068
|
+
</Attribute>
|
|
1069
|
+
<Attribute>
|
|
1070
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
1071
|
+
<AttributeValue>
|
|
1072
|
+
<FormatDateTime
|
|
1073
|
+
value={getFirstSeen(selected)}
|
|
1074
|
+
format='datetime'
|
|
1075
|
+
layout='inline'
|
|
1076
|
+
/>
|
|
1077
|
+
</AttributeValue>
|
|
1078
|
+
</Attribute>
|
|
1079
|
+
<Attribute>
|
|
1080
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
1081
|
+
<AttributeValue>
|
|
1082
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1083
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
1084
|
+
</Badge>
|
|
1085
|
+
</AttributeValue>
|
|
1086
|
+
</Attribute>
|
|
1087
|
+
<Attribute>
|
|
1088
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
1089
|
+
<AttributeValue>
|
|
1090
|
+
<FormatDateTime
|
|
1091
|
+
value={selected.detectedAt}
|
|
1092
|
+
format='datetime'
|
|
1093
|
+
layout='inline'
|
|
1094
|
+
/>
|
|
1095
|
+
</AttributeValue>
|
|
1096
|
+
</Attribute>
|
|
1097
|
+
<Attribute>
|
|
1098
|
+
<AttributeLabel>Application</AttributeLabel>
|
|
1099
|
+
<AttributeValue>
|
|
1100
|
+
<Tag>{selected.application}</Tag>
|
|
1101
|
+
</AttributeValue>
|
|
1102
|
+
</Attribute>
|
|
1103
|
+
<Attribute>
|
|
1104
|
+
<AttributeLabel>Node</AttributeLabel>
|
|
1105
|
+
<AttributeValue>
|
|
1106
|
+
<InlineCodeSnippet code={selected.node} size='md' />
|
|
1107
|
+
</AttributeValue>
|
|
1108
|
+
</Attribute>
|
|
1109
|
+
<Attribute className='col-span-2'>
|
|
1110
|
+
<AttributeLabel>IPs</AttributeLabel>
|
|
1111
|
+
<AttributeValue>
|
|
1112
|
+
<HStack gap={8}>
|
|
1113
|
+
{sources.map(source => (
|
|
1114
|
+
<Ip key={source.ip}>
|
|
1115
|
+
<IpCountry code={source.country} />
|
|
1116
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
1117
|
+
{source.provider && <IpProvider>{source.provider}</IpProvider>}
|
|
1118
|
+
</Ip>
|
|
1119
|
+
))}
|
|
1120
|
+
</HStack>
|
|
1121
|
+
</AttributeValue>
|
|
1122
|
+
</Attribute>
|
|
1123
|
+
</div>
|
|
1124
|
+
<Chart>
|
|
1125
|
+
<ChartHeader>
|
|
1126
|
+
<ChartTitle>Timeline</ChartTitle>
|
|
1127
|
+
</ChartHeader>
|
|
1128
|
+
<LineChart data={getTimeline(selected)} series={TIMELINE_SERIES} xKey='timestamp'>
|
|
1129
|
+
<LineChartBody>
|
|
1130
|
+
<LineChartGrid />
|
|
1131
|
+
<LineChartXAxis tickFormatter={formatHour} minTickGap={48} />
|
|
1132
|
+
<LineChartYAxis />
|
|
1133
|
+
<LineChartLine seriesKey='hits' curve='linear' />
|
|
1134
|
+
<LineChartTooltip xTickFormatter={formatHourWithTimezone} />
|
|
1135
|
+
</LineChartBody>
|
|
1136
|
+
</LineChart>
|
|
1137
|
+
</Chart>
|
|
1138
|
+
<div className='grid grid-cols-2 gap-12'>
|
|
1139
|
+
<Chart>
|
|
1140
|
+
<ChartHeader>
|
|
1141
|
+
<ChartTitle>Top 5 IPs</ChartTitle>
|
|
1142
|
+
</ChartHeader>
|
|
1143
|
+
<BarList max={sumValues(ipShares)}>
|
|
1144
|
+
{ipShares.map(row => (
|
|
1145
|
+
<BarListItem key={row.name} value={row.value}>
|
|
1146
|
+
<BarListBar />
|
|
1147
|
+
<BarListLabel>{row.name}</BarListLabel>
|
|
1148
|
+
<BarListValue>
|
|
1149
|
+
<BarListPercent />
|
|
1150
|
+
</BarListValue>
|
|
1151
|
+
</BarListItem>
|
|
1152
|
+
))}
|
|
1153
|
+
</BarList>
|
|
1154
|
+
</Chart>
|
|
1155
|
+
<Chart>
|
|
1156
|
+
<ChartHeader>
|
|
1157
|
+
<ChartTitle>Status codes</ChartTitle>
|
|
1158
|
+
</ChartHeader>
|
|
1159
|
+
<PieChart data={statusCodes} total={sumValues(statusCodes)}>
|
|
1160
|
+
<PieChartDonut>
|
|
1161
|
+
<PieChartCenter>
|
|
1162
|
+
<PieChartCenterValue>{formatCount(selected.hits)}</PieChartCenterValue>
|
|
1163
|
+
<PieChartCenterLabel pluralize={{ one: 'hit', other: 'hits' }} />
|
|
1164
|
+
</PieChartCenter>
|
|
1165
|
+
</PieChartDonut>
|
|
1166
|
+
<PieChartLegend>
|
|
1167
|
+
{statusCodes.map(row => (
|
|
1168
|
+
<PieChartLegendItem key={row.name} name={row.name}>
|
|
1169
|
+
<Badge color={row.color} type='secondary' textVariant='code'>
|
|
1170
|
+
{row.name}
|
|
1171
|
+
</Badge>
|
|
1172
|
+
<PieChartLegendValue>
|
|
1173
|
+
{formatCount(row.value)}
|
|
1174
|
+
<LegendDot />
|
|
1175
|
+
<PieChartLegendPercent />
|
|
1176
|
+
</PieChartLegendValue>
|
|
1177
|
+
</PieChartLegendItem>
|
|
1178
|
+
))}
|
|
1179
|
+
</PieChartLegend>
|
|
1180
|
+
</PieChart>
|
|
1181
|
+
</Chart>
|
|
1182
|
+
</div>
|
|
1183
|
+
</VStack>
|
|
1184
|
+
</DrawerBody>
|
|
1185
|
+
)}
|
|
1186
|
+
|
|
1187
|
+
{selected && tab === 'requests' && (
|
|
1188
|
+
<div className='flex min-h-0 flex-1 flex-col' data-testid='attack-requests'>
|
|
1189
|
+
<HStack gap={8} className='shrink-0 border-b border-border-primary-light px-16 py-8'>
|
|
1190
|
+
<div className='min-w-0 flex-1'>
|
|
1191
|
+
<FilterInput placeholder='Filter requests...' />
|
|
1192
|
+
</div>
|
|
1193
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
1194
|
+
<ArrowDown /> Date
|
|
1195
|
+
</Button>
|
|
1196
|
+
</HStack>
|
|
1197
|
+
<div className='flex min-h-0 flex-1'>
|
|
1198
|
+
<div className='w-320 shrink-0 border-r border-border-primary-light'>
|
|
1199
|
+
<ScrollArea>
|
|
1200
|
+
<ScrollAreaViewport>
|
|
1201
|
+
<ScrollAreaContent>
|
|
1202
|
+
<VStack gap={2} className='p-8' data-testid='attack-request-list'>
|
|
1203
|
+
{requests.map(item => (
|
|
1204
|
+
<button
|
|
1205
|
+
key={item.id}
|
|
1206
|
+
type='button'
|
|
1207
|
+
value={item.id}
|
|
1208
|
+
aria-pressed={item.id === requestId}
|
|
1209
|
+
onClick={handleSelectRequest}
|
|
1210
|
+
className={
|
|
1211
|
+
item.id === requestId
|
|
1212
|
+
? 'w-full rounded-8 bg-states-primary-default-alt p-8 text-left'
|
|
1213
|
+
: 'w-full rounded-8 p-8 text-left hover:bg-states-primary-hover'
|
|
1214
|
+
}
|
|
1215
|
+
>
|
|
1216
|
+
<VStack gap={2}>
|
|
1217
|
+
<HStack gap={4}>
|
|
1218
|
+
<FormatDateTime
|
|
1219
|
+
value={item.time}
|
|
1220
|
+
format='datetime'
|
|
1221
|
+
layout='inline'
|
|
1222
|
+
/>
|
|
1223
|
+
<div className='ml-auto'>
|
|
1224
|
+
<ResponseCode code={item.code} />
|
|
1225
|
+
</div>
|
|
1226
|
+
</HStack>
|
|
1227
|
+
<HStack gap={4}>
|
|
1228
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1229
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
1230
|
+
</Badge>
|
|
1231
|
+
</HStack>
|
|
1232
|
+
<HStack gap={4}>
|
|
1233
|
+
<HttpMethod method={selected.method} />
|
|
1234
|
+
<Text size='xs' truncate>
|
|
1235
|
+
{selected.path}
|
|
1236
|
+
</Text>
|
|
1237
|
+
</HStack>
|
|
1238
|
+
<Text size='xs' color='secondary' truncate>
|
|
1239
|
+
{selected.host}
|
|
1240
|
+
</Text>
|
|
1241
|
+
</VStack>
|
|
1242
|
+
</button>
|
|
1243
|
+
))}
|
|
1244
|
+
</VStack>
|
|
1245
|
+
</ScrollAreaContent>
|
|
1246
|
+
</ScrollAreaViewport>
|
|
1247
|
+
<ScrollAreaScrollbar />
|
|
1248
|
+
</ScrollArea>
|
|
1249
|
+
</div>
|
|
1250
|
+
<div className='min-w-0 flex-1' data-testid='attack-request'>
|
|
1251
|
+
{request ? (
|
|
1252
|
+
<ScrollArea>
|
|
1253
|
+
<ScrollAreaViewport>
|
|
1254
|
+
<ScrollAreaContent>
|
|
1255
|
+
<HStack justify='between' className='px-24 py-8'>
|
|
1256
|
+
<Text size='md'>Request details</Text>
|
|
1257
|
+
<DropdownMenu>
|
|
1258
|
+
<DropdownMenuTrigger asChild>
|
|
1259
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
1260
|
+
Actions
|
|
1261
|
+
</Button>
|
|
1262
|
+
</DropdownMenuTrigger>
|
|
1263
|
+
<DropdownMenuContent>
|
|
1264
|
+
<DropdownMenuItem onSelect={handleRequestFalsePositive}>
|
|
1265
|
+
<DropdownMenuItemText>
|
|
1266
|
+
Mark as false positive
|
|
1267
|
+
</DropdownMenuItemText>
|
|
1268
|
+
</DropdownMenuItem>
|
|
1269
|
+
<DropdownMenuSeparator />
|
|
1270
|
+
<DropdownMenuItem
|
|
1271
|
+
variant='destructive'
|
|
1272
|
+
onSelect={handleRequestBlock}
|
|
1273
|
+
>
|
|
1274
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
1275
|
+
</DropdownMenuItem>
|
|
1276
|
+
</DropdownMenuContent>
|
|
1277
|
+
</DropdownMenu>
|
|
1278
|
+
</HStack>
|
|
1279
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-6 px-24 pb-8'>
|
|
1280
|
+
<Attribute orientation='horizontal'>
|
|
1281
|
+
<AttributeLabel>Source IP</AttributeLabel>
|
|
1282
|
+
<AttributeValue>
|
|
1283
|
+
<Ip>
|
|
1284
|
+
<IpCountry code={request.source.country} />
|
|
1285
|
+
<IpAddress>{request.source.ip}</IpAddress>
|
|
1286
|
+
</Ip>
|
|
1287
|
+
</AttributeValue>
|
|
1288
|
+
</Attribute>
|
|
1289
|
+
<Attribute orientation='horizontal'>
|
|
1290
|
+
<AttributeLabel>Request ID</AttributeLabel>
|
|
1291
|
+
<AttributeValue>
|
|
1292
|
+
<InlineCodeSnippet code={request.id} size='sm' />
|
|
1293
|
+
</AttributeValue>
|
|
1294
|
+
</Attribute>
|
|
1295
|
+
<Attribute orientation='horizontal' className='col-span-2'>
|
|
1296
|
+
<AttributeLabel>URI</AttributeLabel>
|
|
1297
|
+
<AttributeValue>
|
|
1298
|
+
<HStack gap={6}>
|
|
1299
|
+
<HttpMethod method={selected.method} />
|
|
1300
|
+
<Text size='sm' truncate>
|
|
1301
|
+
{selected.host}
|
|
1302
|
+
{selected.path}
|
|
1303
|
+
</Text>
|
|
1304
|
+
</HStack>
|
|
1305
|
+
</AttributeValue>
|
|
1306
|
+
</Attribute>
|
|
1307
|
+
</div>
|
|
1308
|
+
<div className='px-24 py-4'>
|
|
1309
|
+
<Separator />
|
|
1310
|
+
</div>
|
|
1311
|
+
<div className='px-24 py-8'>
|
|
1312
|
+
<Text size='md'>Attack</Text>
|
|
1313
|
+
</div>
|
|
1314
|
+
<div className='grid grid-cols-1 gap-y-6 px-24 pb-8'>
|
|
1315
|
+
<Attribute orientation='horizontal'>
|
|
1316
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
1317
|
+
<AttributeValue>
|
|
1318
|
+
<InlineCodeSnippet code={selected.point} size='sm' />
|
|
1319
|
+
</AttributeValue>
|
|
1320
|
+
</Attribute>
|
|
1321
|
+
<Attribute orientation='horizontal'>
|
|
1322
|
+
<AttributeLabel>Payload</AttributeLabel>
|
|
1323
|
+
<AttributeValue>
|
|
1324
|
+
<InlineCodeSnippet code={selected.payload} size='sm' />
|
|
1325
|
+
</AttributeValue>
|
|
1326
|
+
</Attribute>
|
|
1327
|
+
</div>
|
|
1328
|
+
<div className='px-24 py-4'>
|
|
1329
|
+
<Separator />
|
|
1330
|
+
</div>
|
|
1331
|
+
<div className='px-24 py-8'>
|
|
1332
|
+
<Text size='md'>Full request</Text>
|
|
1333
|
+
</div>
|
|
1334
|
+
<div className='px-24 pb-16'>
|
|
1335
|
+
<CodeSnippetRoot
|
|
1336
|
+
code={selected.request}
|
|
1337
|
+
language='text'
|
|
1338
|
+
lines={getPayloadLines(selected.request, selected.payload)}
|
|
1339
|
+
maxLines={15}
|
|
1340
|
+
wrapLines
|
|
1341
|
+
data-testid='attack-raw-request'
|
|
1342
|
+
>
|
|
1343
|
+
<CodeSnippetContent>
|
|
1344
|
+
<CodeSnippetLineNumbers />
|
|
1345
|
+
<CodeSnippetCode />
|
|
1346
|
+
</CodeSnippetContent>
|
|
1347
|
+
</CodeSnippetRoot>
|
|
1348
|
+
</div>
|
|
1349
|
+
</ScrollAreaContent>
|
|
1350
|
+
</ScrollAreaViewport>
|
|
1351
|
+
<ScrollAreaScrollbar />
|
|
1352
|
+
</ScrollArea>
|
|
1353
|
+
) : (
|
|
1354
|
+
<div className='flex h-full items-center justify-center'>
|
|
1355
|
+
<Text size='sm' color='secondary'>
|
|
1356
|
+
Select a request to view details
|
|
1357
|
+
</Text>
|
|
1358
|
+
</div>
|
|
1359
|
+
)}
|
|
1360
|
+
</div>
|
|
1361
|
+
</div>
|
|
1362
|
+
</div>
|
|
1363
|
+
)}
|
|
1364
|
+
</DrawerContent>
|
|
1365
|
+
</Drawer>
|
|
1366
|
+
</Page>
|
|
1367
|
+
);
|
|
1368
|
+
};
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
The list failed to load: "Couldn't load attacks" and "Try again" in place of the rows.
|
|
1372
|
+
|
|
1373
|
+
The list failed to load: header, export and filter stay, and the table shows "Couldn't load
|
|
1374
|
+
attacks" with "Try again" in place of the rows.
|
|
1375
|
+
|
|
1376
|
+
```tsx story=LoadError
|
|
1377
|
+
import { type MouseEvent, useState } from 'react';
|
|
1378
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
1379
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
1380
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
1381
|
+
import { CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
1382
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle } from '@wallarm-org/design-system/Drawer';
|
|
1383
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
1384
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
1385
|
+
import { type ExprNode, FilterInput } from '@wallarm-org/design-system/FilterInput';
|
|
1386
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
1387
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
1388
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
1389
|
+
import { ArrowDown, CloudOff, Download, Ellipsis, FilterX, Link, RefreshCcw, SearchX, ShieldBan, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
1390
|
+
import { Ip, IpAddress, IpCountry, IpProvider } from '@wallarm-org/design-system/Ip';
|
|
1391
|
+
import { Page, PageActions, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle, PageToolbar } from '@wallarm-org/design-system/Page';
|
|
1392
|
+
import { Pagination, PaginationList, PaginationNext, PaginationPageSize, PaginationPrevious, useClientPagination } from '@wallarm-org/design-system/Pagination';
|
|
1393
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
1394
|
+
import { ScrollArea, ScrollAreaContent, ScrollAreaScrollbar, ScrollAreaViewport } from '@wallarm-org/design-system/ScrollArea';
|
|
1395
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
1396
|
+
import { BarList, BarListBar, BarListItem, BarListLabel, BarListPercent, BarListValue, Chart, ChartHeader, ChartTitle, LegendDot, LineChart, LineChartBody, LineChartGrid, LineChartLine, LineChartTooltip, LineChartXAxis, LineChartYAxis, PieChart, PieChartCenter, PieChartCenterLabel, PieChartCenterValue, PieChartDonut, PieChartLegend, PieChartLegendItem, PieChartLegendPercent, PieChartLegendValue, useChartTimeFormatters } from '@wallarm-org/design-system/SimpleCharts';
|
|
1397
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
1398
|
+
import { type TableColumnDef, type TableRow, type TableRowSelectionState, type TableSortingState, Table, TableActionBar, TableEmptyState } from '@wallarm-org/design-system/Table';
|
|
1399
|
+
import { Tabs, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
1400
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
1401
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
1402
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
|
|
1403
|
+
|
|
1404
|
+
export const LoadError = ({
|
|
1405
|
+
initialFilter = SEVERITY_FILTER,
|
|
1406
|
+
isLoading = false,
|
|
1407
|
+
loadFailed = false,
|
|
1408
|
+
}) => {
|
|
1409
|
+
const [filter, setFilter] = useState<ExprNode | null>(initialFilter);
|
|
1410
|
+
const [sorting, setSorting] = useState<TableSortingState>([{ id: 'detectedAt', desc: true }]);
|
|
1411
|
+
const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});
|
|
1412
|
+
const [falsePositiveIds, setFalsePositiveIds] = useState<string[]>([]);
|
|
1413
|
+
const [failed, setFailed] = useState(loadFailed);
|
|
1414
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
1415
|
+
const [open, setOpen] = useState(false);
|
|
1416
|
+
const [tab, setTab] = useState('overview');
|
|
1417
|
+
const [requestId, setRequestId] = useState<string | null>(null);
|
|
1418
|
+
const { formatHour, formatHourWithTimezone } = useChartTimeFormatters();
|
|
1419
|
+
|
|
1420
|
+
const events = EVENTS.map(event =>
|
|
1421
|
+
falsePositiveIds.includes(event.id) ? { ...event, status: 'false-positive' as const } : event,
|
|
1422
|
+
);
|
|
1423
|
+
const rows =
|
|
1424
|
+
isLoading || failed
|
|
1425
|
+
? []
|
|
1426
|
+
: sortEvents(
|
|
1427
|
+
events.filter(event => matchesFilter(event, filter)),
|
|
1428
|
+
sorting,
|
|
1429
|
+
);
|
|
1430
|
+
const { pageData, ...pagination } = useClientPagination(rows, 10);
|
|
1431
|
+
const selected = events.find(event => event.id === selectedId) ?? null;
|
|
1432
|
+
const requests = selected ? getRequests(selected) : [];
|
|
1433
|
+
const request = requests.find(item => item.id === requestId) ?? null;
|
|
1434
|
+
const selectedIds = Object.keys(rowSelection).filter(id => rowSelection[id]);
|
|
1435
|
+
|
|
1436
|
+
const markFalsePositive = (ids: string[]) => setFalsePositiveIds([...falsePositiveIds, ...ids]);
|
|
1437
|
+
const openEvent = (id: string) => {
|
|
1438
|
+
setSelectedId(id);
|
|
1439
|
+
setTab('overview');
|
|
1440
|
+
setRequestId(null);
|
|
1441
|
+
setOpen(true);
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
const renderMenuAction = (row: TableRow<AttackEvent>) => {
|
|
1445
|
+
const event = row.original;
|
|
1446
|
+
const handleOpen = () => openEvent(event.id);
|
|
1447
|
+
const handleMarkFalsePositive = () => markFalsePositive([event.id]);
|
|
1448
|
+
const handleBlockSource = () => onBlockSources([event.ip]);
|
|
1449
|
+
|
|
1450
|
+
return (
|
|
1451
|
+
<DropdownMenu>
|
|
1452
|
+
<DropdownMenuTrigger asChild>
|
|
1453
|
+
<Button
|
|
1454
|
+
variant='ghost'
|
|
1455
|
+
color='neutral'
|
|
1456
|
+
size='small'
|
|
1457
|
+
aria-label={`Actions for event ${event.id}`}
|
|
1458
|
+
>
|
|
1459
|
+
<Ellipsis />
|
|
1460
|
+
</Button>
|
|
1461
|
+
</DropdownMenuTrigger>
|
|
1462
|
+
<DropdownMenuContent>
|
|
1463
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
1464
|
+
<DropdownMenuItemText>Open event</DropdownMenuItemText>
|
|
1465
|
+
</DropdownMenuItem>
|
|
1466
|
+
<DropdownMenuItem onSelect={handleMarkFalsePositive}>
|
|
1467
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
1468
|
+
</DropdownMenuItem>
|
|
1469
|
+
<DropdownMenuSeparator />
|
|
1470
|
+
<DropdownMenuItem variant='destructive' onSelect={handleBlockSource}>
|
|
1471
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
1472
|
+
</DropdownMenuItem>
|
|
1473
|
+
</DropdownMenuContent>
|
|
1474
|
+
</DropdownMenu>
|
|
1475
|
+
);
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
const columns: TableColumnDef<AttackEvent>[] = [
|
|
1479
|
+
{
|
|
1480
|
+
accessorKey: 'attackType',
|
|
1481
|
+
header: 'Attack',
|
|
1482
|
+
size: 250,
|
|
1483
|
+
cell: renderAttack,
|
|
1484
|
+
meta: { renderMenuAction },
|
|
1485
|
+
},
|
|
1486
|
+
{ accessorKey: 'severity', header: 'Severity', size: 100, cell: renderSeverity },
|
|
1487
|
+
{ accessorKey: 'status', header: 'Status', size: 130, cell: renderStatus },
|
|
1488
|
+
{ accessorKey: 'path', header: 'Request', size: 280, cell: renderRequest },
|
|
1489
|
+
{ accessorKey: 'ip', header: 'Source IP', size: 250, cell: renderSource },
|
|
1490
|
+
{ accessorKey: 'code', header: 'Code', size: 80, cell: renderCode },
|
|
1491
|
+
{
|
|
1492
|
+
accessorKey: 'hits',
|
|
1493
|
+
header: 'Hits',
|
|
1494
|
+
size: 80,
|
|
1495
|
+
meta: { description: { type: 'tooltip', content: 'Requests grouped into this attack' } },
|
|
1496
|
+
},
|
|
1497
|
+
{ accessorKey: 'detectedAt', header: 'Detected', size: 140, cell: renderDetectedAt },
|
|
1498
|
+
];
|
|
1499
|
+
|
|
1500
|
+
const handleResetFilters = () => setFilter(null);
|
|
1501
|
+
const handleRetry = () => setFailed(false);
|
|
1502
|
+
const handleBulkFalsePositive = () => {
|
|
1503
|
+
markFalsePositive(selectedIds);
|
|
1504
|
+
setRowSelection({});
|
|
1505
|
+
};
|
|
1506
|
+
const handleBulkBlock = () =>
|
|
1507
|
+
onBlockSources(events.filter(event => rowSelection[event.id]).map(event => event.ip));
|
|
1508
|
+
const handleBulkExport = () => onExportEvents(selectedIds);
|
|
1509
|
+
const handleCopyLink = () => onCopyLink(selected?.id);
|
|
1510
|
+
const handleSelectRequest = (event: MouseEvent<HTMLButtonElement>) =>
|
|
1511
|
+
setRequestId(event.currentTarget.value);
|
|
1512
|
+
const handleRequestFalsePositive = () => selected && markFalsePositive([selected.id]);
|
|
1513
|
+
const handleRequestBlock = () => request && onBlockSources([request.source.ip]);
|
|
1514
|
+
|
|
1515
|
+
const sources = selected ? getSources(selected) : [];
|
|
1516
|
+
const countries = new Set(sources.map(source => source.country)).size;
|
|
1517
|
+
const ipShares = selected ? getIpShares(selected) : [];
|
|
1518
|
+
const statusCodes = selected ? getStatusCodes(selected) : [];
|
|
1519
|
+
|
|
1520
|
+
return (
|
|
1521
|
+
<Page name='attack-events' fullSize fixedHeight data-testid='attacks-page'>
|
|
1522
|
+
<PageHeader>
|
|
1523
|
+
<PageHeaderGroup className='flex-1'>
|
|
1524
|
+
<PageTitle>Attack events</PageTitle>
|
|
1525
|
+
<PageDescription>
|
|
1526
|
+
Malicious requests the filtering nodes detected across your applications, and how each
|
|
1527
|
+
was handled.
|
|
1528
|
+
</PageDescription>
|
|
1529
|
+
</PageHeaderGroup>
|
|
1530
|
+
<PageActions>
|
|
1531
|
+
<Button
|
|
1532
|
+
size='medium'
|
|
1533
|
+
variant='outline'
|
|
1534
|
+
color='neutral'
|
|
1535
|
+
onClick={onExportEvents}
|
|
1536
|
+
data-testid='attacks-export'
|
|
1537
|
+
>
|
|
1538
|
+
<Download />
|
|
1539
|
+
Export CSV
|
|
1540
|
+
</Button>
|
|
1541
|
+
</PageActions>
|
|
1542
|
+
</PageHeader>
|
|
1543
|
+
|
|
1544
|
+
<PageToolbar>
|
|
1545
|
+
<FilterInput
|
|
1546
|
+
fields={FILTER_FIELDS}
|
|
1547
|
+
value={filter}
|
|
1548
|
+
onChange={setFilter}
|
|
1549
|
+
placeholder='Filter by attack type, severity, status, source IP, host or date'
|
|
1550
|
+
data-testid='attacks-filter'
|
|
1551
|
+
/>
|
|
1552
|
+
</PageToolbar>
|
|
1553
|
+
|
|
1554
|
+
<PageContent>
|
|
1555
|
+
<VStack gap={12}>
|
|
1556
|
+
<Table
|
|
1557
|
+
aria-label='Attack events'
|
|
1558
|
+
data={pageData}
|
|
1559
|
+
columns={columns}
|
|
1560
|
+
getRowId={getEventId}
|
|
1561
|
+
isLoading={isLoading}
|
|
1562
|
+
sorting={sorting}
|
|
1563
|
+
onSortingChange={setSorting}
|
|
1564
|
+
manualSorting
|
|
1565
|
+
rowSelection={rowSelection}
|
|
1566
|
+
onRowSelectionChange={setRowSelection}
|
|
1567
|
+
activeRowId={open ? selectedId : null}
|
|
1568
|
+
onMasterCellClick={openEvent}
|
|
1569
|
+
data-testid='attacks-table'
|
|
1570
|
+
>
|
|
1571
|
+
<TableActionBar>
|
|
1572
|
+
<Button
|
|
1573
|
+
variant='ghost'
|
|
1574
|
+
color='neutral-alt'
|
|
1575
|
+
onClick={handleBulkFalsePositive}
|
|
1576
|
+
data-testid='attacks-bulk-false-positive'
|
|
1577
|
+
>
|
|
1578
|
+
<ShieldCheck /> Mark as false positive
|
|
1579
|
+
</Button>
|
|
1580
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkBlock}>
|
|
1581
|
+
<ShieldBan /> Block source IPs
|
|
1582
|
+
</Button>
|
|
1583
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkExport}>
|
|
1584
|
+
<Download /> Export
|
|
1585
|
+
</Button>
|
|
1586
|
+
</TableActionBar>
|
|
1587
|
+
<TableEmptyState>
|
|
1588
|
+
{failed ? (
|
|
1589
|
+
<EmptyState data-testid='attacks-error'>
|
|
1590
|
+
<EmptyStateIllustration>
|
|
1591
|
+
<CloudOff />
|
|
1592
|
+
</EmptyStateIllustration>
|
|
1593
|
+
<EmptyStateMessage>
|
|
1594
|
+
<EmptyStateTitle>Couldn't load attacks</EmptyStateTitle>
|
|
1595
|
+
<EmptyStateDescription>
|
|
1596
|
+
The server didn't respond. Detection keeps running; try again in a moment.
|
|
1597
|
+
</EmptyStateDescription>
|
|
1598
|
+
</EmptyStateMessage>
|
|
1599
|
+
<EmptyStateActions>
|
|
1600
|
+
<Button
|
|
1601
|
+
size='medium'
|
|
1602
|
+
variant='outline'
|
|
1603
|
+
color='neutral'
|
|
1604
|
+
onClick={handleRetry}
|
|
1605
|
+
data-testid='attacks-retry'
|
|
1606
|
+
>
|
|
1607
|
+
<RefreshCcw />
|
|
1608
|
+
Try again
|
|
1609
|
+
</Button>
|
|
1610
|
+
</EmptyStateActions>
|
|
1611
|
+
</EmptyState>
|
|
1612
|
+
) : (
|
|
1613
|
+
<EmptyState type='collection-empty' data-testid='attacks-no-results'>
|
|
1614
|
+
<EmptyStateIllustration>
|
|
1615
|
+
<SearchX />
|
|
1616
|
+
</EmptyStateIllustration>
|
|
1617
|
+
<EmptyStateMessage>
|
|
1618
|
+
<EmptyStateTitle>No results found</EmptyStateTitle>
|
|
1619
|
+
<EmptyStateDescription>No attacks match the filter.</EmptyStateDescription>
|
|
1620
|
+
</EmptyStateMessage>
|
|
1621
|
+
<EmptyStateActions>
|
|
1622
|
+
<Button
|
|
1623
|
+
size='medium'
|
|
1624
|
+
variant='outline'
|
|
1625
|
+
color='neutral'
|
|
1626
|
+
onClick={handleResetFilters}
|
|
1627
|
+
data-testid='attacks-reset-filters'
|
|
1628
|
+
>
|
|
1629
|
+
<FilterX />
|
|
1630
|
+
Reset filters
|
|
1631
|
+
</Button>
|
|
1632
|
+
</EmptyStateActions>
|
|
1633
|
+
</EmptyState>
|
|
1634
|
+
)}
|
|
1635
|
+
</TableEmptyState>
|
|
1636
|
+
</Table>
|
|
1637
|
+
{rows.length > 0 && (
|
|
1638
|
+
<Pagination
|
|
1639
|
+
{...pagination}
|
|
1640
|
+
align='right'
|
|
1641
|
+
aria-label='Attack events pages'
|
|
1642
|
+
data-testid='attacks-pagination'
|
|
1643
|
+
>
|
|
1644
|
+
<PaginationPageSize options={[10, 25, 50]} />
|
|
1645
|
+
<PaginationPrevious />
|
|
1646
|
+
<PaginationList />
|
|
1647
|
+
<PaginationNext />
|
|
1648
|
+
</Pagination>
|
|
1649
|
+
)}
|
|
1650
|
+
</VStack>
|
|
1651
|
+
</PageContent>
|
|
1652
|
+
|
|
1653
|
+
<Drawer
|
|
1654
|
+
open={open}
|
|
1655
|
+
onOpenChange={setOpen}
|
|
1656
|
+
modal={false}
|
|
1657
|
+
overlay={false}
|
|
1658
|
+
closeOnOutsideClick={false}
|
|
1659
|
+
width={1064}
|
|
1660
|
+
data-testid='attack-drawer'
|
|
1661
|
+
>
|
|
1662
|
+
<DrawerContent>
|
|
1663
|
+
<DrawerResizeHandle onResizeEnd={onSaveDrawerWidth} />
|
|
1664
|
+
<DrawerHeader>
|
|
1665
|
+
<HStack align='start' justify='between' gap={16} fullWidth className='min-w-0'>
|
|
1666
|
+
<VStack gap={4} className='min-w-0' data-testid='attack-summary'>
|
|
1667
|
+
<Heading as='h2' size='xl' weight='medium' truncate>
|
|
1668
|
+
{selected &&
|
|
1669
|
+
`${ATTACK_TYPES[selected.attackType]} in ${selected.point} on ${selected.host}`}
|
|
1670
|
+
</Heading>
|
|
1671
|
+
{selected && (
|
|
1672
|
+
<HStack gap={4} align='center'>
|
|
1673
|
+
<Badge
|
|
1674
|
+
variant='dotted'
|
|
1675
|
+
type='secondary'
|
|
1676
|
+
size='medium'
|
|
1677
|
+
color={STATUS[selected.status].color}
|
|
1678
|
+
>
|
|
1679
|
+
{STATUS[selected.status].label}
|
|
1680
|
+
</Badge>
|
|
1681
|
+
<Text size='xs' color='secondary'>
|
|
1682
|
+
·
|
|
1683
|
+
</Text>
|
|
1684
|
+
<Text size='xs' color='secondary'>
|
|
1685
|
+
{selected.status === 'blocked' ? selected.hits : 0}/{selected.hits} blocked
|
|
1686
|
+
</Text>
|
|
1687
|
+
<Text size='xs' color='secondary'>
|
|
1688
|
+
·
|
|
1689
|
+
</Text>
|
|
1690
|
+
<Text size='xs' color='secondary'>
|
|
1691
|
+
{sources.length} {sources.length === 1 ? 'IP' : 'IPs'} across {countries}{' '}
|
|
1692
|
+
{countries === 1 ? 'country' : 'countries'}
|
|
1693
|
+
</Text>
|
|
1694
|
+
</HStack>
|
|
1695
|
+
)}
|
|
1696
|
+
</VStack>
|
|
1697
|
+
<Tooltip>
|
|
1698
|
+
<TooltipTrigger asChild>
|
|
1699
|
+
<Button
|
|
1700
|
+
variant='ghost'
|
|
1701
|
+
color='neutral'
|
|
1702
|
+
size='small'
|
|
1703
|
+
aria-label='Copy link'
|
|
1704
|
+
onClick={handleCopyLink}
|
|
1705
|
+
>
|
|
1706
|
+
<Link />
|
|
1707
|
+
</Button>
|
|
1708
|
+
</TooltipTrigger>
|
|
1709
|
+
<TooltipContent>Copy link</TooltipContent>
|
|
1710
|
+
</Tooltip>
|
|
1711
|
+
</HStack>
|
|
1712
|
+
</DrawerHeader>
|
|
1713
|
+
<Tabs value={tab} onChange={setTab} data-testid='attack-tabs'>
|
|
1714
|
+
<TabsList>
|
|
1715
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
1716
|
+
<TabsTrigger value='requests'>
|
|
1717
|
+
Requests
|
|
1718
|
+
<Badge type='secondary' color='slate' size='medium' className='ml-4'>
|
|
1719
|
+
{selected && formatCount(selected.hits)}
|
|
1720
|
+
</Badge>
|
|
1721
|
+
</TabsTrigger>
|
|
1722
|
+
</TabsList>
|
|
1723
|
+
</Tabs>
|
|
1724
|
+
|
|
1725
|
+
{selected && tab === 'overview' && (
|
|
1726
|
+
<DrawerBody>
|
|
1727
|
+
<VStack gap={12} className='py-16' data-testid='attack-overview'>
|
|
1728
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'>
|
|
1729
|
+
<Attribute>
|
|
1730
|
+
<AttributeLabel>Severity</AttributeLabel>
|
|
1731
|
+
<AttributeValue>
|
|
1732
|
+
<Badge
|
|
1733
|
+
type='secondary'
|
|
1734
|
+
size='medium'
|
|
1735
|
+
color={SEVERITY[selected.severity].color}
|
|
1736
|
+
>
|
|
1737
|
+
{SEVERITY[selected.severity].label}
|
|
1738
|
+
</Badge>
|
|
1739
|
+
</AttributeValue>
|
|
1740
|
+
</Attribute>
|
|
1741
|
+
<Attribute>
|
|
1742
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
1743
|
+
<AttributeValue>
|
|
1744
|
+
<FormatDateTime
|
|
1745
|
+
value={getFirstSeen(selected)}
|
|
1746
|
+
format='datetime'
|
|
1747
|
+
layout='inline'
|
|
1748
|
+
/>
|
|
1749
|
+
</AttributeValue>
|
|
1750
|
+
</Attribute>
|
|
1751
|
+
<Attribute>
|
|
1752
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
1753
|
+
<AttributeValue>
|
|
1754
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1755
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
1756
|
+
</Badge>
|
|
1757
|
+
</AttributeValue>
|
|
1758
|
+
</Attribute>
|
|
1759
|
+
<Attribute>
|
|
1760
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
1761
|
+
<AttributeValue>
|
|
1762
|
+
<FormatDateTime
|
|
1763
|
+
value={selected.detectedAt}
|
|
1764
|
+
format='datetime'
|
|
1765
|
+
layout='inline'
|
|
1766
|
+
/>
|
|
1767
|
+
</AttributeValue>
|
|
1768
|
+
</Attribute>
|
|
1769
|
+
<Attribute>
|
|
1770
|
+
<AttributeLabel>Application</AttributeLabel>
|
|
1771
|
+
<AttributeValue>
|
|
1772
|
+
<Tag>{selected.application}</Tag>
|
|
1773
|
+
</AttributeValue>
|
|
1774
|
+
</Attribute>
|
|
1775
|
+
<Attribute>
|
|
1776
|
+
<AttributeLabel>Node</AttributeLabel>
|
|
1777
|
+
<AttributeValue>
|
|
1778
|
+
<InlineCodeSnippet code={selected.node} size='md' />
|
|
1779
|
+
</AttributeValue>
|
|
1780
|
+
</Attribute>
|
|
1781
|
+
<Attribute className='col-span-2'>
|
|
1782
|
+
<AttributeLabel>IPs</AttributeLabel>
|
|
1783
|
+
<AttributeValue>
|
|
1784
|
+
<HStack gap={8}>
|
|
1785
|
+
{sources.map(source => (
|
|
1786
|
+
<Ip key={source.ip}>
|
|
1787
|
+
<IpCountry code={source.country} />
|
|
1788
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
1789
|
+
{source.provider && <IpProvider>{source.provider}</IpProvider>}
|
|
1790
|
+
</Ip>
|
|
1791
|
+
))}
|
|
1792
|
+
</HStack>
|
|
1793
|
+
</AttributeValue>
|
|
1794
|
+
</Attribute>
|
|
1795
|
+
</div>
|
|
1796
|
+
<Chart>
|
|
1797
|
+
<ChartHeader>
|
|
1798
|
+
<ChartTitle>Timeline</ChartTitle>
|
|
1799
|
+
</ChartHeader>
|
|
1800
|
+
<LineChart data={getTimeline(selected)} series={TIMELINE_SERIES} xKey='timestamp'>
|
|
1801
|
+
<LineChartBody>
|
|
1802
|
+
<LineChartGrid />
|
|
1803
|
+
<LineChartXAxis tickFormatter={formatHour} minTickGap={48} />
|
|
1804
|
+
<LineChartYAxis />
|
|
1805
|
+
<LineChartLine seriesKey='hits' curve='linear' />
|
|
1806
|
+
<LineChartTooltip xTickFormatter={formatHourWithTimezone} />
|
|
1807
|
+
</LineChartBody>
|
|
1808
|
+
</LineChart>
|
|
1809
|
+
</Chart>
|
|
1810
|
+
<div className='grid grid-cols-2 gap-12'>
|
|
1811
|
+
<Chart>
|
|
1812
|
+
<ChartHeader>
|
|
1813
|
+
<ChartTitle>Top 5 IPs</ChartTitle>
|
|
1814
|
+
</ChartHeader>
|
|
1815
|
+
<BarList max={sumValues(ipShares)}>
|
|
1816
|
+
{ipShares.map(row => (
|
|
1817
|
+
<BarListItem key={row.name} value={row.value}>
|
|
1818
|
+
<BarListBar />
|
|
1819
|
+
<BarListLabel>{row.name}</BarListLabel>
|
|
1820
|
+
<BarListValue>
|
|
1821
|
+
<BarListPercent />
|
|
1822
|
+
</BarListValue>
|
|
1823
|
+
</BarListItem>
|
|
1824
|
+
))}
|
|
1825
|
+
</BarList>
|
|
1826
|
+
</Chart>
|
|
1827
|
+
<Chart>
|
|
1828
|
+
<ChartHeader>
|
|
1829
|
+
<ChartTitle>Status codes</ChartTitle>
|
|
1830
|
+
</ChartHeader>
|
|
1831
|
+
<PieChart data={statusCodes} total={sumValues(statusCodes)}>
|
|
1832
|
+
<PieChartDonut>
|
|
1833
|
+
<PieChartCenter>
|
|
1834
|
+
<PieChartCenterValue>{formatCount(selected.hits)}</PieChartCenterValue>
|
|
1835
|
+
<PieChartCenterLabel pluralize={{ one: 'hit', other: 'hits' }} />
|
|
1836
|
+
</PieChartCenter>
|
|
1837
|
+
</PieChartDonut>
|
|
1838
|
+
<PieChartLegend>
|
|
1839
|
+
{statusCodes.map(row => (
|
|
1840
|
+
<PieChartLegendItem key={row.name} name={row.name}>
|
|
1841
|
+
<Badge color={row.color} type='secondary' textVariant='code'>
|
|
1842
|
+
{row.name}
|
|
1843
|
+
</Badge>
|
|
1844
|
+
<PieChartLegendValue>
|
|
1845
|
+
{formatCount(row.value)}
|
|
1846
|
+
<LegendDot />
|
|
1847
|
+
<PieChartLegendPercent />
|
|
1848
|
+
</PieChartLegendValue>
|
|
1849
|
+
</PieChartLegendItem>
|
|
1850
|
+
))}
|
|
1851
|
+
</PieChartLegend>
|
|
1852
|
+
</PieChart>
|
|
1853
|
+
</Chart>
|
|
1854
|
+
</div>
|
|
1855
|
+
</VStack>
|
|
1856
|
+
</DrawerBody>
|
|
1857
|
+
)}
|
|
1858
|
+
|
|
1859
|
+
{selected && tab === 'requests' && (
|
|
1860
|
+
<div className='flex min-h-0 flex-1 flex-col' data-testid='attack-requests'>
|
|
1861
|
+
<HStack gap={8} className='shrink-0 border-b border-border-primary-light px-16 py-8'>
|
|
1862
|
+
<div className='min-w-0 flex-1'>
|
|
1863
|
+
<FilterInput placeholder='Filter requests...' />
|
|
1864
|
+
</div>
|
|
1865
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
1866
|
+
<ArrowDown /> Date
|
|
1867
|
+
</Button>
|
|
1868
|
+
</HStack>
|
|
1869
|
+
<div className='flex min-h-0 flex-1'>
|
|
1870
|
+
<div className='w-320 shrink-0 border-r border-border-primary-light'>
|
|
1871
|
+
<ScrollArea>
|
|
1872
|
+
<ScrollAreaViewport>
|
|
1873
|
+
<ScrollAreaContent>
|
|
1874
|
+
<VStack gap={2} className='p-8' data-testid='attack-request-list'>
|
|
1875
|
+
{requests.map(item => (
|
|
1876
|
+
<button
|
|
1877
|
+
key={item.id}
|
|
1878
|
+
type='button'
|
|
1879
|
+
value={item.id}
|
|
1880
|
+
aria-pressed={item.id === requestId}
|
|
1881
|
+
onClick={handleSelectRequest}
|
|
1882
|
+
className={
|
|
1883
|
+
item.id === requestId
|
|
1884
|
+
? 'w-full rounded-8 bg-states-primary-default-alt p-8 text-left'
|
|
1885
|
+
: 'w-full rounded-8 p-8 text-left hover:bg-states-primary-hover'
|
|
1886
|
+
}
|
|
1887
|
+
>
|
|
1888
|
+
<VStack gap={2}>
|
|
1889
|
+
<HStack gap={4}>
|
|
1890
|
+
<FormatDateTime
|
|
1891
|
+
value={item.time}
|
|
1892
|
+
format='datetime'
|
|
1893
|
+
layout='inline'
|
|
1894
|
+
/>
|
|
1895
|
+
<div className='ml-auto'>
|
|
1896
|
+
<ResponseCode code={item.code} />
|
|
1897
|
+
</div>
|
|
1898
|
+
</HStack>
|
|
1899
|
+
<HStack gap={4}>
|
|
1900
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1901
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
1902
|
+
</Badge>
|
|
1903
|
+
</HStack>
|
|
1904
|
+
<HStack gap={4}>
|
|
1905
|
+
<HttpMethod method={selected.method} />
|
|
1906
|
+
<Text size='xs' truncate>
|
|
1907
|
+
{selected.path}
|
|
1908
|
+
</Text>
|
|
1909
|
+
</HStack>
|
|
1910
|
+
<Text size='xs' color='secondary' truncate>
|
|
1911
|
+
{selected.host}
|
|
1912
|
+
</Text>
|
|
1913
|
+
</VStack>
|
|
1914
|
+
</button>
|
|
1915
|
+
))}
|
|
1916
|
+
</VStack>
|
|
1917
|
+
</ScrollAreaContent>
|
|
1918
|
+
</ScrollAreaViewport>
|
|
1919
|
+
<ScrollAreaScrollbar />
|
|
1920
|
+
</ScrollArea>
|
|
1921
|
+
</div>
|
|
1922
|
+
<div className='min-w-0 flex-1' data-testid='attack-request'>
|
|
1923
|
+
{request ? (
|
|
1924
|
+
<ScrollArea>
|
|
1925
|
+
<ScrollAreaViewport>
|
|
1926
|
+
<ScrollAreaContent>
|
|
1927
|
+
<HStack justify='between' className='px-24 py-8'>
|
|
1928
|
+
<Text size='md'>Request details</Text>
|
|
1929
|
+
<DropdownMenu>
|
|
1930
|
+
<DropdownMenuTrigger asChild>
|
|
1931
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
1932
|
+
Actions
|
|
1933
|
+
</Button>
|
|
1934
|
+
</DropdownMenuTrigger>
|
|
1935
|
+
<DropdownMenuContent>
|
|
1936
|
+
<DropdownMenuItem onSelect={handleRequestFalsePositive}>
|
|
1937
|
+
<DropdownMenuItemText>
|
|
1938
|
+
Mark as false positive
|
|
1939
|
+
</DropdownMenuItemText>
|
|
1940
|
+
</DropdownMenuItem>
|
|
1941
|
+
<DropdownMenuSeparator />
|
|
1942
|
+
<DropdownMenuItem
|
|
1943
|
+
variant='destructive'
|
|
1944
|
+
onSelect={handleRequestBlock}
|
|
1945
|
+
>
|
|
1946
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
1947
|
+
</DropdownMenuItem>
|
|
1948
|
+
</DropdownMenuContent>
|
|
1949
|
+
</DropdownMenu>
|
|
1950
|
+
</HStack>
|
|
1951
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-6 px-24 pb-8'>
|
|
1952
|
+
<Attribute orientation='horizontal'>
|
|
1953
|
+
<AttributeLabel>Source IP</AttributeLabel>
|
|
1954
|
+
<AttributeValue>
|
|
1955
|
+
<Ip>
|
|
1956
|
+
<IpCountry code={request.source.country} />
|
|
1957
|
+
<IpAddress>{request.source.ip}</IpAddress>
|
|
1958
|
+
</Ip>
|
|
1959
|
+
</AttributeValue>
|
|
1960
|
+
</Attribute>
|
|
1961
|
+
<Attribute orientation='horizontal'>
|
|
1962
|
+
<AttributeLabel>Request ID</AttributeLabel>
|
|
1963
|
+
<AttributeValue>
|
|
1964
|
+
<InlineCodeSnippet code={request.id} size='sm' />
|
|
1965
|
+
</AttributeValue>
|
|
1966
|
+
</Attribute>
|
|
1967
|
+
<Attribute orientation='horizontal' className='col-span-2'>
|
|
1968
|
+
<AttributeLabel>URI</AttributeLabel>
|
|
1969
|
+
<AttributeValue>
|
|
1970
|
+
<HStack gap={6}>
|
|
1971
|
+
<HttpMethod method={selected.method} />
|
|
1972
|
+
<Text size='sm' truncate>
|
|
1973
|
+
{selected.host}
|
|
1974
|
+
{selected.path}
|
|
1975
|
+
</Text>
|
|
1976
|
+
</HStack>
|
|
1977
|
+
</AttributeValue>
|
|
1978
|
+
</Attribute>
|
|
1979
|
+
</div>
|
|
1980
|
+
<div className='px-24 py-4'>
|
|
1981
|
+
<Separator />
|
|
1982
|
+
</div>
|
|
1983
|
+
<div className='px-24 py-8'>
|
|
1984
|
+
<Text size='md'>Attack</Text>
|
|
1985
|
+
</div>
|
|
1986
|
+
<div className='grid grid-cols-1 gap-y-6 px-24 pb-8'>
|
|
1987
|
+
<Attribute orientation='horizontal'>
|
|
1988
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
1989
|
+
<AttributeValue>
|
|
1990
|
+
<InlineCodeSnippet code={selected.point} size='sm' />
|
|
1991
|
+
</AttributeValue>
|
|
1992
|
+
</Attribute>
|
|
1993
|
+
<Attribute orientation='horizontal'>
|
|
1994
|
+
<AttributeLabel>Payload</AttributeLabel>
|
|
1995
|
+
<AttributeValue>
|
|
1996
|
+
<InlineCodeSnippet code={selected.payload} size='sm' />
|
|
1997
|
+
</AttributeValue>
|
|
1998
|
+
</Attribute>
|
|
1999
|
+
</div>
|
|
2000
|
+
<div className='px-24 py-4'>
|
|
2001
|
+
<Separator />
|
|
2002
|
+
</div>
|
|
2003
|
+
<div className='px-24 py-8'>
|
|
2004
|
+
<Text size='md'>Full request</Text>
|
|
2005
|
+
</div>
|
|
2006
|
+
<div className='px-24 pb-16'>
|
|
2007
|
+
<CodeSnippetRoot
|
|
2008
|
+
code={selected.request}
|
|
2009
|
+
language='text'
|
|
2010
|
+
lines={getPayloadLines(selected.request, selected.payload)}
|
|
2011
|
+
maxLines={15}
|
|
2012
|
+
wrapLines
|
|
2013
|
+
data-testid='attack-raw-request'
|
|
2014
|
+
>
|
|
2015
|
+
<CodeSnippetContent>
|
|
2016
|
+
<CodeSnippetLineNumbers />
|
|
2017
|
+
<CodeSnippetCode />
|
|
2018
|
+
</CodeSnippetContent>
|
|
2019
|
+
</CodeSnippetRoot>
|
|
2020
|
+
</div>
|
|
2021
|
+
</ScrollAreaContent>
|
|
2022
|
+
</ScrollAreaViewport>
|
|
2023
|
+
<ScrollAreaScrollbar />
|
|
2024
|
+
</ScrollArea>
|
|
2025
|
+
) : (
|
|
2026
|
+
<div className='flex h-full items-center justify-center'>
|
|
2027
|
+
<Text size='sm' color='secondary'>
|
|
2028
|
+
Select a request to view details
|
|
2029
|
+
</Text>
|
|
2030
|
+
</div>
|
|
2031
|
+
)}
|
|
2032
|
+
</div>
|
|
2033
|
+
</div>
|
|
2034
|
+
</div>
|
|
2035
|
+
)}
|
|
2036
|
+
</DrawerContent>
|
|
2037
|
+
</Drawer>
|
|
2038
|
+
</Page>
|
|
2039
|
+
);
|
|
2040
|
+
};
|
|
2041
|
+
```
|
|
2042
|
+
|
|
2043
|
+
First load: the real header and filter over skeleton rows.
|
|
2044
|
+
|
|
2045
|
+
First load: the real header and filter, and skeleton rows under the table header. Never a
|
|
2046
|
+
`Loader` in place of the table; the pager waits for the first page.
|
|
2047
|
+
|
|
2048
|
+
```tsx story=Loading
|
|
2049
|
+
import { type MouseEvent, useState } from 'react';
|
|
2050
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
2051
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
2052
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
2053
|
+
import { CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
2054
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle } from '@wallarm-org/design-system/Drawer';
|
|
2055
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
2056
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
2057
|
+
import { type ExprNode, FilterInput } from '@wallarm-org/design-system/FilterInput';
|
|
2058
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
2059
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
2060
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
2061
|
+
import { ArrowDown, CloudOff, Download, Ellipsis, FilterX, Link, RefreshCcw, SearchX, ShieldBan, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
2062
|
+
import { Ip, IpAddress, IpCountry, IpProvider } from '@wallarm-org/design-system/Ip';
|
|
2063
|
+
import { Page, PageActions, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle, PageToolbar } from '@wallarm-org/design-system/Page';
|
|
2064
|
+
import { Pagination, PaginationList, PaginationNext, PaginationPageSize, PaginationPrevious, useClientPagination } from '@wallarm-org/design-system/Pagination';
|
|
2065
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
2066
|
+
import { ScrollArea, ScrollAreaContent, ScrollAreaScrollbar, ScrollAreaViewport } from '@wallarm-org/design-system/ScrollArea';
|
|
2067
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
2068
|
+
import { BarList, BarListBar, BarListItem, BarListLabel, BarListPercent, BarListValue, Chart, ChartHeader, ChartTitle, LegendDot, LineChart, LineChartBody, LineChartGrid, LineChartLine, LineChartTooltip, LineChartXAxis, LineChartYAxis, PieChart, PieChartCenter, PieChartCenterLabel, PieChartCenterValue, PieChartDonut, PieChartLegend, PieChartLegendItem, PieChartLegendPercent, PieChartLegendValue, useChartTimeFormatters } from '@wallarm-org/design-system/SimpleCharts';
|
|
2069
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
2070
|
+
import { type TableColumnDef, type TableRow, type TableRowSelectionState, type TableSortingState, Table, TableActionBar, TableEmptyState } from '@wallarm-org/design-system/Table';
|
|
2071
|
+
import { Tabs, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
2072
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
2073
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
2074
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
|
|
2075
|
+
|
|
2076
|
+
export const Loading = ({
|
|
2077
|
+
initialFilter = SEVERITY_FILTER,
|
|
2078
|
+
isLoading = false,
|
|
2079
|
+
loadFailed = false,
|
|
2080
|
+
}) => {
|
|
2081
|
+
const [filter, setFilter] = useState<ExprNode | null>(initialFilter);
|
|
2082
|
+
const [sorting, setSorting] = useState<TableSortingState>([{ id: 'detectedAt', desc: true }]);
|
|
2083
|
+
const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});
|
|
2084
|
+
const [falsePositiveIds, setFalsePositiveIds] = useState<string[]>([]);
|
|
2085
|
+
const [failed, setFailed] = useState(loadFailed);
|
|
2086
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
2087
|
+
const [open, setOpen] = useState(false);
|
|
2088
|
+
const [tab, setTab] = useState('overview');
|
|
2089
|
+
const [requestId, setRequestId] = useState<string | null>(null);
|
|
2090
|
+
const { formatHour, formatHourWithTimezone } = useChartTimeFormatters();
|
|
2091
|
+
|
|
2092
|
+
const events = EVENTS.map(event =>
|
|
2093
|
+
falsePositiveIds.includes(event.id) ? { ...event, status: 'false-positive' as const } : event,
|
|
2094
|
+
);
|
|
2095
|
+
const rows =
|
|
2096
|
+
isLoading || failed
|
|
2097
|
+
? []
|
|
2098
|
+
: sortEvents(
|
|
2099
|
+
events.filter(event => matchesFilter(event, filter)),
|
|
2100
|
+
sorting,
|
|
2101
|
+
);
|
|
2102
|
+
const { pageData, ...pagination } = useClientPagination(rows, 10);
|
|
2103
|
+
const selected = events.find(event => event.id === selectedId) ?? null;
|
|
2104
|
+
const requests = selected ? getRequests(selected) : [];
|
|
2105
|
+
const request = requests.find(item => item.id === requestId) ?? null;
|
|
2106
|
+
const selectedIds = Object.keys(rowSelection).filter(id => rowSelection[id]);
|
|
2107
|
+
|
|
2108
|
+
const markFalsePositive = (ids: string[]) => setFalsePositiveIds([...falsePositiveIds, ...ids]);
|
|
2109
|
+
const openEvent = (id: string) => {
|
|
2110
|
+
setSelectedId(id);
|
|
2111
|
+
setTab('overview');
|
|
2112
|
+
setRequestId(null);
|
|
2113
|
+
setOpen(true);
|
|
2114
|
+
};
|
|
2115
|
+
|
|
2116
|
+
const renderMenuAction = (row: TableRow<AttackEvent>) => {
|
|
2117
|
+
const event = row.original;
|
|
2118
|
+
const handleOpen = () => openEvent(event.id);
|
|
2119
|
+
const handleMarkFalsePositive = () => markFalsePositive([event.id]);
|
|
2120
|
+
const handleBlockSource = () => onBlockSources([event.ip]);
|
|
2121
|
+
|
|
2122
|
+
return (
|
|
2123
|
+
<DropdownMenu>
|
|
2124
|
+
<DropdownMenuTrigger asChild>
|
|
2125
|
+
<Button
|
|
2126
|
+
variant='ghost'
|
|
2127
|
+
color='neutral'
|
|
2128
|
+
size='small'
|
|
2129
|
+
aria-label={`Actions for event ${event.id}`}
|
|
2130
|
+
>
|
|
2131
|
+
<Ellipsis />
|
|
2132
|
+
</Button>
|
|
2133
|
+
</DropdownMenuTrigger>
|
|
2134
|
+
<DropdownMenuContent>
|
|
2135
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
2136
|
+
<DropdownMenuItemText>Open event</DropdownMenuItemText>
|
|
2137
|
+
</DropdownMenuItem>
|
|
2138
|
+
<DropdownMenuItem onSelect={handleMarkFalsePositive}>
|
|
2139
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
2140
|
+
</DropdownMenuItem>
|
|
2141
|
+
<DropdownMenuSeparator />
|
|
2142
|
+
<DropdownMenuItem variant='destructive' onSelect={handleBlockSource}>
|
|
2143
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
2144
|
+
</DropdownMenuItem>
|
|
2145
|
+
</DropdownMenuContent>
|
|
2146
|
+
</DropdownMenu>
|
|
2147
|
+
);
|
|
2148
|
+
};
|
|
2149
|
+
|
|
2150
|
+
const columns: TableColumnDef<AttackEvent>[] = [
|
|
2151
|
+
{
|
|
2152
|
+
accessorKey: 'attackType',
|
|
2153
|
+
header: 'Attack',
|
|
2154
|
+
size: 250,
|
|
2155
|
+
cell: renderAttack,
|
|
2156
|
+
meta: { renderMenuAction },
|
|
2157
|
+
},
|
|
2158
|
+
{ accessorKey: 'severity', header: 'Severity', size: 100, cell: renderSeverity },
|
|
2159
|
+
{ accessorKey: 'status', header: 'Status', size: 130, cell: renderStatus },
|
|
2160
|
+
{ accessorKey: 'path', header: 'Request', size: 280, cell: renderRequest },
|
|
2161
|
+
{ accessorKey: 'ip', header: 'Source IP', size: 250, cell: renderSource },
|
|
2162
|
+
{ accessorKey: 'code', header: 'Code', size: 80, cell: renderCode },
|
|
2163
|
+
{
|
|
2164
|
+
accessorKey: 'hits',
|
|
2165
|
+
header: 'Hits',
|
|
2166
|
+
size: 80,
|
|
2167
|
+
meta: { description: { type: 'tooltip', content: 'Requests grouped into this attack' } },
|
|
2168
|
+
},
|
|
2169
|
+
{ accessorKey: 'detectedAt', header: 'Detected', size: 140, cell: renderDetectedAt },
|
|
2170
|
+
];
|
|
2171
|
+
|
|
2172
|
+
const handleResetFilters = () => setFilter(null);
|
|
2173
|
+
const handleRetry = () => setFailed(false);
|
|
2174
|
+
const handleBulkFalsePositive = () => {
|
|
2175
|
+
markFalsePositive(selectedIds);
|
|
2176
|
+
setRowSelection({});
|
|
2177
|
+
};
|
|
2178
|
+
const handleBulkBlock = () =>
|
|
2179
|
+
onBlockSources(events.filter(event => rowSelection[event.id]).map(event => event.ip));
|
|
2180
|
+
const handleBulkExport = () => onExportEvents(selectedIds);
|
|
2181
|
+
const handleCopyLink = () => onCopyLink(selected?.id);
|
|
2182
|
+
const handleSelectRequest = (event: MouseEvent<HTMLButtonElement>) =>
|
|
2183
|
+
setRequestId(event.currentTarget.value);
|
|
2184
|
+
const handleRequestFalsePositive = () => selected && markFalsePositive([selected.id]);
|
|
2185
|
+
const handleRequestBlock = () => request && onBlockSources([request.source.ip]);
|
|
2186
|
+
|
|
2187
|
+
const sources = selected ? getSources(selected) : [];
|
|
2188
|
+
const countries = new Set(sources.map(source => source.country)).size;
|
|
2189
|
+
const ipShares = selected ? getIpShares(selected) : [];
|
|
2190
|
+
const statusCodes = selected ? getStatusCodes(selected) : [];
|
|
2191
|
+
|
|
2192
|
+
return (
|
|
2193
|
+
<Page name='attack-events' fullSize fixedHeight data-testid='attacks-page'>
|
|
2194
|
+
<PageHeader>
|
|
2195
|
+
<PageHeaderGroup className='flex-1'>
|
|
2196
|
+
<PageTitle>Attack events</PageTitle>
|
|
2197
|
+
<PageDescription>
|
|
2198
|
+
Malicious requests the filtering nodes detected across your applications, and how each
|
|
2199
|
+
was handled.
|
|
2200
|
+
</PageDescription>
|
|
2201
|
+
</PageHeaderGroup>
|
|
2202
|
+
<PageActions>
|
|
2203
|
+
<Button
|
|
2204
|
+
size='medium'
|
|
2205
|
+
variant='outline'
|
|
2206
|
+
color='neutral'
|
|
2207
|
+
onClick={onExportEvents}
|
|
2208
|
+
data-testid='attacks-export'
|
|
2209
|
+
>
|
|
2210
|
+
<Download />
|
|
2211
|
+
Export CSV
|
|
2212
|
+
</Button>
|
|
2213
|
+
</PageActions>
|
|
2214
|
+
</PageHeader>
|
|
2215
|
+
|
|
2216
|
+
<PageToolbar>
|
|
2217
|
+
<FilterInput
|
|
2218
|
+
fields={FILTER_FIELDS}
|
|
2219
|
+
value={filter}
|
|
2220
|
+
onChange={setFilter}
|
|
2221
|
+
placeholder='Filter by attack type, severity, status, source IP, host or date'
|
|
2222
|
+
data-testid='attacks-filter'
|
|
2223
|
+
/>
|
|
2224
|
+
</PageToolbar>
|
|
2225
|
+
|
|
2226
|
+
<PageContent>
|
|
2227
|
+
<VStack gap={12}>
|
|
2228
|
+
<Table
|
|
2229
|
+
aria-label='Attack events'
|
|
2230
|
+
data={pageData}
|
|
2231
|
+
columns={columns}
|
|
2232
|
+
getRowId={getEventId}
|
|
2233
|
+
isLoading={isLoading}
|
|
2234
|
+
sorting={sorting}
|
|
2235
|
+
onSortingChange={setSorting}
|
|
2236
|
+
manualSorting
|
|
2237
|
+
rowSelection={rowSelection}
|
|
2238
|
+
onRowSelectionChange={setRowSelection}
|
|
2239
|
+
activeRowId={open ? selectedId : null}
|
|
2240
|
+
onMasterCellClick={openEvent}
|
|
2241
|
+
data-testid='attacks-table'
|
|
2242
|
+
>
|
|
2243
|
+
<TableActionBar>
|
|
2244
|
+
<Button
|
|
2245
|
+
variant='ghost'
|
|
2246
|
+
color='neutral-alt'
|
|
2247
|
+
onClick={handleBulkFalsePositive}
|
|
2248
|
+
data-testid='attacks-bulk-false-positive'
|
|
2249
|
+
>
|
|
2250
|
+
<ShieldCheck /> Mark as false positive
|
|
2251
|
+
</Button>
|
|
2252
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkBlock}>
|
|
2253
|
+
<ShieldBan /> Block source IPs
|
|
2254
|
+
</Button>
|
|
2255
|
+
<Button variant='ghost' color='neutral-alt' onClick={handleBulkExport}>
|
|
2256
|
+
<Download /> Export
|
|
2257
|
+
</Button>
|
|
2258
|
+
</TableActionBar>
|
|
2259
|
+
<TableEmptyState>
|
|
2260
|
+
{failed ? (
|
|
2261
|
+
<EmptyState data-testid='attacks-error'>
|
|
2262
|
+
<EmptyStateIllustration>
|
|
2263
|
+
<CloudOff />
|
|
2264
|
+
</EmptyStateIllustration>
|
|
2265
|
+
<EmptyStateMessage>
|
|
2266
|
+
<EmptyStateTitle>Couldn't load attacks</EmptyStateTitle>
|
|
2267
|
+
<EmptyStateDescription>
|
|
2268
|
+
The server didn't respond. Detection keeps running; try again in a moment.
|
|
2269
|
+
</EmptyStateDescription>
|
|
2270
|
+
</EmptyStateMessage>
|
|
2271
|
+
<EmptyStateActions>
|
|
2272
|
+
<Button
|
|
2273
|
+
size='medium'
|
|
2274
|
+
variant='outline'
|
|
2275
|
+
color='neutral'
|
|
2276
|
+
onClick={handleRetry}
|
|
2277
|
+
data-testid='attacks-retry'
|
|
2278
|
+
>
|
|
2279
|
+
<RefreshCcw />
|
|
2280
|
+
Try again
|
|
2281
|
+
</Button>
|
|
2282
|
+
</EmptyStateActions>
|
|
2283
|
+
</EmptyState>
|
|
2284
|
+
) : (
|
|
2285
|
+
<EmptyState type='collection-empty' data-testid='attacks-no-results'>
|
|
2286
|
+
<EmptyStateIllustration>
|
|
2287
|
+
<SearchX />
|
|
2288
|
+
</EmptyStateIllustration>
|
|
2289
|
+
<EmptyStateMessage>
|
|
2290
|
+
<EmptyStateTitle>No results found</EmptyStateTitle>
|
|
2291
|
+
<EmptyStateDescription>No attacks match the filter.</EmptyStateDescription>
|
|
2292
|
+
</EmptyStateMessage>
|
|
2293
|
+
<EmptyStateActions>
|
|
2294
|
+
<Button
|
|
2295
|
+
size='medium'
|
|
2296
|
+
variant='outline'
|
|
2297
|
+
color='neutral'
|
|
2298
|
+
onClick={handleResetFilters}
|
|
2299
|
+
data-testid='attacks-reset-filters'
|
|
2300
|
+
>
|
|
2301
|
+
<FilterX />
|
|
2302
|
+
Reset filters
|
|
2303
|
+
</Button>
|
|
2304
|
+
</EmptyStateActions>
|
|
2305
|
+
</EmptyState>
|
|
2306
|
+
)}
|
|
2307
|
+
</TableEmptyState>
|
|
2308
|
+
</Table>
|
|
2309
|
+
{rows.length > 0 && (
|
|
2310
|
+
<Pagination
|
|
2311
|
+
{...pagination}
|
|
2312
|
+
align='right'
|
|
2313
|
+
aria-label='Attack events pages'
|
|
2314
|
+
data-testid='attacks-pagination'
|
|
2315
|
+
>
|
|
2316
|
+
<PaginationPageSize options={[10, 25, 50]} />
|
|
2317
|
+
<PaginationPrevious />
|
|
2318
|
+
<PaginationList />
|
|
2319
|
+
<PaginationNext />
|
|
2320
|
+
</Pagination>
|
|
2321
|
+
)}
|
|
2322
|
+
</VStack>
|
|
2323
|
+
</PageContent>
|
|
2324
|
+
|
|
2325
|
+
<Drawer
|
|
2326
|
+
open={open}
|
|
2327
|
+
onOpenChange={setOpen}
|
|
2328
|
+
modal={false}
|
|
2329
|
+
overlay={false}
|
|
2330
|
+
closeOnOutsideClick={false}
|
|
2331
|
+
width={1064}
|
|
2332
|
+
data-testid='attack-drawer'
|
|
2333
|
+
>
|
|
2334
|
+
<DrawerContent>
|
|
2335
|
+
<DrawerResizeHandle onResizeEnd={onSaveDrawerWidth} />
|
|
2336
|
+
<DrawerHeader>
|
|
2337
|
+
<HStack align='start' justify='between' gap={16} fullWidth className='min-w-0'>
|
|
2338
|
+
<VStack gap={4} className='min-w-0' data-testid='attack-summary'>
|
|
2339
|
+
<Heading as='h2' size='xl' weight='medium' truncate>
|
|
2340
|
+
{selected &&
|
|
2341
|
+
`${ATTACK_TYPES[selected.attackType]} in ${selected.point} on ${selected.host}`}
|
|
2342
|
+
</Heading>
|
|
2343
|
+
{selected && (
|
|
2344
|
+
<HStack gap={4} align='center'>
|
|
2345
|
+
<Badge
|
|
2346
|
+
variant='dotted'
|
|
2347
|
+
type='secondary'
|
|
2348
|
+
size='medium'
|
|
2349
|
+
color={STATUS[selected.status].color}
|
|
2350
|
+
>
|
|
2351
|
+
{STATUS[selected.status].label}
|
|
2352
|
+
</Badge>
|
|
2353
|
+
<Text size='xs' color='secondary'>
|
|
2354
|
+
·
|
|
2355
|
+
</Text>
|
|
2356
|
+
<Text size='xs' color='secondary'>
|
|
2357
|
+
{selected.status === 'blocked' ? selected.hits : 0}/{selected.hits} blocked
|
|
2358
|
+
</Text>
|
|
2359
|
+
<Text size='xs' color='secondary'>
|
|
2360
|
+
·
|
|
2361
|
+
</Text>
|
|
2362
|
+
<Text size='xs' color='secondary'>
|
|
2363
|
+
{sources.length} {sources.length === 1 ? 'IP' : 'IPs'} across {countries}{' '}
|
|
2364
|
+
{countries === 1 ? 'country' : 'countries'}
|
|
2365
|
+
</Text>
|
|
2366
|
+
</HStack>
|
|
2367
|
+
)}
|
|
2368
|
+
</VStack>
|
|
2369
|
+
<Tooltip>
|
|
2370
|
+
<TooltipTrigger asChild>
|
|
2371
|
+
<Button
|
|
2372
|
+
variant='ghost'
|
|
2373
|
+
color='neutral'
|
|
2374
|
+
size='small'
|
|
2375
|
+
aria-label='Copy link'
|
|
2376
|
+
onClick={handleCopyLink}
|
|
2377
|
+
>
|
|
2378
|
+
<Link />
|
|
2379
|
+
</Button>
|
|
2380
|
+
</TooltipTrigger>
|
|
2381
|
+
<TooltipContent>Copy link</TooltipContent>
|
|
2382
|
+
</Tooltip>
|
|
2383
|
+
</HStack>
|
|
2384
|
+
</DrawerHeader>
|
|
2385
|
+
<Tabs value={tab} onChange={setTab} data-testid='attack-tabs'>
|
|
2386
|
+
<TabsList>
|
|
2387
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
2388
|
+
<TabsTrigger value='requests'>
|
|
2389
|
+
Requests
|
|
2390
|
+
<Badge type='secondary' color='slate' size='medium' className='ml-4'>
|
|
2391
|
+
{selected && formatCount(selected.hits)}
|
|
2392
|
+
</Badge>
|
|
2393
|
+
</TabsTrigger>
|
|
2394
|
+
</TabsList>
|
|
2395
|
+
</Tabs>
|
|
2396
|
+
|
|
2397
|
+
{selected && tab === 'overview' && (
|
|
2398
|
+
<DrawerBody>
|
|
2399
|
+
<VStack gap={12} className='py-16' data-testid='attack-overview'>
|
|
2400
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'>
|
|
2401
|
+
<Attribute>
|
|
2402
|
+
<AttributeLabel>Severity</AttributeLabel>
|
|
2403
|
+
<AttributeValue>
|
|
2404
|
+
<Badge
|
|
2405
|
+
type='secondary'
|
|
2406
|
+
size='medium'
|
|
2407
|
+
color={SEVERITY[selected.severity].color}
|
|
2408
|
+
>
|
|
2409
|
+
{SEVERITY[selected.severity].label}
|
|
2410
|
+
</Badge>
|
|
2411
|
+
</AttributeValue>
|
|
2412
|
+
</Attribute>
|
|
2413
|
+
<Attribute>
|
|
2414
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
2415
|
+
<AttributeValue>
|
|
2416
|
+
<FormatDateTime
|
|
2417
|
+
value={getFirstSeen(selected)}
|
|
2418
|
+
format='datetime'
|
|
2419
|
+
layout='inline'
|
|
2420
|
+
/>
|
|
2421
|
+
</AttributeValue>
|
|
2422
|
+
</Attribute>
|
|
2423
|
+
<Attribute>
|
|
2424
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
2425
|
+
<AttributeValue>
|
|
2426
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
2427
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
2428
|
+
</Badge>
|
|
2429
|
+
</AttributeValue>
|
|
2430
|
+
</Attribute>
|
|
2431
|
+
<Attribute>
|
|
2432
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
2433
|
+
<AttributeValue>
|
|
2434
|
+
<FormatDateTime
|
|
2435
|
+
value={selected.detectedAt}
|
|
2436
|
+
format='datetime'
|
|
2437
|
+
layout='inline'
|
|
2438
|
+
/>
|
|
2439
|
+
</AttributeValue>
|
|
2440
|
+
</Attribute>
|
|
2441
|
+
<Attribute>
|
|
2442
|
+
<AttributeLabel>Application</AttributeLabel>
|
|
2443
|
+
<AttributeValue>
|
|
2444
|
+
<Tag>{selected.application}</Tag>
|
|
2445
|
+
</AttributeValue>
|
|
2446
|
+
</Attribute>
|
|
2447
|
+
<Attribute>
|
|
2448
|
+
<AttributeLabel>Node</AttributeLabel>
|
|
2449
|
+
<AttributeValue>
|
|
2450
|
+
<InlineCodeSnippet code={selected.node} size='md' />
|
|
2451
|
+
</AttributeValue>
|
|
2452
|
+
</Attribute>
|
|
2453
|
+
<Attribute className='col-span-2'>
|
|
2454
|
+
<AttributeLabel>IPs</AttributeLabel>
|
|
2455
|
+
<AttributeValue>
|
|
2456
|
+
<HStack gap={8}>
|
|
2457
|
+
{sources.map(source => (
|
|
2458
|
+
<Ip key={source.ip}>
|
|
2459
|
+
<IpCountry code={source.country} />
|
|
2460
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
2461
|
+
{source.provider && <IpProvider>{source.provider}</IpProvider>}
|
|
2462
|
+
</Ip>
|
|
2463
|
+
))}
|
|
2464
|
+
</HStack>
|
|
2465
|
+
</AttributeValue>
|
|
2466
|
+
</Attribute>
|
|
2467
|
+
</div>
|
|
2468
|
+
<Chart>
|
|
2469
|
+
<ChartHeader>
|
|
2470
|
+
<ChartTitle>Timeline</ChartTitle>
|
|
2471
|
+
</ChartHeader>
|
|
2472
|
+
<LineChart data={getTimeline(selected)} series={TIMELINE_SERIES} xKey='timestamp'>
|
|
2473
|
+
<LineChartBody>
|
|
2474
|
+
<LineChartGrid />
|
|
2475
|
+
<LineChartXAxis tickFormatter={formatHour} minTickGap={48} />
|
|
2476
|
+
<LineChartYAxis />
|
|
2477
|
+
<LineChartLine seriesKey='hits' curve='linear' />
|
|
2478
|
+
<LineChartTooltip xTickFormatter={formatHourWithTimezone} />
|
|
2479
|
+
</LineChartBody>
|
|
2480
|
+
</LineChart>
|
|
2481
|
+
</Chart>
|
|
2482
|
+
<div className='grid grid-cols-2 gap-12'>
|
|
2483
|
+
<Chart>
|
|
2484
|
+
<ChartHeader>
|
|
2485
|
+
<ChartTitle>Top 5 IPs</ChartTitle>
|
|
2486
|
+
</ChartHeader>
|
|
2487
|
+
<BarList max={sumValues(ipShares)}>
|
|
2488
|
+
{ipShares.map(row => (
|
|
2489
|
+
<BarListItem key={row.name} value={row.value}>
|
|
2490
|
+
<BarListBar />
|
|
2491
|
+
<BarListLabel>{row.name}</BarListLabel>
|
|
2492
|
+
<BarListValue>
|
|
2493
|
+
<BarListPercent />
|
|
2494
|
+
</BarListValue>
|
|
2495
|
+
</BarListItem>
|
|
2496
|
+
))}
|
|
2497
|
+
</BarList>
|
|
2498
|
+
</Chart>
|
|
2499
|
+
<Chart>
|
|
2500
|
+
<ChartHeader>
|
|
2501
|
+
<ChartTitle>Status codes</ChartTitle>
|
|
2502
|
+
</ChartHeader>
|
|
2503
|
+
<PieChart data={statusCodes} total={sumValues(statusCodes)}>
|
|
2504
|
+
<PieChartDonut>
|
|
2505
|
+
<PieChartCenter>
|
|
2506
|
+
<PieChartCenterValue>{formatCount(selected.hits)}</PieChartCenterValue>
|
|
2507
|
+
<PieChartCenterLabel pluralize={{ one: 'hit', other: 'hits' }} />
|
|
2508
|
+
</PieChartCenter>
|
|
2509
|
+
</PieChartDonut>
|
|
2510
|
+
<PieChartLegend>
|
|
2511
|
+
{statusCodes.map(row => (
|
|
2512
|
+
<PieChartLegendItem key={row.name} name={row.name}>
|
|
2513
|
+
<Badge color={row.color} type='secondary' textVariant='code'>
|
|
2514
|
+
{row.name}
|
|
2515
|
+
</Badge>
|
|
2516
|
+
<PieChartLegendValue>
|
|
2517
|
+
{formatCount(row.value)}
|
|
2518
|
+
<LegendDot />
|
|
2519
|
+
<PieChartLegendPercent />
|
|
2520
|
+
</PieChartLegendValue>
|
|
2521
|
+
</PieChartLegendItem>
|
|
2522
|
+
))}
|
|
2523
|
+
</PieChartLegend>
|
|
2524
|
+
</PieChart>
|
|
2525
|
+
</Chart>
|
|
2526
|
+
</div>
|
|
2527
|
+
</VStack>
|
|
2528
|
+
</DrawerBody>
|
|
2529
|
+
)}
|
|
2530
|
+
|
|
2531
|
+
{selected && tab === 'requests' && (
|
|
2532
|
+
<div className='flex min-h-0 flex-1 flex-col' data-testid='attack-requests'>
|
|
2533
|
+
<HStack gap={8} className='shrink-0 border-b border-border-primary-light px-16 py-8'>
|
|
2534
|
+
<div className='min-w-0 flex-1'>
|
|
2535
|
+
<FilterInput placeholder='Filter requests...' />
|
|
2536
|
+
</div>
|
|
2537
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
2538
|
+
<ArrowDown /> Date
|
|
2539
|
+
</Button>
|
|
2540
|
+
</HStack>
|
|
2541
|
+
<div className='flex min-h-0 flex-1'>
|
|
2542
|
+
<div className='w-320 shrink-0 border-r border-border-primary-light'>
|
|
2543
|
+
<ScrollArea>
|
|
2544
|
+
<ScrollAreaViewport>
|
|
2545
|
+
<ScrollAreaContent>
|
|
2546
|
+
<VStack gap={2} className='p-8' data-testid='attack-request-list'>
|
|
2547
|
+
{requests.map(item => (
|
|
2548
|
+
<button
|
|
2549
|
+
key={item.id}
|
|
2550
|
+
type='button'
|
|
2551
|
+
value={item.id}
|
|
2552
|
+
aria-pressed={item.id === requestId}
|
|
2553
|
+
onClick={handleSelectRequest}
|
|
2554
|
+
className={
|
|
2555
|
+
item.id === requestId
|
|
2556
|
+
? 'w-full rounded-8 bg-states-primary-default-alt p-8 text-left'
|
|
2557
|
+
: 'w-full rounded-8 p-8 text-left hover:bg-states-primary-hover'
|
|
2558
|
+
}
|
|
2559
|
+
>
|
|
2560
|
+
<VStack gap={2}>
|
|
2561
|
+
<HStack gap={4}>
|
|
2562
|
+
<FormatDateTime
|
|
2563
|
+
value={item.time}
|
|
2564
|
+
format='datetime'
|
|
2565
|
+
layout='inline'
|
|
2566
|
+
/>
|
|
2567
|
+
<div className='ml-auto'>
|
|
2568
|
+
<ResponseCode code={item.code} />
|
|
2569
|
+
</div>
|
|
2570
|
+
</HStack>
|
|
2571
|
+
<HStack gap={4}>
|
|
2572
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
2573
|
+
{ATTACK_TYPES[selected.attackType]}
|
|
2574
|
+
</Badge>
|
|
2575
|
+
</HStack>
|
|
2576
|
+
<HStack gap={4}>
|
|
2577
|
+
<HttpMethod method={selected.method} />
|
|
2578
|
+
<Text size='xs' truncate>
|
|
2579
|
+
{selected.path}
|
|
2580
|
+
</Text>
|
|
2581
|
+
</HStack>
|
|
2582
|
+
<Text size='xs' color='secondary' truncate>
|
|
2583
|
+
{selected.host}
|
|
2584
|
+
</Text>
|
|
2585
|
+
</VStack>
|
|
2586
|
+
</button>
|
|
2587
|
+
))}
|
|
2588
|
+
</VStack>
|
|
2589
|
+
</ScrollAreaContent>
|
|
2590
|
+
</ScrollAreaViewport>
|
|
2591
|
+
<ScrollAreaScrollbar />
|
|
2592
|
+
</ScrollArea>
|
|
2593
|
+
</div>
|
|
2594
|
+
<div className='min-w-0 flex-1' data-testid='attack-request'>
|
|
2595
|
+
{request ? (
|
|
2596
|
+
<ScrollArea>
|
|
2597
|
+
<ScrollAreaViewport>
|
|
2598
|
+
<ScrollAreaContent>
|
|
2599
|
+
<HStack justify='between' className='px-24 py-8'>
|
|
2600
|
+
<Text size='md'>Request details</Text>
|
|
2601
|
+
<DropdownMenu>
|
|
2602
|
+
<DropdownMenuTrigger asChild>
|
|
2603
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
2604
|
+
Actions
|
|
2605
|
+
</Button>
|
|
2606
|
+
</DropdownMenuTrigger>
|
|
2607
|
+
<DropdownMenuContent>
|
|
2608
|
+
<DropdownMenuItem onSelect={handleRequestFalsePositive}>
|
|
2609
|
+
<DropdownMenuItemText>
|
|
2610
|
+
Mark as false positive
|
|
2611
|
+
</DropdownMenuItemText>
|
|
2612
|
+
</DropdownMenuItem>
|
|
2613
|
+
<DropdownMenuSeparator />
|
|
2614
|
+
<DropdownMenuItem
|
|
2615
|
+
variant='destructive'
|
|
2616
|
+
onSelect={handleRequestBlock}
|
|
2617
|
+
>
|
|
2618
|
+
<DropdownMenuItemText>Add IP to denylist</DropdownMenuItemText>
|
|
2619
|
+
</DropdownMenuItem>
|
|
2620
|
+
</DropdownMenuContent>
|
|
2621
|
+
</DropdownMenu>
|
|
2622
|
+
</HStack>
|
|
2623
|
+
<div className='grid grid-cols-2 gap-x-8 gap-y-6 px-24 pb-8'>
|
|
2624
|
+
<Attribute orientation='horizontal'>
|
|
2625
|
+
<AttributeLabel>Source IP</AttributeLabel>
|
|
2626
|
+
<AttributeValue>
|
|
2627
|
+
<Ip>
|
|
2628
|
+
<IpCountry code={request.source.country} />
|
|
2629
|
+
<IpAddress>{request.source.ip}</IpAddress>
|
|
2630
|
+
</Ip>
|
|
2631
|
+
</AttributeValue>
|
|
2632
|
+
</Attribute>
|
|
2633
|
+
<Attribute orientation='horizontal'>
|
|
2634
|
+
<AttributeLabel>Request ID</AttributeLabel>
|
|
2635
|
+
<AttributeValue>
|
|
2636
|
+
<InlineCodeSnippet code={request.id} size='sm' />
|
|
2637
|
+
</AttributeValue>
|
|
2638
|
+
</Attribute>
|
|
2639
|
+
<Attribute orientation='horizontal' className='col-span-2'>
|
|
2640
|
+
<AttributeLabel>URI</AttributeLabel>
|
|
2641
|
+
<AttributeValue>
|
|
2642
|
+
<HStack gap={6}>
|
|
2643
|
+
<HttpMethod method={selected.method} />
|
|
2644
|
+
<Text size='sm' truncate>
|
|
2645
|
+
{selected.host}
|
|
2646
|
+
{selected.path}
|
|
2647
|
+
</Text>
|
|
2648
|
+
</HStack>
|
|
2649
|
+
</AttributeValue>
|
|
2650
|
+
</Attribute>
|
|
2651
|
+
</div>
|
|
2652
|
+
<div className='px-24 py-4'>
|
|
2653
|
+
<Separator />
|
|
2654
|
+
</div>
|
|
2655
|
+
<div className='px-24 py-8'>
|
|
2656
|
+
<Text size='md'>Attack</Text>
|
|
2657
|
+
</div>
|
|
2658
|
+
<div className='grid grid-cols-1 gap-y-6 px-24 pb-8'>
|
|
2659
|
+
<Attribute orientation='horizontal'>
|
|
2660
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
2661
|
+
<AttributeValue>
|
|
2662
|
+
<InlineCodeSnippet code={selected.point} size='sm' />
|
|
2663
|
+
</AttributeValue>
|
|
2664
|
+
</Attribute>
|
|
2665
|
+
<Attribute orientation='horizontal'>
|
|
2666
|
+
<AttributeLabel>Payload</AttributeLabel>
|
|
2667
|
+
<AttributeValue>
|
|
2668
|
+
<InlineCodeSnippet code={selected.payload} size='sm' />
|
|
2669
|
+
</AttributeValue>
|
|
2670
|
+
</Attribute>
|
|
2671
|
+
</div>
|
|
2672
|
+
<div className='px-24 py-4'>
|
|
2673
|
+
<Separator />
|
|
2674
|
+
</div>
|
|
2675
|
+
<div className='px-24 py-8'>
|
|
2676
|
+
<Text size='md'>Full request</Text>
|
|
2677
|
+
</div>
|
|
2678
|
+
<div className='px-24 pb-16'>
|
|
2679
|
+
<CodeSnippetRoot
|
|
2680
|
+
code={selected.request}
|
|
2681
|
+
language='text'
|
|
2682
|
+
lines={getPayloadLines(selected.request, selected.payload)}
|
|
2683
|
+
maxLines={15}
|
|
2684
|
+
wrapLines
|
|
2685
|
+
data-testid='attack-raw-request'
|
|
2686
|
+
>
|
|
2687
|
+
<CodeSnippetContent>
|
|
2688
|
+
<CodeSnippetLineNumbers />
|
|
2689
|
+
<CodeSnippetCode />
|
|
2690
|
+
</CodeSnippetContent>
|
|
2691
|
+
</CodeSnippetRoot>
|
|
2692
|
+
</div>
|
|
2693
|
+
</ScrollAreaContent>
|
|
2694
|
+
</ScrollAreaViewport>
|
|
2695
|
+
<ScrollAreaScrollbar />
|
|
2696
|
+
</ScrollArea>
|
|
2697
|
+
) : (
|
|
2698
|
+
<div className='flex h-full items-center justify-center'>
|
|
2699
|
+
<Text size='sm' color='secondary'>
|
|
2700
|
+
Select a request to view details
|
|
2701
|
+
</Text>
|
|
2702
|
+
</div>
|
|
2703
|
+
)}
|
|
2704
|
+
</div>
|
|
2705
|
+
</div>
|
|
2706
|
+
</div>
|
|
2707
|
+
)}
|
|
2708
|
+
</DrawerContent>
|
|
2709
|
+
</Drawer>
|
|
2710
|
+
</Page>
|
|
2711
|
+
);
|
|
2712
|
+
};
|
|
2713
|
+
```
|
|
2714
|
+
|
|
2715
|
+
## Related
|
|
2716
|
+
|
|
2717
|
+
- [Resource list page](../patterns/resource-list-page.md)
|
|
2718
|
+
- [Entity table](../patterns/entity-table.md)
|
|
2719
|
+
- [Filtering](../patterns/filtering.md)
|
|
2720
|
+
- [Complex drawer](../patterns/complex-drawer.md)
|
|
2721
|
+
- [Empty states](../patterns/empty-states.md)
|
|
2722
|
+
- [Feedback toasts](../patterns/feedback-toasts.md)
|