@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,2085 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Incident detail
|
|
3
|
+
description: Use when building a page for one incident or vulnerability, with severity, status, owner and resolve actions in the header and tabs for overview, timeline, events, comments.
|
|
4
|
+
components: [Page, PageHeader, PageHeaderGroup, PageTitle, PageActions, PageContent, Tabs, TabsList, TabsTrigger, TabsContent, NumericBadge, Badge, SplitButton, Button, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, Avatar, AvatarFallback, Alert, AlertContent, AlertTitle, AlertDescription, AlertControls, Attribute, AttributeLabel, AttributeValue, InlineCodeSnippet, HttpMethod, Ip, IpCountry, IpAddress, FormatNumber, FormatDateTime, CodeSnippetRoot, CodeSnippetHeader, CodeSnippetContent, CodeSnippetCode, Card, CardHeader, CardTitle, CardContent, Timeline, TimelineItem, TimelineIndicator, TimelineContent, TimelineTitle, TimelineDescription, Table, Code, ResponseCode, Dialog, DialogContent, DialogTitle, DialogDescription, DialogFooter, Textarea, Field, Skeleton, Heading, Text, HStack, VStack]
|
|
5
|
+
keywords: [incident, incident page, vulnerability, vulnerability detail, attack detail, case, investigation, severity, assignee, owner, resolve, false positive, accept risk, timeline, activity, history, related events, comments, detail page, entity page, record page]
|
|
6
|
+
order: 40
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Incident detail
|
|
10
|
+
|
|
11
|
+
One security incident on a full page. The header says what it is, how bad it is, who owns it and what to do next; four tabs hold the evidence. Swap the domain words and the same screen serves a vulnerability, a finding or any record with a lifecycle.
|
|
12
|
+
|
|
13
|
+
## What it shows
|
|
14
|
+
|
|
15
|
+
- The page shell from [Resource list page](../patterns/resource-list-page.md), with `TabsList` between `PageHeader` and `PageContent`.
|
|
16
|
+
- The header: `PageTitle`, a solid severity `Badge`, a dotted status `Badge`, and the ID, host and open time as secondary text. `PageActions` holds an assignee `DropdownMenuRadioGroup`, a `SplitButton` (Resolve, then other resolutions in its menu) and an overflow menu.
|
|
17
|
+
- Overview: an `Alert` while the attack runs, the attribute card from [Complex drawer](../patterns/complex-drawer.md), the description and a `CodeSnippetRoot` request. A `Card` beside it holds the latest `Timeline` entries.
|
|
18
|
+
- Timeline: every entry newest first, with an icon `TimelineIndicator` colored by who acted.
|
|
19
|
+
- Related events: an [Entity table](../patterns/entity-table.md) with `HttpMethod`, `Ip`, `Code`, `ResponseCode`, a dotted result `Badge` and a row menu in the master cell.
|
|
20
|
+
- Comments: an `Avatar` per author and a `Field` with `Textarea` to add one.
|
|
21
|
+
- "Mark as false positive" is a [Confirmation dialog](../patterns/confirmation-dialogs.md); Resolve is reversible, so it runs at once. Both report with [Feedback toasts](../patterns/feedback-toasts.md).
|
|
22
|
+
- Loading keeps the tabs and actions in place, with the skeletons from [Complex drawer](../patterns/complex-drawer.md) and [Entity table](../patterns/entity-table.md).
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
The whole page on the Overview tab. Open the Resolve split button's menu and pick "Mark as false positive" to see the confirmation dialog.
|
|
27
|
+
|
|
28
|
+
The whole page on the Overview tab. The header carries the title, severity, status,
|
|
29
|
+
assignee menu and a split button: "Resolve" is the default action, the chevron opens
|
|
30
|
+
"Mark as false positive" (confirmed in a dialog) and other resolutions. Overview pairs the
|
|
31
|
+
bordered attribute card, the description and a sample request with a card of the latest
|
|
32
|
+
timeline entries. Every tab is live: the timeline, a related-events table and comments.
|
|
33
|
+
|
|
34
|
+
```tsx story=Default
|
|
35
|
+
import { type ChangeEvent, useState } from 'react';
|
|
36
|
+
import { Alert, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle } from '@wallarm-org/design-system/Alert';
|
|
37
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
38
|
+
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
|
|
39
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
40
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
41
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@wallarm-org/design-system/Card';
|
|
42
|
+
import { Code } from '@wallarm-org/design-system/Code';
|
|
43
|
+
import { CodeSnippetActions, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetHeader, CodeSnippetLineNumbers, CodeSnippetRoot, CodeSnippetTitle, CodeSnippetWrapButton, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
44
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
|
|
45
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
46
|
+
import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
|
|
47
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
48
|
+
import { FormatNumber } from '@wallarm-org/design-system/FormatNumber';
|
|
49
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
50
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
51
|
+
import { ChevronDown, CircleCheck, Copy, Download, Ellipsis, ExternalLink, Flag, MessageSquare, ShieldAlert, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
52
|
+
import { Ip, IpAddress, IpCountry } from '@wallarm-org/design-system/Ip';
|
|
53
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
54
|
+
import { Page, PageActions, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
55
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
56
|
+
import { Skeleton } from '@wallarm-org/design-system/Skeleton';
|
|
57
|
+
import { SplitButton } from '@wallarm-org/design-system/SplitButton';
|
|
58
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
59
|
+
import { type TableCellContext, type TableColumnDef, type TableRow, Table } from '@wallarm-org/design-system/Table';
|
|
60
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
61
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
62
|
+
import { Textarea } from '@wallarm-org/design-system/Textarea';
|
|
63
|
+
import { Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineSeparator, TimelineTitle } from '@wallarm-org/design-system/Timeline';
|
|
64
|
+
import { useToast } from '@wallarm-org/design-system/Toast';
|
|
65
|
+
|
|
66
|
+
export const Default = ({
|
|
67
|
+
initialTab = 'overview',
|
|
68
|
+
isLoading = false,
|
|
69
|
+
}) => {
|
|
70
|
+
const toast = useToast();
|
|
71
|
+
const [tab, setTab] = useState(initialTab);
|
|
72
|
+
const [status, setStatus] = useState<IncidentStatus>('open');
|
|
73
|
+
const [assignee, setAssignee] = useState('Daniel Okafor');
|
|
74
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
75
|
+
const [pending, setPending] = useState(false);
|
|
76
|
+
const [comments, setComments] = useState(COMMENTS);
|
|
77
|
+
const [draft, setDraft] = useState('');
|
|
78
|
+
|
|
79
|
+
const renderRequest = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
80
|
+
<HStack gap={8}>
|
|
81
|
+
<HttpMethod method={row.original.method} />
|
|
82
|
+
<Text size='sm' truncate>
|
|
83
|
+
{row.original.path}
|
|
84
|
+
</Text>
|
|
85
|
+
</HStack>
|
|
86
|
+
);
|
|
87
|
+
const renderSource = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
88
|
+
<Ip>
|
|
89
|
+
<IpCountry code={row.original.country} />
|
|
90
|
+
<IpAddress>{row.original.ip}</IpAddress>
|
|
91
|
+
</Ip>
|
|
92
|
+
);
|
|
93
|
+
const renderPayload = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
94
|
+
<Code size='m' truncate>
|
|
95
|
+
{row.original.payload}
|
|
96
|
+
</Code>
|
|
97
|
+
);
|
|
98
|
+
const renderResponse = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
99
|
+
<ResponseCode code={row.original.responseCode} />
|
|
100
|
+
);
|
|
101
|
+
const renderAction = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
102
|
+
<Badge variant='dotted' type='secondary' color={ACTION[row.original.action].color}>
|
|
103
|
+
{ACTION[row.original.action].label}
|
|
104
|
+
</Badge>
|
|
105
|
+
);
|
|
106
|
+
const renderTime = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
107
|
+
<FormatDateTime value={row.original.at} format='datetime' layout='inline' />
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const renderEventMenu = (row: TableRow<RelatedEvent>) => {
|
|
111
|
+
const event = row.original;
|
|
112
|
+
const handleOpen = () => onOpenRequest(event.id);
|
|
113
|
+
const handleCopyId = () => onCopyRequestId(event.id);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<DropdownMenu data-testid='incident-event-menu'>
|
|
117
|
+
<DropdownMenuTrigger asChild>
|
|
118
|
+
<Button
|
|
119
|
+
variant='ghost'
|
|
120
|
+
color='neutral'
|
|
121
|
+
size='small'
|
|
122
|
+
aria-label={`Actions for request ${event.id}`}
|
|
123
|
+
>
|
|
124
|
+
<Ellipsis />
|
|
125
|
+
</Button>
|
|
126
|
+
</DropdownMenuTrigger>
|
|
127
|
+
<DropdownMenuContent>
|
|
128
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
129
|
+
<DropdownMenuItemText>Open request</DropdownMenuItemText>
|
|
130
|
+
</DropdownMenuItem>
|
|
131
|
+
<DropdownMenuItem onSelect={handleCopyId}>
|
|
132
|
+
<DropdownMenuItemText>Copy request ID</DropdownMenuItemText>
|
|
133
|
+
</DropdownMenuItem>
|
|
134
|
+
</DropdownMenuContent>
|
|
135
|
+
</DropdownMenu>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const eventColumns: TableColumnDef<RelatedEvent>[] = [
|
|
140
|
+
{
|
|
141
|
+
id: 'request',
|
|
142
|
+
header: 'Request',
|
|
143
|
+
size: 320,
|
|
144
|
+
cell: renderRequest,
|
|
145
|
+
meta: { renderMenuAction: renderEventMenu },
|
|
146
|
+
},
|
|
147
|
+
{ accessorKey: 'ip', header: 'Source', size: 200, cell: renderSource },
|
|
148
|
+
{ accessorKey: 'payload', header: 'Payload', size: 360, cell: renderPayload },
|
|
149
|
+
{ accessorKey: 'responseCode', header: 'Response', size: 120, cell: renderResponse },
|
|
150
|
+
{ accessorKey: 'action', header: 'Result', size: 140, cell: renderAction },
|
|
151
|
+
{ accessorKey: 'at', header: 'Time', size: 200, cell: renderTime },
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
const isOpen = status === 'open';
|
|
155
|
+
|
|
156
|
+
const handleResolve = () => {
|
|
157
|
+
onResolve(INCIDENT.id);
|
|
158
|
+
setStatus(isOpen ? 'resolved' : 'open');
|
|
159
|
+
toast.create({
|
|
160
|
+
id: 'incident-resolution',
|
|
161
|
+
title: isOpen ? 'Incident resolved' : 'Incident reopened',
|
|
162
|
+
type: 'default',
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const handleOpenFalsePositive = () => setDialogOpen(true);
|
|
166
|
+
const handleAcceptRisk = () => onAcceptRisk(INCIDENT.id);
|
|
167
|
+
const handleCreateTicket = () => onCreateTicket(INCIDENT.id);
|
|
168
|
+
const handleCopyLink = () => onCopyLink(INCIDENT.id);
|
|
169
|
+
const handleExport = () => onExport(INCIDENT.id);
|
|
170
|
+
const handleAssigneeChange = ({ value }: { value: string }) => {
|
|
171
|
+
onAssign(value);
|
|
172
|
+
setAssignee(value);
|
|
173
|
+
};
|
|
174
|
+
const handleShowTimeline = () => setTab('timeline');
|
|
175
|
+
const handleShowEvents = () => setTab('events');
|
|
176
|
+
const handleDialogOpenChange = (next: boolean) => {
|
|
177
|
+
if (!pending) setDialogOpen(next);
|
|
178
|
+
};
|
|
179
|
+
const handleConfirmFalsePositive = async () => {
|
|
180
|
+
setPending(true);
|
|
181
|
+
try {
|
|
182
|
+
await markFalsePositive(INCIDENT.id);
|
|
183
|
+
setStatus('false-positive');
|
|
184
|
+
setDialogOpen(false);
|
|
185
|
+
toast.create({ title: 'Marked as false positive', type: 'default' });
|
|
186
|
+
} catch {
|
|
187
|
+
toast.create({ title: "Couldn't mark as false positive", type: 'error' });
|
|
188
|
+
} finally {
|
|
189
|
+
setPending(false);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const handleDraftChange = (event: ChangeEvent<HTMLTextAreaElement>) =>
|
|
193
|
+
setDraft(event.target.value);
|
|
194
|
+
const handleAddComment = () => {
|
|
195
|
+
const body = draft.trim();
|
|
196
|
+
if (!body) return;
|
|
197
|
+
onAddComment(body);
|
|
198
|
+
setComments(prev => [
|
|
199
|
+
...prev,
|
|
200
|
+
{
|
|
201
|
+
id: `c-${prev.length + 1}`,
|
|
202
|
+
author: assignee,
|
|
203
|
+
role: 'Security analyst',
|
|
204
|
+
body,
|
|
205
|
+
at: new Date().toISOString(),
|
|
206
|
+
},
|
|
207
|
+
]);
|
|
208
|
+
setDraft('');
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<Page name='incident-detail' fullSize fixedHeight data-testid='incident-page'>
|
|
213
|
+
<PageHeader>
|
|
214
|
+
<PageHeaderGroup className='flex-1 gap-6'>
|
|
215
|
+
{isLoading ? (
|
|
216
|
+
<>
|
|
217
|
+
<Skeleton width='480px' height='28px' rounded={6} />
|
|
218
|
+
<Skeleton width='320px' height='20px' rounded={6} />
|
|
219
|
+
</>
|
|
220
|
+
) : (
|
|
221
|
+
<>
|
|
222
|
+
<PageTitle>{INCIDENT.title}</PageTitle>
|
|
223
|
+
<HStack gap={8} data-testid='incident-meta'>
|
|
224
|
+
<Badge color='red' type='solid'>
|
|
225
|
+
<ShieldAlert />
|
|
226
|
+
Critical
|
|
227
|
+
</Badge>
|
|
228
|
+
<Badge
|
|
229
|
+
variant='dotted'
|
|
230
|
+
type='secondary'
|
|
231
|
+
color={STATUS[status].color}
|
|
232
|
+
data-testid='incident-status'
|
|
233
|
+
>
|
|
234
|
+
{STATUS[status].label}
|
|
235
|
+
</Badge>
|
|
236
|
+
<Text size='sm' color='secondary'>
|
|
237
|
+
{INCIDENT.id} · {INCIDENT.host} · opened
|
|
238
|
+
</Text>
|
|
239
|
+
<FormatDateTime value={INCIDENT.firstSeen} format='datetime' layout='inline' />
|
|
240
|
+
</HStack>
|
|
241
|
+
</>
|
|
242
|
+
)}
|
|
243
|
+
</PageHeaderGroup>
|
|
244
|
+
<PageActions>
|
|
245
|
+
<DropdownMenu>
|
|
246
|
+
<DropdownMenuTrigger asChild>
|
|
247
|
+
<Button
|
|
248
|
+
variant='outline'
|
|
249
|
+
color='neutral'
|
|
250
|
+
size='medium'
|
|
251
|
+
disabled={isLoading}
|
|
252
|
+
data-testid='incident-assignee'
|
|
253
|
+
>
|
|
254
|
+
<Avatar size='sm'>
|
|
255
|
+
<AvatarFallback name={assignee} />
|
|
256
|
+
</Avatar>
|
|
257
|
+
{assignee}
|
|
258
|
+
<ChevronDown />
|
|
259
|
+
</Button>
|
|
260
|
+
</DropdownMenuTrigger>
|
|
261
|
+
<DropdownMenuContent>
|
|
262
|
+
<DropdownMenuLabel>Assignee</DropdownMenuLabel>
|
|
263
|
+
<DropdownMenuRadioGroup value={assignee} onValueChange={handleAssigneeChange}>
|
|
264
|
+
{ANALYSTS.map(name => (
|
|
265
|
+
<DropdownMenuRadioItem key={name} value={name}>
|
|
266
|
+
{name}
|
|
267
|
+
</DropdownMenuRadioItem>
|
|
268
|
+
))}
|
|
269
|
+
</DropdownMenuRadioGroup>
|
|
270
|
+
</DropdownMenuContent>
|
|
271
|
+
</DropdownMenu>
|
|
272
|
+
|
|
273
|
+
<DropdownMenu>
|
|
274
|
+
<SplitButton data-testid='incident-resolve'>
|
|
275
|
+
<Button
|
|
276
|
+
size='medium'
|
|
277
|
+
disabled={isLoading}
|
|
278
|
+
onClick={handleResolve}
|
|
279
|
+
data-testid='incident-resolve-primary'
|
|
280
|
+
>
|
|
281
|
+
{isOpen ? <CircleCheck /> : null}
|
|
282
|
+
{isOpen ? 'Resolve' : 'Reopen'}
|
|
283
|
+
</Button>
|
|
284
|
+
<DropdownMenuTrigger asChild>
|
|
285
|
+
<Button
|
|
286
|
+
size='medium'
|
|
287
|
+
disabled={isLoading || !isOpen}
|
|
288
|
+
aria-label='More ways to resolve'
|
|
289
|
+
data-testid='incident-resolve-menu'
|
|
290
|
+
>
|
|
291
|
+
<ChevronDown />
|
|
292
|
+
</Button>
|
|
293
|
+
</DropdownMenuTrigger>
|
|
294
|
+
</SplitButton>
|
|
295
|
+
<DropdownMenuContent>
|
|
296
|
+
<DropdownMenuItem
|
|
297
|
+
onSelect={handleOpenFalsePositive}
|
|
298
|
+
data-testid='incident-false-positive'
|
|
299
|
+
>
|
|
300
|
+
<DropdownMenuItemIcon>
|
|
301
|
+
<Flag />
|
|
302
|
+
</DropdownMenuItemIcon>
|
|
303
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
304
|
+
</DropdownMenuItem>
|
|
305
|
+
<DropdownMenuItem onSelect={handleAcceptRisk}>
|
|
306
|
+
<DropdownMenuItemIcon>
|
|
307
|
+
<ShieldCheck />
|
|
308
|
+
</DropdownMenuItemIcon>
|
|
309
|
+
<DropdownMenuItemText>Accept risk</DropdownMenuItemText>
|
|
310
|
+
</DropdownMenuItem>
|
|
311
|
+
<DropdownMenuItem onSelect={handleCreateTicket}>
|
|
312
|
+
<DropdownMenuItemIcon>
|
|
313
|
+
<ExternalLink />
|
|
314
|
+
</DropdownMenuItemIcon>
|
|
315
|
+
<DropdownMenuItemText>Create Jira ticket</DropdownMenuItemText>
|
|
316
|
+
</DropdownMenuItem>
|
|
317
|
+
</DropdownMenuContent>
|
|
318
|
+
</DropdownMenu>
|
|
319
|
+
|
|
320
|
+
<DropdownMenu>
|
|
321
|
+
<DropdownMenuTrigger asChild>
|
|
322
|
+
<Button
|
|
323
|
+
variant='ghost'
|
|
324
|
+
color='neutral'
|
|
325
|
+
size='medium'
|
|
326
|
+
disabled={isLoading}
|
|
327
|
+
aria-label='More actions'
|
|
328
|
+
>
|
|
329
|
+
<Ellipsis />
|
|
330
|
+
</Button>
|
|
331
|
+
</DropdownMenuTrigger>
|
|
332
|
+
<DropdownMenuContent>
|
|
333
|
+
<DropdownMenuItem onSelect={handleCopyLink}>
|
|
334
|
+
<DropdownMenuItemIcon>
|
|
335
|
+
<Copy />
|
|
336
|
+
</DropdownMenuItemIcon>
|
|
337
|
+
<DropdownMenuItemText>Copy link</DropdownMenuItemText>
|
|
338
|
+
</DropdownMenuItem>
|
|
339
|
+
<DropdownMenuSeparator />
|
|
340
|
+
<DropdownMenuItem onSelect={handleExport}>
|
|
341
|
+
<DropdownMenuItemIcon>
|
|
342
|
+
<Download />
|
|
343
|
+
</DropdownMenuItemIcon>
|
|
344
|
+
<DropdownMenuItemText>Export report</DropdownMenuItemText>
|
|
345
|
+
</DropdownMenuItem>
|
|
346
|
+
</DropdownMenuContent>
|
|
347
|
+
</DropdownMenu>
|
|
348
|
+
</PageActions>
|
|
349
|
+
</PageHeader>
|
|
350
|
+
|
|
351
|
+
<Tabs
|
|
352
|
+
value={tab}
|
|
353
|
+
onChange={setTab}
|
|
354
|
+
className='flex min-h-0 flex-1 flex-col'
|
|
355
|
+
data-testid='incident-tabs'
|
|
356
|
+
>
|
|
357
|
+
<TabsList>
|
|
358
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
359
|
+
<TabsTrigger value='timeline'>
|
|
360
|
+
Timeline {!isLoading && <NumericBadge>{TIMELINE.length}</NumericBadge>}
|
|
361
|
+
</TabsTrigger>
|
|
362
|
+
<TabsTrigger value='events' data-testid='incident-tab-events'>
|
|
363
|
+
Related events {!isLoading && <NumericBadge>{RELATED_EVENTS.length}</NumericBadge>}
|
|
364
|
+
</TabsTrigger>
|
|
365
|
+
<TabsTrigger value='comments'>
|
|
366
|
+
Comments {!isLoading && <NumericBadge>{comments.length}</NumericBadge>}
|
|
367
|
+
</TabsTrigger>
|
|
368
|
+
</TabsList>
|
|
369
|
+
|
|
370
|
+
<PageContent>
|
|
371
|
+
<TabsContent value='overview'>
|
|
372
|
+
<div className='grid grid-cols-[minmax(0,1fr)_400px] items-start gap-24'>
|
|
373
|
+
<VStack gap={24}>
|
|
374
|
+
{isOpen && !isLoading && (
|
|
375
|
+
<Alert color='destructive' data-testid='incident-alert'>
|
|
376
|
+
<AlertIcon />
|
|
377
|
+
<AlertContent>
|
|
378
|
+
<AlertTitle>Attack still in progress</AlertTitle>
|
|
379
|
+
<AlertDescription>
|
|
380
|
+
412 requests a minute from 4 addresses. Blocking mode is on for{' '}
|
|
381
|
+
{INCIDENT.host}, so none reach the application.
|
|
382
|
+
</AlertDescription>
|
|
383
|
+
</AlertContent>
|
|
384
|
+
<AlertControls>
|
|
385
|
+
<Button
|
|
386
|
+
variant='secondary'
|
|
387
|
+
color='neutral'
|
|
388
|
+
size='small'
|
|
389
|
+
onClick={handleShowEvents}
|
|
390
|
+
>
|
|
391
|
+
View related events
|
|
392
|
+
</Button>
|
|
393
|
+
</AlertControls>
|
|
394
|
+
</Alert>
|
|
395
|
+
)}
|
|
396
|
+
|
|
397
|
+
<VStack gap={12}>
|
|
398
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
399
|
+
Details
|
|
400
|
+
</Heading>
|
|
401
|
+
<div
|
|
402
|
+
className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'
|
|
403
|
+
data-testid='incident-attributes'
|
|
404
|
+
>
|
|
405
|
+
<Attribute loading={isLoading}>
|
|
406
|
+
<AttributeLabel>Endpoint</AttributeLabel>
|
|
407
|
+
<AttributeValue>
|
|
408
|
+
<HStack gap={6}>
|
|
409
|
+
<HttpMethod method={INCIDENT.method} />
|
|
410
|
+
<InlineCodeSnippet code={INCIDENT.path} size='md' />
|
|
411
|
+
</HStack>
|
|
412
|
+
</AttributeValue>
|
|
413
|
+
</Attribute>
|
|
414
|
+
<Attribute loading={isLoading}>
|
|
415
|
+
<AttributeLabel>Host</AttributeLabel>
|
|
416
|
+
<AttributeValue>
|
|
417
|
+
<InlineCodeSnippet code={INCIDENT.host} size='md' />
|
|
418
|
+
</AttributeValue>
|
|
419
|
+
</Attribute>
|
|
420
|
+
<Attribute loading={isLoading}>
|
|
421
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
422
|
+
<AttributeValue>
|
|
423
|
+
<HStack gap={4}>
|
|
424
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
425
|
+
SQL injection
|
|
426
|
+
</Badge>
|
|
427
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
428
|
+
CWE-89
|
|
429
|
+
</Badge>
|
|
430
|
+
</HStack>
|
|
431
|
+
</AttributeValue>
|
|
432
|
+
</Attribute>
|
|
433
|
+
<Attribute loading={isLoading}>
|
|
434
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
435
|
+
<AttributeValue>
|
|
436
|
+
<InlineCodeSnippet code={INCIDENT.parameter} size='md' />
|
|
437
|
+
</AttributeValue>
|
|
438
|
+
</Attribute>
|
|
439
|
+
<Attribute loading={isLoading}>
|
|
440
|
+
<AttributeLabel>Detection rule</AttributeLabel>
|
|
441
|
+
<AttributeValue>
|
|
442
|
+
<InlineCodeSnippet code={INCIDENT.rule} size='md' />
|
|
443
|
+
</AttributeValue>
|
|
444
|
+
</Attribute>
|
|
445
|
+
<Attribute loading={isLoading}>
|
|
446
|
+
<AttributeLabel>Requests</AttributeLabel>
|
|
447
|
+
<AttributeValue>
|
|
448
|
+
<FormatNumber value={INCIDENT.requests} notation='standard' />
|
|
449
|
+
</AttributeValue>
|
|
450
|
+
</Attribute>
|
|
451
|
+
<Attribute loading={isLoading}>
|
|
452
|
+
<AttributeLabel>Blocked</AttributeLabel>
|
|
453
|
+
<AttributeValue>
|
|
454
|
+
<FormatNumber value={INCIDENT.blockedShare} type='percent' decimals={1} />
|
|
455
|
+
</AttributeValue>
|
|
456
|
+
</Attribute>
|
|
457
|
+
<Attribute loading={isLoading}>
|
|
458
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
459
|
+
<AttributeValue>
|
|
460
|
+
<FormatDateTime
|
|
461
|
+
value={INCIDENT.firstSeen}
|
|
462
|
+
format='datetime'
|
|
463
|
+
layout='inline'
|
|
464
|
+
/>
|
|
465
|
+
</AttributeValue>
|
|
466
|
+
</Attribute>
|
|
467
|
+
<Attribute loading={isLoading}>
|
|
468
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
469
|
+
<AttributeValue>
|
|
470
|
+
<FormatDateTime
|
|
471
|
+
value={INCIDENT.lastSeen}
|
|
472
|
+
format='datetime'
|
|
473
|
+
layout='inline'
|
|
474
|
+
/>
|
|
475
|
+
</AttributeValue>
|
|
476
|
+
</Attribute>
|
|
477
|
+
<Attribute loading={isLoading} isEmpty={!isLoading}>
|
|
478
|
+
<AttributeLabel>Ticket</AttributeLabel>
|
|
479
|
+
<AttributeValue />
|
|
480
|
+
</Attribute>
|
|
481
|
+
<Attribute loading={isLoading} className='col-span-2'>
|
|
482
|
+
<AttributeLabel>Source IPs</AttributeLabel>
|
|
483
|
+
<AttributeValue>
|
|
484
|
+
<HStack gap={8}>
|
|
485
|
+
{INCIDENT.sourceIps.map(source => (
|
|
486
|
+
<Ip key={source.ip}>
|
|
487
|
+
<IpCountry code={source.country} />
|
|
488
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
489
|
+
</Ip>
|
|
490
|
+
))}
|
|
491
|
+
</HStack>
|
|
492
|
+
</AttributeValue>
|
|
493
|
+
</Attribute>
|
|
494
|
+
</div>
|
|
495
|
+
</VStack>
|
|
496
|
+
|
|
497
|
+
<VStack gap={12}>
|
|
498
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
499
|
+
Description
|
|
500
|
+
</Heading>
|
|
501
|
+
{isLoading ? (
|
|
502
|
+
<VStack gap={8}>
|
|
503
|
+
<Skeleton width='100%' height='16px' rounded={4} />
|
|
504
|
+
<Skeleton width='72%' height='16px' rounded={4} />
|
|
505
|
+
</VStack>
|
|
506
|
+
) : (
|
|
507
|
+
<Text size='sm'>
|
|
508
|
+
An automated scanner is sending SQL injection payloads in the customer_id
|
|
509
|
+
filter of the order search endpoint. Early requests returned 500 while the
|
|
510
|
+
host was in monitoring mode, which suggests the value reaches the database
|
|
511
|
+
unescaped. Since blocking was enabled every request is rejected, but the
|
|
512
|
+
parameter should be fixed at the source.
|
|
513
|
+
</Text>
|
|
514
|
+
)}
|
|
515
|
+
</VStack>
|
|
516
|
+
|
|
517
|
+
<VStack gap={12}>
|
|
518
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
519
|
+
Sample request
|
|
520
|
+
</Heading>
|
|
521
|
+
{isLoading ? (
|
|
522
|
+
<Skeleton width='100%' height='160px' rounded={8} />
|
|
523
|
+
) : (
|
|
524
|
+
<CodeSnippetRoot code={SAMPLE_REQUEST} language='text'>
|
|
525
|
+
<CodeSnippetHeader>
|
|
526
|
+
<CodeSnippetTitle>Request r-90412 · blocked</CodeSnippetTitle>
|
|
527
|
+
<CodeSnippetActions>
|
|
528
|
+
<CodeSnippetWrapButton />
|
|
529
|
+
<CodeSnippetCopyButton />
|
|
530
|
+
</CodeSnippetActions>
|
|
531
|
+
</CodeSnippetHeader>
|
|
532
|
+
<CodeSnippetContent>
|
|
533
|
+
<CodeSnippetLineNumbers />
|
|
534
|
+
<CodeSnippetCode />
|
|
535
|
+
</CodeSnippetContent>
|
|
536
|
+
</CodeSnippetRoot>
|
|
537
|
+
)}
|
|
538
|
+
</VStack>
|
|
539
|
+
</VStack>
|
|
540
|
+
|
|
541
|
+
<Card className='h-auto' data-testid='incident-latest-activity'>
|
|
542
|
+
<CardHeader>
|
|
543
|
+
<CardTitle>Latest activity</CardTitle>
|
|
544
|
+
<Button
|
|
545
|
+
variant='ghost'
|
|
546
|
+
color='neutral'
|
|
547
|
+
size='small'
|
|
548
|
+
disabled={isLoading}
|
|
549
|
+
onClick={handleShowTimeline}
|
|
550
|
+
>
|
|
551
|
+
View timeline
|
|
552
|
+
</Button>
|
|
553
|
+
</CardHeader>
|
|
554
|
+
<CardContent>
|
|
555
|
+
{isLoading ? (
|
|
556
|
+
<VStack gap={16}>
|
|
557
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
558
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
559
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
560
|
+
</VStack>
|
|
561
|
+
) : (
|
|
562
|
+
<Timeline>
|
|
563
|
+
{TIMELINE.slice(0, 4).map(event => {
|
|
564
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
565
|
+
return (
|
|
566
|
+
<TimelineItem key={event.id}>
|
|
567
|
+
<TimelineConnector>
|
|
568
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
569
|
+
<Icon />
|
|
570
|
+
</TimelineIndicator>
|
|
571
|
+
<TimelineSeparator />
|
|
572
|
+
</TimelineConnector>
|
|
573
|
+
<TimelineContent>
|
|
574
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
575
|
+
<HStack gap={4}>
|
|
576
|
+
<FormatDateTime
|
|
577
|
+
value={event.at}
|
|
578
|
+
format='datetime'
|
|
579
|
+
layout='inline'
|
|
580
|
+
/>
|
|
581
|
+
<Text size='sm' color='secondary'>
|
|
582
|
+
· {event.actor}
|
|
583
|
+
</Text>
|
|
584
|
+
</HStack>
|
|
585
|
+
</TimelineContent>
|
|
586
|
+
</TimelineItem>
|
|
587
|
+
);
|
|
588
|
+
})}
|
|
589
|
+
</Timeline>
|
|
590
|
+
)}
|
|
591
|
+
</CardContent>
|
|
592
|
+
</Card>
|
|
593
|
+
</div>
|
|
594
|
+
</TabsContent>
|
|
595
|
+
|
|
596
|
+
<TabsContent value='timeline'>
|
|
597
|
+
<div className='max-w-[720px]'>
|
|
598
|
+
<Timeline data-testid='incident-timeline'>
|
|
599
|
+
{TIMELINE.map(event => {
|
|
600
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
601
|
+
return (
|
|
602
|
+
<TimelineItem key={event.id}>
|
|
603
|
+
<TimelineConnector>
|
|
604
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
605
|
+
<Icon />
|
|
606
|
+
</TimelineIndicator>
|
|
607
|
+
<TimelineSeparator />
|
|
608
|
+
</TimelineConnector>
|
|
609
|
+
<TimelineContent>
|
|
610
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
611
|
+
<TimelineDescription>{event.description}</TimelineDescription>
|
|
612
|
+
<HStack gap={4}>
|
|
613
|
+
<FormatDateTime value={event.at} format='datetime' layout='inline' />
|
|
614
|
+
<Text size='sm' color='secondary'>
|
|
615
|
+
· {event.actor}
|
|
616
|
+
</Text>
|
|
617
|
+
</HStack>
|
|
618
|
+
</TimelineContent>
|
|
619
|
+
</TimelineItem>
|
|
620
|
+
);
|
|
621
|
+
})}
|
|
622
|
+
</Timeline>
|
|
623
|
+
</div>
|
|
624
|
+
</TabsContent>
|
|
625
|
+
|
|
626
|
+
<TabsContent value='events'>
|
|
627
|
+
<Table
|
|
628
|
+
aria-label='Related events'
|
|
629
|
+
data={RELATED_EVENTS}
|
|
630
|
+
columns={eventColumns}
|
|
631
|
+
getRowId={getItemId}
|
|
632
|
+
isLoading={isLoading}
|
|
633
|
+
data-testid='incident-events-table'
|
|
634
|
+
/>
|
|
635
|
+
</TabsContent>
|
|
636
|
+
|
|
637
|
+
<TabsContent value='comments'>
|
|
638
|
+
<VStack gap={24} className='max-w-[720px]' data-testid='incident-comments'>
|
|
639
|
+
{comments.map(comment => (
|
|
640
|
+
<VStack key={comment.id} gap={8}>
|
|
641
|
+
<HStack justify='between'>
|
|
642
|
+
<Avatar size='md'>
|
|
643
|
+
<AvatarFallback name={comment.author} />
|
|
644
|
+
<AvatarContent>
|
|
645
|
+
<AvatarName>{comment.author}</AvatarName>
|
|
646
|
+
<AvatarDescription>{comment.role}</AvatarDescription>
|
|
647
|
+
</AvatarContent>
|
|
648
|
+
</Avatar>
|
|
649
|
+
<FormatDateTime value={comment.at} format='datetime' layout='inline' />
|
|
650
|
+
</HStack>
|
|
651
|
+
<Text size='sm'>{comment.body}</Text>
|
|
652
|
+
</VStack>
|
|
653
|
+
))}
|
|
654
|
+
<VStack gap={12}>
|
|
655
|
+
<Field>
|
|
656
|
+
<FieldLabel>Add a comment</FieldLabel>
|
|
657
|
+
<Textarea
|
|
658
|
+
value={draft}
|
|
659
|
+
onChange={handleDraftChange}
|
|
660
|
+
minRows={3}
|
|
661
|
+
placeholder='Share findings or next steps with the team'
|
|
662
|
+
data-testid='incident-comment-input'
|
|
663
|
+
/>
|
|
664
|
+
</Field>
|
|
665
|
+
<HStack justify='end'>
|
|
666
|
+
<Button size='medium' disabled={!draft.trim()} onClick={handleAddComment}>
|
|
667
|
+
<MessageSquare />
|
|
668
|
+
Comment
|
|
669
|
+
</Button>
|
|
670
|
+
</HStack>
|
|
671
|
+
</VStack>
|
|
672
|
+
</VStack>
|
|
673
|
+
</TabsContent>
|
|
674
|
+
</PageContent>
|
|
675
|
+
</Tabs>
|
|
676
|
+
|
|
677
|
+
<Dialog
|
|
678
|
+
width={400}
|
|
679
|
+
open={dialogOpen}
|
|
680
|
+
onOpenChange={handleDialogOpenChange}
|
|
681
|
+
data-testid='false-positive-dialog'
|
|
682
|
+
>
|
|
683
|
+
<DialogContent>
|
|
684
|
+
<DialogHeader>
|
|
685
|
+
<DialogTitle>Mark as false positive?</DialogTitle>
|
|
686
|
+
<DialogDescription>
|
|
687
|
+
This closes {INCIDENT.id} and adds a rule exception for {INCIDENT.method}{' '}
|
|
688
|
+
{INCIDENT.path}, so matching requests stop raising incidents. You can reopen it later.
|
|
689
|
+
</DialogDescription>
|
|
690
|
+
</DialogHeader>
|
|
691
|
+
<DialogFooter>
|
|
692
|
+
<DialogClose asChild>
|
|
693
|
+
<Button variant='ghost' color='neutral'>
|
|
694
|
+
Cancel
|
|
695
|
+
</Button>
|
|
696
|
+
</DialogClose>
|
|
697
|
+
<Button
|
|
698
|
+
loading={pending}
|
|
699
|
+
onClick={handleConfirmFalsePositive}
|
|
700
|
+
data-testid='false-positive-confirm'
|
|
701
|
+
>
|
|
702
|
+
Mark as false positive
|
|
703
|
+
</Button>
|
|
704
|
+
</DialogFooter>
|
|
705
|
+
</DialogContent>
|
|
706
|
+
</Dialog>
|
|
707
|
+
</Page>
|
|
708
|
+
);
|
|
709
|
+
};
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
The Timeline tab with every entry.
|
|
713
|
+
|
|
714
|
+
The Timeline tab: every entry newest first, each with an indicator colored by who acted
|
|
715
|
+
(detection, system, person, resolution), a description, the time and the actor.
|
|
716
|
+
|
|
717
|
+
```tsx story=TimelineTab
|
|
718
|
+
import { type ChangeEvent, useState } from 'react';
|
|
719
|
+
import { Alert, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle } from '@wallarm-org/design-system/Alert';
|
|
720
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
721
|
+
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
|
|
722
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
723
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
724
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@wallarm-org/design-system/Card';
|
|
725
|
+
import { Code } from '@wallarm-org/design-system/Code';
|
|
726
|
+
import { CodeSnippetActions, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetHeader, CodeSnippetLineNumbers, CodeSnippetRoot, CodeSnippetTitle, CodeSnippetWrapButton, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
727
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
|
|
728
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
729
|
+
import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
|
|
730
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
731
|
+
import { FormatNumber } from '@wallarm-org/design-system/FormatNumber';
|
|
732
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
733
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
734
|
+
import { ChevronDown, CircleCheck, Copy, Download, Ellipsis, ExternalLink, Flag, MessageSquare, ShieldAlert, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
735
|
+
import { Ip, IpAddress, IpCountry } from '@wallarm-org/design-system/Ip';
|
|
736
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
737
|
+
import { Page, PageActions, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
738
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
739
|
+
import { Skeleton } from '@wallarm-org/design-system/Skeleton';
|
|
740
|
+
import { SplitButton } from '@wallarm-org/design-system/SplitButton';
|
|
741
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
742
|
+
import { type TableCellContext, type TableColumnDef, type TableRow, Table } from '@wallarm-org/design-system/Table';
|
|
743
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
744
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
745
|
+
import { Textarea } from '@wallarm-org/design-system/Textarea';
|
|
746
|
+
import { Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineSeparator, TimelineTitle } from '@wallarm-org/design-system/Timeline';
|
|
747
|
+
import { useToast } from '@wallarm-org/design-system/Toast';
|
|
748
|
+
|
|
749
|
+
export const TimelineTab = ({
|
|
750
|
+
initialTab = 'overview',
|
|
751
|
+
isLoading = false,
|
|
752
|
+
}) => {
|
|
753
|
+
const toast = useToast();
|
|
754
|
+
const [tab, setTab] = useState(initialTab);
|
|
755
|
+
const [status, setStatus] = useState<IncidentStatus>('open');
|
|
756
|
+
const [assignee, setAssignee] = useState('Daniel Okafor');
|
|
757
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
758
|
+
const [pending, setPending] = useState(false);
|
|
759
|
+
const [comments, setComments] = useState(COMMENTS);
|
|
760
|
+
const [draft, setDraft] = useState('');
|
|
761
|
+
|
|
762
|
+
const renderRequest = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
763
|
+
<HStack gap={8}>
|
|
764
|
+
<HttpMethod method={row.original.method} />
|
|
765
|
+
<Text size='sm' truncate>
|
|
766
|
+
{row.original.path}
|
|
767
|
+
</Text>
|
|
768
|
+
</HStack>
|
|
769
|
+
);
|
|
770
|
+
const renderSource = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
771
|
+
<Ip>
|
|
772
|
+
<IpCountry code={row.original.country} />
|
|
773
|
+
<IpAddress>{row.original.ip}</IpAddress>
|
|
774
|
+
</Ip>
|
|
775
|
+
);
|
|
776
|
+
const renderPayload = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
777
|
+
<Code size='m' truncate>
|
|
778
|
+
{row.original.payload}
|
|
779
|
+
</Code>
|
|
780
|
+
);
|
|
781
|
+
const renderResponse = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
782
|
+
<ResponseCode code={row.original.responseCode} />
|
|
783
|
+
);
|
|
784
|
+
const renderAction = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
785
|
+
<Badge variant='dotted' type='secondary' color={ACTION[row.original.action].color}>
|
|
786
|
+
{ACTION[row.original.action].label}
|
|
787
|
+
</Badge>
|
|
788
|
+
);
|
|
789
|
+
const renderTime = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
790
|
+
<FormatDateTime value={row.original.at} format='datetime' layout='inline' />
|
|
791
|
+
);
|
|
792
|
+
|
|
793
|
+
const renderEventMenu = (row: TableRow<RelatedEvent>) => {
|
|
794
|
+
const event = row.original;
|
|
795
|
+
const handleOpen = () => onOpenRequest(event.id);
|
|
796
|
+
const handleCopyId = () => onCopyRequestId(event.id);
|
|
797
|
+
|
|
798
|
+
return (
|
|
799
|
+
<DropdownMenu data-testid='incident-event-menu'>
|
|
800
|
+
<DropdownMenuTrigger asChild>
|
|
801
|
+
<Button
|
|
802
|
+
variant='ghost'
|
|
803
|
+
color='neutral'
|
|
804
|
+
size='small'
|
|
805
|
+
aria-label={`Actions for request ${event.id}`}
|
|
806
|
+
>
|
|
807
|
+
<Ellipsis />
|
|
808
|
+
</Button>
|
|
809
|
+
</DropdownMenuTrigger>
|
|
810
|
+
<DropdownMenuContent>
|
|
811
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
812
|
+
<DropdownMenuItemText>Open request</DropdownMenuItemText>
|
|
813
|
+
</DropdownMenuItem>
|
|
814
|
+
<DropdownMenuItem onSelect={handleCopyId}>
|
|
815
|
+
<DropdownMenuItemText>Copy request ID</DropdownMenuItemText>
|
|
816
|
+
</DropdownMenuItem>
|
|
817
|
+
</DropdownMenuContent>
|
|
818
|
+
</DropdownMenu>
|
|
819
|
+
);
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
const eventColumns: TableColumnDef<RelatedEvent>[] = [
|
|
823
|
+
{
|
|
824
|
+
id: 'request',
|
|
825
|
+
header: 'Request',
|
|
826
|
+
size: 320,
|
|
827
|
+
cell: renderRequest,
|
|
828
|
+
meta: { renderMenuAction: renderEventMenu },
|
|
829
|
+
},
|
|
830
|
+
{ accessorKey: 'ip', header: 'Source', size: 200, cell: renderSource },
|
|
831
|
+
{ accessorKey: 'payload', header: 'Payload', size: 360, cell: renderPayload },
|
|
832
|
+
{ accessorKey: 'responseCode', header: 'Response', size: 120, cell: renderResponse },
|
|
833
|
+
{ accessorKey: 'action', header: 'Result', size: 140, cell: renderAction },
|
|
834
|
+
{ accessorKey: 'at', header: 'Time', size: 200, cell: renderTime },
|
|
835
|
+
];
|
|
836
|
+
|
|
837
|
+
const isOpen = status === 'open';
|
|
838
|
+
|
|
839
|
+
const handleResolve = () => {
|
|
840
|
+
onResolve(INCIDENT.id);
|
|
841
|
+
setStatus(isOpen ? 'resolved' : 'open');
|
|
842
|
+
toast.create({
|
|
843
|
+
id: 'incident-resolution',
|
|
844
|
+
title: isOpen ? 'Incident resolved' : 'Incident reopened',
|
|
845
|
+
type: 'default',
|
|
846
|
+
});
|
|
847
|
+
};
|
|
848
|
+
const handleOpenFalsePositive = () => setDialogOpen(true);
|
|
849
|
+
const handleAcceptRisk = () => onAcceptRisk(INCIDENT.id);
|
|
850
|
+
const handleCreateTicket = () => onCreateTicket(INCIDENT.id);
|
|
851
|
+
const handleCopyLink = () => onCopyLink(INCIDENT.id);
|
|
852
|
+
const handleExport = () => onExport(INCIDENT.id);
|
|
853
|
+
const handleAssigneeChange = ({ value }: { value: string }) => {
|
|
854
|
+
onAssign(value);
|
|
855
|
+
setAssignee(value);
|
|
856
|
+
};
|
|
857
|
+
const handleShowTimeline = () => setTab('timeline');
|
|
858
|
+
const handleShowEvents = () => setTab('events');
|
|
859
|
+
const handleDialogOpenChange = (next: boolean) => {
|
|
860
|
+
if (!pending) setDialogOpen(next);
|
|
861
|
+
};
|
|
862
|
+
const handleConfirmFalsePositive = async () => {
|
|
863
|
+
setPending(true);
|
|
864
|
+
try {
|
|
865
|
+
await markFalsePositive(INCIDENT.id);
|
|
866
|
+
setStatus('false-positive');
|
|
867
|
+
setDialogOpen(false);
|
|
868
|
+
toast.create({ title: 'Marked as false positive', type: 'default' });
|
|
869
|
+
} catch {
|
|
870
|
+
toast.create({ title: "Couldn't mark as false positive", type: 'error' });
|
|
871
|
+
} finally {
|
|
872
|
+
setPending(false);
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
const handleDraftChange = (event: ChangeEvent<HTMLTextAreaElement>) =>
|
|
876
|
+
setDraft(event.target.value);
|
|
877
|
+
const handleAddComment = () => {
|
|
878
|
+
const body = draft.trim();
|
|
879
|
+
if (!body) return;
|
|
880
|
+
onAddComment(body);
|
|
881
|
+
setComments(prev => [
|
|
882
|
+
...prev,
|
|
883
|
+
{
|
|
884
|
+
id: `c-${prev.length + 1}`,
|
|
885
|
+
author: assignee,
|
|
886
|
+
role: 'Security analyst',
|
|
887
|
+
body,
|
|
888
|
+
at: new Date().toISOString(),
|
|
889
|
+
},
|
|
890
|
+
]);
|
|
891
|
+
setDraft('');
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
return (
|
|
895
|
+
<Page name='incident-detail' fullSize fixedHeight data-testid='incident-page'>
|
|
896
|
+
<PageHeader>
|
|
897
|
+
<PageHeaderGroup className='flex-1 gap-6'>
|
|
898
|
+
{isLoading ? (
|
|
899
|
+
<>
|
|
900
|
+
<Skeleton width='480px' height='28px' rounded={6} />
|
|
901
|
+
<Skeleton width='320px' height='20px' rounded={6} />
|
|
902
|
+
</>
|
|
903
|
+
) : (
|
|
904
|
+
<>
|
|
905
|
+
<PageTitle>{INCIDENT.title}</PageTitle>
|
|
906
|
+
<HStack gap={8} data-testid='incident-meta'>
|
|
907
|
+
<Badge color='red' type='solid'>
|
|
908
|
+
<ShieldAlert />
|
|
909
|
+
Critical
|
|
910
|
+
</Badge>
|
|
911
|
+
<Badge
|
|
912
|
+
variant='dotted'
|
|
913
|
+
type='secondary'
|
|
914
|
+
color={STATUS[status].color}
|
|
915
|
+
data-testid='incident-status'
|
|
916
|
+
>
|
|
917
|
+
{STATUS[status].label}
|
|
918
|
+
</Badge>
|
|
919
|
+
<Text size='sm' color='secondary'>
|
|
920
|
+
{INCIDENT.id} · {INCIDENT.host} · opened
|
|
921
|
+
</Text>
|
|
922
|
+
<FormatDateTime value={INCIDENT.firstSeen} format='datetime' layout='inline' />
|
|
923
|
+
</HStack>
|
|
924
|
+
</>
|
|
925
|
+
)}
|
|
926
|
+
</PageHeaderGroup>
|
|
927
|
+
<PageActions>
|
|
928
|
+
<DropdownMenu>
|
|
929
|
+
<DropdownMenuTrigger asChild>
|
|
930
|
+
<Button
|
|
931
|
+
variant='outline'
|
|
932
|
+
color='neutral'
|
|
933
|
+
size='medium'
|
|
934
|
+
disabled={isLoading}
|
|
935
|
+
data-testid='incident-assignee'
|
|
936
|
+
>
|
|
937
|
+
<Avatar size='sm'>
|
|
938
|
+
<AvatarFallback name={assignee} />
|
|
939
|
+
</Avatar>
|
|
940
|
+
{assignee}
|
|
941
|
+
<ChevronDown />
|
|
942
|
+
</Button>
|
|
943
|
+
</DropdownMenuTrigger>
|
|
944
|
+
<DropdownMenuContent>
|
|
945
|
+
<DropdownMenuLabel>Assignee</DropdownMenuLabel>
|
|
946
|
+
<DropdownMenuRadioGroup value={assignee} onValueChange={handleAssigneeChange}>
|
|
947
|
+
{ANALYSTS.map(name => (
|
|
948
|
+
<DropdownMenuRadioItem key={name} value={name}>
|
|
949
|
+
{name}
|
|
950
|
+
</DropdownMenuRadioItem>
|
|
951
|
+
))}
|
|
952
|
+
</DropdownMenuRadioGroup>
|
|
953
|
+
</DropdownMenuContent>
|
|
954
|
+
</DropdownMenu>
|
|
955
|
+
|
|
956
|
+
<DropdownMenu>
|
|
957
|
+
<SplitButton data-testid='incident-resolve'>
|
|
958
|
+
<Button
|
|
959
|
+
size='medium'
|
|
960
|
+
disabled={isLoading}
|
|
961
|
+
onClick={handleResolve}
|
|
962
|
+
data-testid='incident-resolve-primary'
|
|
963
|
+
>
|
|
964
|
+
{isOpen ? <CircleCheck /> : null}
|
|
965
|
+
{isOpen ? 'Resolve' : 'Reopen'}
|
|
966
|
+
</Button>
|
|
967
|
+
<DropdownMenuTrigger asChild>
|
|
968
|
+
<Button
|
|
969
|
+
size='medium'
|
|
970
|
+
disabled={isLoading || !isOpen}
|
|
971
|
+
aria-label='More ways to resolve'
|
|
972
|
+
data-testid='incident-resolve-menu'
|
|
973
|
+
>
|
|
974
|
+
<ChevronDown />
|
|
975
|
+
</Button>
|
|
976
|
+
</DropdownMenuTrigger>
|
|
977
|
+
</SplitButton>
|
|
978
|
+
<DropdownMenuContent>
|
|
979
|
+
<DropdownMenuItem
|
|
980
|
+
onSelect={handleOpenFalsePositive}
|
|
981
|
+
data-testid='incident-false-positive'
|
|
982
|
+
>
|
|
983
|
+
<DropdownMenuItemIcon>
|
|
984
|
+
<Flag />
|
|
985
|
+
</DropdownMenuItemIcon>
|
|
986
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
987
|
+
</DropdownMenuItem>
|
|
988
|
+
<DropdownMenuItem onSelect={handleAcceptRisk}>
|
|
989
|
+
<DropdownMenuItemIcon>
|
|
990
|
+
<ShieldCheck />
|
|
991
|
+
</DropdownMenuItemIcon>
|
|
992
|
+
<DropdownMenuItemText>Accept risk</DropdownMenuItemText>
|
|
993
|
+
</DropdownMenuItem>
|
|
994
|
+
<DropdownMenuItem onSelect={handleCreateTicket}>
|
|
995
|
+
<DropdownMenuItemIcon>
|
|
996
|
+
<ExternalLink />
|
|
997
|
+
</DropdownMenuItemIcon>
|
|
998
|
+
<DropdownMenuItemText>Create Jira ticket</DropdownMenuItemText>
|
|
999
|
+
</DropdownMenuItem>
|
|
1000
|
+
</DropdownMenuContent>
|
|
1001
|
+
</DropdownMenu>
|
|
1002
|
+
|
|
1003
|
+
<DropdownMenu>
|
|
1004
|
+
<DropdownMenuTrigger asChild>
|
|
1005
|
+
<Button
|
|
1006
|
+
variant='ghost'
|
|
1007
|
+
color='neutral'
|
|
1008
|
+
size='medium'
|
|
1009
|
+
disabled={isLoading}
|
|
1010
|
+
aria-label='More actions'
|
|
1011
|
+
>
|
|
1012
|
+
<Ellipsis />
|
|
1013
|
+
</Button>
|
|
1014
|
+
</DropdownMenuTrigger>
|
|
1015
|
+
<DropdownMenuContent>
|
|
1016
|
+
<DropdownMenuItem onSelect={handleCopyLink}>
|
|
1017
|
+
<DropdownMenuItemIcon>
|
|
1018
|
+
<Copy />
|
|
1019
|
+
</DropdownMenuItemIcon>
|
|
1020
|
+
<DropdownMenuItemText>Copy link</DropdownMenuItemText>
|
|
1021
|
+
</DropdownMenuItem>
|
|
1022
|
+
<DropdownMenuSeparator />
|
|
1023
|
+
<DropdownMenuItem onSelect={handleExport}>
|
|
1024
|
+
<DropdownMenuItemIcon>
|
|
1025
|
+
<Download />
|
|
1026
|
+
</DropdownMenuItemIcon>
|
|
1027
|
+
<DropdownMenuItemText>Export report</DropdownMenuItemText>
|
|
1028
|
+
</DropdownMenuItem>
|
|
1029
|
+
</DropdownMenuContent>
|
|
1030
|
+
</DropdownMenu>
|
|
1031
|
+
</PageActions>
|
|
1032
|
+
</PageHeader>
|
|
1033
|
+
|
|
1034
|
+
<Tabs
|
|
1035
|
+
value={tab}
|
|
1036
|
+
onChange={setTab}
|
|
1037
|
+
className='flex min-h-0 flex-1 flex-col'
|
|
1038
|
+
data-testid='incident-tabs'
|
|
1039
|
+
>
|
|
1040
|
+
<TabsList>
|
|
1041
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
1042
|
+
<TabsTrigger value='timeline'>
|
|
1043
|
+
Timeline {!isLoading && <NumericBadge>{TIMELINE.length}</NumericBadge>}
|
|
1044
|
+
</TabsTrigger>
|
|
1045
|
+
<TabsTrigger value='events' data-testid='incident-tab-events'>
|
|
1046
|
+
Related events {!isLoading && <NumericBadge>{RELATED_EVENTS.length}</NumericBadge>}
|
|
1047
|
+
</TabsTrigger>
|
|
1048
|
+
<TabsTrigger value='comments'>
|
|
1049
|
+
Comments {!isLoading && <NumericBadge>{comments.length}</NumericBadge>}
|
|
1050
|
+
</TabsTrigger>
|
|
1051
|
+
</TabsList>
|
|
1052
|
+
|
|
1053
|
+
<PageContent>
|
|
1054
|
+
<TabsContent value='overview'>
|
|
1055
|
+
<div className='grid grid-cols-[minmax(0,1fr)_400px] items-start gap-24'>
|
|
1056
|
+
<VStack gap={24}>
|
|
1057
|
+
{isOpen && !isLoading && (
|
|
1058
|
+
<Alert color='destructive' data-testid='incident-alert'>
|
|
1059
|
+
<AlertIcon />
|
|
1060
|
+
<AlertContent>
|
|
1061
|
+
<AlertTitle>Attack still in progress</AlertTitle>
|
|
1062
|
+
<AlertDescription>
|
|
1063
|
+
412 requests a minute from 4 addresses. Blocking mode is on for{' '}
|
|
1064
|
+
{INCIDENT.host}, so none reach the application.
|
|
1065
|
+
</AlertDescription>
|
|
1066
|
+
</AlertContent>
|
|
1067
|
+
<AlertControls>
|
|
1068
|
+
<Button
|
|
1069
|
+
variant='secondary'
|
|
1070
|
+
color='neutral'
|
|
1071
|
+
size='small'
|
|
1072
|
+
onClick={handleShowEvents}
|
|
1073
|
+
>
|
|
1074
|
+
View related events
|
|
1075
|
+
</Button>
|
|
1076
|
+
</AlertControls>
|
|
1077
|
+
</Alert>
|
|
1078
|
+
)}
|
|
1079
|
+
|
|
1080
|
+
<VStack gap={12}>
|
|
1081
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1082
|
+
Details
|
|
1083
|
+
</Heading>
|
|
1084
|
+
<div
|
|
1085
|
+
className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'
|
|
1086
|
+
data-testid='incident-attributes'
|
|
1087
|
+
>
|
|
1088
|
+
<Attribute loading={isLoading}>
|
|
1089
|
+
<AttributeLabel>Endpoint</AttributeLabel>
|
|
1090
|
+
<AttributeValue>
|
|
1091
|
+
<HStack gap={6}>
|
|
1092
|
+
<HttpMethod method={INCIDENT.method} />
|
|
1093
|
+
<InlineCodeSnippet code={INCIDENT.path} size='md' />
|
|
1094
|
+
</HStack>
|
|
1095
|
+
</AttributeValue>
|
|
1096
|
+
</Attribute>
|
|
1097
|
+
<Attribute loading={isLoading}>
|
|
1098
|
+
<AttributeLabel>Host</AttributeLabel>
|
|
1099
|
+
<AttributeValue>
|
|
1100
|
+
<InlineCodeSnippet code={INCIDENT.host} size='md' />
|
|
1101
|
+
</AttributeValue>
|
|
1102
|
+
</Attribute>
|
|
1103
|
+
<Attribute loading={isLoading}>
|
|
1104
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
1105
|
+
<AttributeValue>
|
|
1106
|
+
<HStack gap={4}>
|
|
1107
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1108
|
+
SQL injection
|
|
1109
|
+
</Badge>
|
|
1110
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1111
|
+
CWE-89
|
|
1112
|
+
</Badge>
|
|
1113
|
+
</HStack>
|
|
1114
|
+
</AttributeValue>
|
|
1115
|
+
</Attribute>
|
|
1116
|
+
<Attribute loading={isLoading}>
|
|
1117
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
1118
|
+
<AttributeValue>
|
|
1119
|
+
<InlineCodeSnippet code={INCIDENT.parameter} size='md' />
|
|
1120
|
+
</AttributeValue>
|
|
1121
|
+
</Attribute>
|
|
1122
|
+
<Attribute loading={isLoading}>
|
|
1123
|
+
<AttributeLabel>Detection rule</AttributeLabel>
|
|
1124
|
+
<AttributeValue>
|
|
1125
|
+
<InlineCodeSnippet code={INCIDENT.rule} size='md' />
|
|
1126
|
+
</AttributeValue>
|
|
1127
|
+
</Attribute>
|
|
1128
|
+
<Attribute loading={isLoading}>
|
|
1129
|
+
<AttributeLabel>Requests</AttributeLabel>
|
|
1130
|
+
<AttributeValue>
|
|
1131
|
+
<FormatNumber value={INCIDENT.requests} notation='standard' />
|
|
1132
|
+
</AttributeValue>
|
|
1133
|
+
</Attribute>
|
|
1134
|
+
<Attribute loading={isLoading}>
|
|
1135
|
+
<AttributeLabel>Blocked</AttributeLabel>
|
|
1136
|
+
<AttributeValue>
|
|
1137
|
+
<FormatNumber value={INCIDENT.blockedShare} type='percent' decimals={1} />
|
|
1138
|
+
</AttributeValue>
|
|
1139
|
+
</Attribute>
|
|
1140
|
+
<Attribute loading={isLoading}>
|
|
1141
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
1142
|
+
<AttributeValue>
|
|
1143
|
+
<FormatDateTime
|
|
1144
|
+
value={INCIDENT.firstSeen}
|
|
1145
|
+
format='datetime'
|
|
1146
|
+
layout='inline'
|
|
1147
|
+
/>
|
|
1148
|
+
</AttributeValue>
|
|
1149
|
+
</Attribute>
|
|
1150
|
+
<Attribute loading={isLoading}>
|
|
1151
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
1152
|
+
<AttributeValue>
|
|
1153
|
+
<FormatDateTime
|
|
1154
|
+
value={INCIDENT.lastSeen}
|
|
1155
|
+
format='datetime'
|
|
1156
|
+
layout='inline'
|
|
1157
|
+
/>
|
|
1158
|
+
</AttributeValue>
|
|
1159
|
+
</Attribute>
|
|
1160
|
+
<Attribute loading={isLoading} isEmpty={!isLoading}>
|
|
1161
|
+
<AttributeLabel>Ticket</AttributeLabel>
|
|
1162
|
+
<AttributeValue />
|
|
1163
|
+
</Attribute>
|
|
1164
|
+
<Attribute loading={isLoading} className='col-span-2'>
|
|
1165
|
+
<AttributeLabel>Source IPs</AttributeLabel>
|
|
1166
|
+
<AttributeValue>
|
|
1167
|
+
<HStack gap={8}>
|
|
1168
|
+
{INCIDENT.sourceIps.map(source => (
|
|
1169
|
+
<Ip key={source.ip}>
|
|
1170
|
+
<IpCountry code={source.country} />
|
|
1171
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
1172
|
+
</Ip>
|
|
1173
|
+
))}
|
|
1174
|
+
</HStack>
|
|
1175
|
+
</AttributeValue>
|
|
1176
|
+
</Attribute>
|
|
1177
|
+
</div>
|
|
1178
|
+
</VStack>
|
|
1179
|
+
|
|
1180
|
+
<VStack gap={12}>
|
|
1181
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1182
|
+
Description
|
|
1183
|
+
</Heading>
|
|
1184
|
+
{isLoading ? (
|
|
1185
|
+
<VStack gap={8}>
|
|
1186
|
+
<Skeleton width='100%' height='16px' rounded={4} />
|
|
1187
|
+
<Skeleton width='72%' height='16px' rounded={4} />
|
|
1188
|
+
</VStack>
|
|
1189
|
+
) : (
|
|
1190
|
+
<Text size='sm'>
|
|
1191
|
+
An automated scanner is sending SQL injection payloads in the customer_id
|
|
1192
|
+
filter of the order search endpoint. Early requests returned 500 while the
|
|
1193
|
+
host was in monitoring mode, which suggests the value reaches the database
|
|
1194
|
+
unescaped. Since blocking was enabled every request is rejected, but the
|
|
1195
|
+
parameter should be fixed at the source.
|
|
1196
|
+
</Text>
|
|
1197
|
+
)}
|
|
1198
|
+
</VStack>
|
|
1199
|
+
|
|
1200
|
+
<VStack gap={12}>
|
|
1201
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1202
|
+
Sample request
|
|
1203
|
+
</Heading>
|
|
1204
|
+
{isLoading ? (
|
|
1205
|
+
<Skeleton width='100%' height='160px' rounded={8} />
|
|
1206
|
+
) : (
|
|
1207
|
+
<CodeSnippetRoot code={SAMPLE_REQUEST} language='text'>
|
|
1208
|
+
<CodeSnippetHeader>
|
|
1209
|
+
<CodeSnippetTitle>Request r-90412 · blocked</CodeSnippetTitle>
|
|
1210
|
+
<CodeSnippetActions>
|
|
1211
|
+
<CodeSnippetWrapButton />
|
|
1212
|
+
<CodeSnippetCopyButton />
|
|
1213
|
+
</CodeSnippetActions>
|
|
1214
|
+
</CodeSnippetHeader>
|
|
1215
|
+
<CodeSnippetContent>
|
|
1216
|
+
<CodeSnippetLineNumbers />
|
|
1217
|
+
<CodeSnippetCode />
|
|
1218
|
+
</CodeSnippetContent>
|
|
1219
|
+
</CodeSnippetRoot>
|
|
1220
|
+
)}
|
|
1221
|
+
</VStack>
|
|
1222
|
+
</VStack>
|
|
1223
|
+
|
|
1224
|
+
<Card className='h-auto' data-testid='incident-latest-activity'>
|
|
1225
|
+
<CardHeader>
|
|
1226
|
+
<CardTitle>Latest activity</CardTitle>
|
|
1227
|
+
<Button
|
|
1228
|
+
variant='ghost'
|
|
1229
|
+
color='neutral'
|
|
1230
|
+
size='small'
|
|
1231
|
+
disabled={isLoading}
|
|
1232
|
+
onClick={handleShowTimeline}
|
|
1233
|
+
>
|
|
1234
|
+
View timeline
|
|
1235
|
+
</Button>
|
|
1236
|
+
</CardHeader>
|
|
1237
|
+
<CardContent>
|
|
1238
|
+
{isLoading ? (
|
|
1239
|
+
<VStack gap={16}>
|
|
1240
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1241
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1242
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1243
|
+
</VStack>
|
|
1244
|
+
) : (
|
|
1245
|
+
<Timeline>
|
|
1246
|
+
{TIMELINE.slice(0, 4).map(event => {
|
|
1247
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
1248
|
+
return (
|
|
1249
|
+
<TimelineItem key={event.id}>
|
|
1250
|
+
<TimelineConnector>
|
|
1251
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
1252
|
+
<Icon />
|
|
1253
|
+
</TimelineIndicator>
|
|
1254
|
+
<TimelineSeparator />
|
|
1255
|
+
</TimelineConnector>
|
|
1256
|
+
<TimelineContent>
|
|
1257
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
1258
|
+
<HStack gap={4}>
|
|
1259
|
+
<FormatDateTime
|
|
1260
|
+
value={event.at}
|
|
1261
|
+
format='datetime'
|
|
1262
|
+
layout='inline'
|
|
1263
|
+
/>
|
|
1264
|
+
<Text size='sm' color='secondary'>
|
|
1265
|
+
· {event.actor}
|
|
1266
|
+
</Text>
|
|
1267
|
+
</HStack>
|
|
1268
|
+
</TimelineContent>
|
|
1269
|
+
</TimelineItem>
|
|
1270
|
+
);
|
|
1271
|
+
})}
|
|
1272
|
+
</Timeline>
|
|
1273
|
+
)}
|
|
1274
|
+
</CardContent>
|
|
1275
|
+
</Card>
|
|
1276
|
+
</div>
|
|
1277
|
+
</TabsContent>
|
|
1278
|
+
|
|
1279
|
+
<TabsContent value='timeline'>
|
|
1280
|
+
<div className='max-w-[720px]'>
|
|
1281
|
+
<Timeline data-testid='incident-timeline'>
|
|
1282
|
+
{TIMELINE.map(event => {
|
|
1283
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
1284
|
+
return (
|
|
1285
|
+
<TimelineItem key={event.id}>
|
|
1286
|
+
<TimelineConnector>
|
|
1287
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
1288
|
+
<Icon />
|
|
1289
|
+
</TimelineIndicator>
|
|
1290
|
+
<TimelineSeparator />
|
|
1291
|
+
</TimelineConnector>
|
|
1292
|
+
<TimelineContent>
|
|
1293
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
1294
|
+
<TimelineDescription>{event.description}</TimelineDescription>
|
|
1295
|
+
<HStack gap={4}>
|
|
1296
|
+
<FormatDateTime value={event.at} format='datetime' layout='inline' />
|
|
1297
|
+
<Text size='sm' color='secondary'>
|
|
1298
|
+
· {event.actor}
|
|
1299
|
+
</Text>
|
|
1300
|
+
</HStack>
|
|
1301
|
+
</TimelineContent>
|
|
1302
|
+
</TimelineItem>
|
|
1303
|
+
);
|
|
1304
|
+
})}
|
|
1305
|
+
</Timeline>
|
|
1306
|
+
</div>
|
|
1307
|
+
</TabsContent>
|
|
1308
|
+
|
|
1309
|
+
<TabsContent value='events'>
|
|
1310
|
+
<Table
|
|
1311
|
+
aria-label='Related events'
|
|
1312
|
+
data={RELATED_EVENTS}
|
|
1313
|
+
columns={eventColumns}
|
|
1314
|
+
getRowId={getItemId}
|
|
1315
|
+
isLoading={isLoading}
|
|
1316
|
+
data-testid='incident-events-table'
|
|
1317
|
+
/>
|
|
1318
|
+
</TabsContent>
|
|
1319
|
+
|
|
1320
|
+
<TabsContent value='comments'>
|
|
1321
|
+
<VStack gap={24} className='max-w-[720px]' data-testid='incident-comments'>
|
|
1322
|
+
{comments.map(comment => (
|
|
1323
|
+
<VStack key={comment.id} gap={8}>
|
|
1324
|
+
<HStack justify='between'>
|
|
1325
|
+
<Avatar size='md'>
|
|
1326
|
+
<AvatarFallback name={comment.author} />
|
|
1327
|
+
<AvatarContent>
|
|
1328
|
+
<AvatarName>{comment.author}</AvatarName>
|
|
1329
|
+
<AvatarDescription>{comment.role}</AvatarDescription>
|
|
1330
|
+
</AvatarContent>
|
|
1331
|
+
</Avatar>
|
|
1332
|
+
<FormatDateTime value={comment.at} format='datetime' layout='inline' />
|
|
1333
|
+
</HStack>
|
|
1334
|
+
<Text size='sm'>{comment.body}</Text>
|
|
1335
|
+
</VStack>
|
|
1336
|
+
))}
|
|
1337
|
+
<VStack gap={12}>
|
|
1338
|
+
<Field>
|
|
1339
|
+
<FieldLabel>Add a comment</FieldLabel>
|
|
1340
|
+
<Textarea
|
|
1341
|
+
value={draft}
|
|
1342
|
+
onChange={handleDraftChange}
|
|
1343
|
+
minRows={3}
|
|
1344
|
+
placeholder='Share findings or next steps with the team'
|
|
1345
|
+
data-testid='incident-comment-input'
|
|
1346
|
+
/>
|
|
1347
|
+
</Field>
|
|
1348
|
+
<HStack justify='end'>
|
|
1349
|
+
<Button size='medium' disabled={!draft.trim()} onClick={handleAddComment}>
|
|
1350
|
+
<MessageSquare />
|
|
1351
|
+
Comment
|
|
1352
|
+
</Button>
|
|
1353
|
+
</HStack>
|
|
1354
|
+
</VStack>
|
|
1355
|
+
</VStack>
|
|
1356
|
+
</TabsContent>
|
|
1357
|
+
</PageContent>
|
|
1358
|
+
</Tabs>
|
|
1359
|
+
|
|
1360
|
+
<Dialog
|
|
1361
|
+
width={400}
|
|
1362
|
+
open={dialogOpen}
|
|
1363
|
+
onOpenChange={handleDialogOpenChange}
|
|
1364
|
+
data-testid='false-positive-dialog'
|
|
1365
|
+
>
|
|
1366
|
+
<DialogContent>
|
|
1367
|
+
<DialogHeader>
|
|
1368
|
+
<DialogTitle>Mark as false positive?</DialogTitle>
|
|
1369
|
+
<DialogDescription>
|
|
1370
|
+
This closes {INCIDENT.id} and adds a rule exception for {INCIDENT.method}{' '}
|
|
1371
|
+
{INCIDENT.path}, so matching requests stop raising incidents. You can reopen it later.
|
|
1372
|
+
</DialogDescription>
|
|
1373
|
+
</DialogHeader>
|
|
1374
|
+
<DialogFooter>
|
|
1375
|
+
<DialogClose asChild>
|
|
1376
|
+
<Button variant='ghost' color='neutral'>
|
|
1377
|
+
Cancel
|
|
1378
|
+
</Button>
|
|
1379
|
+
</DialogClose>
|
|
1380
|
+
<Button
|
|
1381
|
+
loading={pending}
|
|
1382
|
+
onClick={handleConfirmFalsePositive}
|
|
1383
|
+
data-testid='false-positive-confirm'
|
|
1384
|
+
>
|
|
1385
|
+
Mark as false positive
|
|
1386
|
+
</Button>
|
|
1387
|
+
</DialogFooter>
|
|
1388
|
+
</DialogContent>
|
|
1389
|
+
</Dialog>
|
|
1390
|
+
</Page>
|
|
1391
|
+
);
|
|
1392
|
+
};
|
|
1393
|
+
```
|
|
1394
|
+
|
|
1395
|
+
First load with skeletons.
|
|
1396
|
+
|
|
1397
|
+
First load: header skeletons, disabled actions, tabs without counts, `Attribute loading`
|
|
1398
|
+
rows and skeleton blocks where the description, request and activity card will land.
|
|
1399
|
+
|
|
1400
|
+
```tsx story=Loading
|
|
1401
|
+
import { type ChangeEvent, useState } from 'react';
|
|
1402
|
+
import { Alert, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle } from '@wallarm-org/design-system/Alert';
|
|
1403
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
1404
|
+
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
|
|
1405
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
1406
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
1407
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@wallarm-org/design-system/Card';
|
|
1408
|
+
import { Code } from '@wallarm-org/design-system/Code';
|
|
1409
|
+
import { CodeSnippetActions, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetHeader, CodeSnippetLineNumbers, CodeSnippetRoot, CodeSnippetTitle, CodeSnippetWrapButton, InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
1410
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
|
|
1411
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
1412
|
+
import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
|
|
1413
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
1414
|
+
import { FormatNumber } from '@wallarm-org/design-system/FormatNumber';
|
|
1415
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
1416
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
1417
|
+
import { ChevronDown, CircleCheck, Copy, Download, Ellipsis, ExternalLink, Flag, MessageSquare, ShieldAlert, ShieldCheck } from '@wallarm-org/design-system/icons';
|
|
1418
|
+
import { Ip, IpAddress, IpCountry } from '@wallarm-org/design-system/Ip';
|
|
1419
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
1420
|
+
import { Page, PageActions, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
1421
|
+
import { ResponseCode } from '@wallarm-org/design-system/ResponseCode';
|
|
1422
|
+
import { Skeleton } from '@wallarm-org/design-system/Skeleton';
|
|
1423
|
+
import { SplitButton } from '@wallarm-org/design-system/SplitButton';
|
|
1424
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
1425
|
+
import { type TableCellContext, type TableColumnDef, type TableRow, Table } from '@wallarm-org/design-system/Table';
|
|
1426
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
1427
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
1428
|
+
import { Textarea } from '@wallarm-org/design-system/Textarea';
|
|
1429
|
+
import { Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineSeparator, TimelineTitle } from '@wallarm-org/design-system/Timeline';
|
|
1430
|
+
import { useToast } from '@wallarm-org/design-system/Toast';
|
|
1431
|
+
|
|
1432
|
+
export const Loading = ({
|
|
1433
|
+
initialTab = 'overview',
|
|
1434
|
+
isLoading = false,
|
|
1435
|
+
}) => {
|
|
1436
|
+
const toast = useToast();
|
|
1437
|
+
const [tab, setTab] = useState(initialTab);
|
|
1438
|
+
const [status, setStatus] = useState<IncidentStatus>('open');
|
|
1439
|
+
const [assignee, setAssignee] = useState('Daniel Okafor');
|
|
1440
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
1441
|
+
const [pending, setPending] = useState(false);
|
|
1442
|
+
const [comments, setComments] = useState(COMMENTS);
|
|
1443
|
+
const [draft, setDraft] = useState('');
|
|
1444
|
+
|
|
1445
|
+
const renderRequest = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1446
|
+
<HStack gap={8}>
|
|
1447
|
+
<HttpMethod method={row.original.method} />
|
|
1448
|
+
<Text size='sm' truncate>
|
|
1449
|
+
{row.original.path}
|
|
1450
|
+
</Text>
|
|
1451
|
+
</HStack>
|
|
1452
|
+
);
|
|
1453
|
+
const renderSource = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1454
|
+
<Ip>
|
|
1455
|
+
<IpCountry code={row.original.country} />
|
|
1456
|
+
<IpAddress>{row.original.ip}</IpAddress>
|
|
1457
|
+
</Ip>
|
|
1458
|
+
);
|
|
1459
|
+
const renderPayload = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1460
|
+
<Code size='m' truncate>
|
|
1461
|
+
{row.original.payload}
|
|
1462
|
+
</Code>
|
|
1463
|
+
);
|
|
1464
|
+
const renderResponse = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1465
|
+
<ResponseCode code={row.original.responseCode} />
|
|
1466
|
+
);
|
|
1467
|
+
const renderAction = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1468
|
+
<Badge variant='dotted' type='secondary' color={ACTION[row.original.action].color}>
|
|
1469
|
+
{ACTION[row.original.action].label}
|
|
1470
|
+
</Badge>
|
|
1471
|
+
);
|
|
1472
|
+
const renderTime = ({ row }: TableCellContext<RelatedEvent, unknown>) => (
|
|
1473
|
+
<FormatDateTime value={row.original.at} format='datetime' layout='inline' />
|
|
1474
|
+
);
|
|
1475
|
+
|
|
1476
|
+
const renderEventMenu = (row: TableRow<RelatedEvent>) => {
|
|
1477
|
+
const event = row.original;
|
|
1478
|
+
const handleOpen = () => onOpenRequest(event.id);
|
|
1479
|
+
const handleCopyId = () => onCopyRequestId(event.id);
|
|
1480
|
+
|
|
1481
|
+
return (
|
|
1482
|
+
<DropdownMenu data-testid='incident-event-menu'>
|
|
1483
|
+
<DropdownMenuTrigger asChild>
|
|
1484
|
+
<Button
|
|
1485
|
+
variant='ghost'
|
|
1486
|
+
color='neutral'
|
|
1487
|
+
size='small'
|
|
1488
|
+
aria-label={`Actions for request ${event.id}`}
|
|
1489
|
+
>
|
|
1490
|
+
<Ellipsis />
|
|
1491
|
+
</Button>
|
|
1492
|
+
</DropdownMenuTrigger>
|
|
1493
|
+
<DropdownMenuContent>
|
|
1494
|
+
<DropdownMenuItem onSelect={handleOpen}>
|
|
1495
|
+
<DropdownMenuItemText>Open request</DropdownMenuItemText>
|
|
1496
|
+
</DropdownMenuItem>
|
|
1497
|
+
<DropdownMenuItem onSelect={handleCopyId}>
|
|
1498
|
+
<DropdownMenuItemText>Copy request ID</DropdownMenuItemText>
|
|
1499
|
+
</DropdownMenuItem>
|
|
1500
|
+
</DropdownMenuContent>
|
|
1501
|
+
</DropdownMenu>
|
|
1502
|
+
);
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
const eventColumns: TableColumnDef<RelatedEvent>[] = [
|
|
1506
|
+
{
|
|
1507
|
+
id: 'request',
|
|
1508
|
+
header: 'Request',
|
|
1509
|
+
size: 320,
|
|
1510
|
+
cell: renderRequest,
|
|
1511
|
+
meta: { renderMenuAction: renderEventMenu },
|
|
1512
|
+
},
|
|
1513
|
+
{ accessorKey: 'ip', header: 'Source', size: 200, cell: renderSource },
|
|
1514
|
+
{ accessorKey: 'payload', header: 'Payload', size: 360, cell: renderPayload },
|
|
1515
|
+
{ accessorKey: 'responseCode', header: 'Response', size: 120, cell: renderResponse },
|
|
1516
|
+
{ accessorKey: 'action', header: 'Result', size: 140, cell: renderAction },
|
|
1517
|
+
{ accessorKey: 'at', header: 'Time', size: 200, cell: renderTime },
|
|
1518
|
+
];
|
|
1519
|
+
|
|
1520
|
+
const isOpen = status === 'open';
|
|
1521
|
+
|
|
1522
|
+
const handleResolve = () => {
|
|
1523
|
+
onResolve(INCIDENT.id);
|
|
1524
|
+
setStatus(isOpen ? 'resolved' : 'open');
|
|
1525
|
+
toast.create({
|
|
1526
|
+
id: 'incident-resolution',
|
|
1527
|
+
title: isOpen ? 'Incident resolved' : 'Incident reopened',
|
|
1528
|
+
type: 'default',
|
|
1529
|
+
});
|
|
1530
|
+
};
|
|
1531
|
+
const handleOpenFalsePositive = () => setDialogOpen(true);
|
|
1532
|
+
const handleAcceptRisk = () => onAcceptRisk(INCIDENT.id);
|
|
1533
|
+
const handleCreateTicket = () => onCreateTicket(INCIDENT.id);
|
|
1534
|
+
const handleCopyLink = () => onCopyLink(INCIDENT.id);
|
|
1535
|
+
const handleExport = () => onExport(INCIDENT.id);
|
|
1536
|
+
const handleAssigneeChange = ({ value }: { value: string }) => {
|
|
1537
|
+
onAssign(value);
|
|
1538
|
+
setAssignee(value);
|
|
1539
|
+
};
|
|
1540
|
+
const handleShowTimeline = () => setTab('timeline');
|
|
1541
|
+
const handleShowEvents = () => setTab('events');
|
|
1542
|
+
const handleDialogOpenChange = (next: boolean) => {
|
|
1543
|
+
if (!pending) setDialogOpen(next);
|
|
1544
|
+
};
|
|
1545
|
+
const handleConfirmFalsePositive = async () => {
|
|
1546
|
+
setPending(true);
|
|
1547
|
+
try {
|
|
1548
|
+
await markFalsePositive(INCIDENT.id);
|
|
1549
|
+
setStatus('false-positive');
|
|
1550
|
+
setDialogOpen(false);
|
|
1551
|
+
toast.create({ title: 'Marked as false positive', type: 'default' });
|
|
1552
|
+
} catch {
|
|
1553
|
+
toast.create({ title: "Couldn't mark as false positive", type: 'error' });
|
|
1554
|
+
} finally {
|
|
1555
|
+
setPending(false);
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
const handleDraftChange = (event: ChangeEvent<HTMLTextAreaElement>) =>
|
|
1559
|
+
setDraft(event.target.value);
|
|
1560
|
+
const handleAddComment = () => {
|
|
1561
|
+
const body = draft.trim();
|
|
1562
|
+
if (!body) return;
|
|
1563
|
+
onAddComment(body);
|
|
1564
|
+
setComments(prev => [
|
|
1565
|
+
...prev,
|
|
1566
|
+
{
|
|
1567
|
+
id: `c-${prev.length + 1}`,
|
|
1568
|
+
author: assignee,
|
|
1569
|
+
role: 'Security analyst',
|
|
1570
|
+
body,
|
|
1571
|
+
at: new Date().toISOString(),
|
|
1572
|
+
},
|
|
1573
|
+
]);
|
|
1574
|
+
setDraft('');
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
return (
|
|
1578
|
+
<Page name='incident-detail' fullSize fixedHeight data-testid='incident-page'>
|
|
1579
|
+
<PageHeader>
|
|
1580
|
+
<PageHeaderGroup className='flex-1 gap-6'>
|
|
1581
|
+
{isLoading ? (
|
|
1582
|
+
<>
|
|
1583
|
+
<Skeleton width='480px' height='28px' rounded={6} />
|
|
1584
|
+
<Skeleton width='320px' height='20px' rounded={6} />
|
|
1585
|
+
</>
|
|
1586
|
+
) : (
|
|
1587
|
+
<>
|
|
1588
|
+
<PageTitle>{INCIDENT.title}</PageTitle>
|
|
1589
|
+
<HStack gap={8} data-testid='incident-meta'>
|
|
1590
|
+
<Badge color='red' type='solid'>
|
|
1591
|
+
<ShieldAlert />
|
|
1592
|
+
Critical
|
|
1593
|
+
</Badge>
|
|
1594
|
+
<Badge
|
|
1595
|
+
variant='dotted'
|
|
1596
|
+
type='secondary'
|
|
1597
|
+
color={STATUS[status].color}
|
|
1598
|
+
data-testid='incident-status'
|
|
1599
|
+
>
|
|
1600
|
+
{STATUS[status].label}
|
|
1601
|
+
</Badge>
|
|
1602
|
+
<Text size='sm' color='secondary'>
|
|
1603
|
+
{INCIDENT.id} · {INCIDENT.host} · opened
|
|
1604
|
+
</Text>
|
|
1605
|
+
<FormatDateTime value={INCIDENT.firstSeen} format='datetime' layout='inline' />
|
|
1606
|
+
</HStack>
|
|
1607
|
+
</>
|
|
1608
|
+
)}
|
|
1609
|
+
</PageHeaderGroup>
|
|
1610
|
+
<PageActions>
|
|
1611
|
+
<DropdownMenu>
|
|
1612
|
+
<DropdownMenuTrigger asChild>
|
|
1613
|
+
<Button
|
|
1614
|
+
variant='outline'
|
|
1615
|
+
color='neutral'
|
|
1616
|
+
size='medium'
|
|
1617
|
+
disabled={isLoading}
|
|
1618
|
+
data-testid='incident-assignee'
|
|
1619
|
+
>
|
|
1620
|
+
<Avatar size='sm'>
|
|
1621
|
+
<AvatarFallback name={assignee} />
|
|
1622
|
+
</Avatar>
|
|
1623
|
+
{assignee}
|
|
1624
|
+
<ChevronDown />
|
|
1625
|
+
</Button>
|
|
1626
|
+
</DropdownMenuTrigger>
|
|
1627
|
+
<DropdownMenuContent>
|
|
1628
|
+
<DropdownMenuLabel>Assignee</DropdownMenuLabel>
|
|
1629
|
+
<DropdownMenuRadioGroup value={assignee} onValueChange={handleAssigneeChange}>
|
|
1630
|
+
{ANALYSTS.map(name => (
|
|
1631
|
+
<DropdownMenuRadioItem key={name} value={name}>
|
|
1632
|
+
{name}
|
|
1633
|
+
</DropdownMenuRadioItem>
|
|
1634
|
+
))}
|
|
1635
|
+
</DropdownMenuRadioGroup>
|
|
1636
|
+
</DropdownMenuContent>
|
|
1637
|
+
</DropdownMenu>
|
|
1638
|
+
|
|
1639
|
+
<DropdownMenu>
|
|
1640
|
+
<SplitButton data-testid='incident-resolve'>
|
|
1641
|
+
<Button
|
|
1642
|
+
size='medium'
|
|
1643
|
+
disabled={isLoading}
|
|
1644
|
+
onClick={handleResolve}
|
|
1645
|
+
data-testid='incident-resolve-primary'
|
|
1646
|
+
>
|
|
1647
|
+
{isOpen ? <CircleCheck /> : null}
|
|
1648
|
+
{isOpen ? 'Resolve' : 'Reopen'}
|
|
1649
|
+
</Button>
|
|
1650
|
+
<DropdownMenuTrigger asChild>
|
|
1651
|
+
<Button
|
|
1652
|
+
size='medium'
|
|
1653
|
+
disabled={isLoading || !isOpen}
|
|
1654
|
+
aria-label='More ways to resolve'
|
|
1655
|
+
data-testid='incident-resolve-menu'
|
|
1656
|
+
>
|
|
1657
|
+
<ChevronDown />
|
|
1658
|
+
</Button>
|
|
1659
|
+
</DropdownMenuTrigger>
|
|
1660
|
+
</SplitButton>
|
|
1661
|
+
<DropdownMenuContent>
|
|
1662
|
+
<DropdownMenuItem
|
|
1663
|
+
onSelect={handleOpenFalsePositive}
|
|
1664
|
+
data-testid='incident-false-positive'
|
|
1665
|
+
>
|
|
1666
|
+
<DropdownMenuItemIcon>
|
|
1667
|
+
<Flag />
|
|
1668
|
+
</DropdownMenuItemIcon>
|
|
1669
|
+
<DropdownMenuItemText>Mark as false positive</DropdownMenuItemText>
|
|
1670
|
+
</DropdownMenuItem>
|
|
1671
|
+
<DropdownMenuItem onSelect={handleAcceptRisk}>
|
|
1672
|
+
<DropdownMenuItemIcon>
|
|
1673
|
+
<ShieldCheck />
|
|
1674
|
+
</DropdownMenuItemIcon>
|
|
1675
|
+
<DropdownMenuItemText>Accept risk</DropdownMenuItemText>
|
|
1676
|
+
</DropdownMenuItem>
|
|
1677
|
+
<DropdownMenuItem onSelect={handleCreateTicket}>
|
|
1678
|
+
<DropdownMenuItemIcon>
|
|
1679
|
+
<ExternalLink />
|
|
1680
|
+
</DropdownMenuItemIcon>
|
|
1681
|
+
<DropdownMenuItemText>Create Jira ticket</DropdownMenuItemText>
|
|
1682
|
+
</DropdownMenuItem>
|
|
1683
|
+
</DropdownMenuContent>
|
|
1684
|
+
</DropdownMenu>
|
|
1685
|
+
|
|
1686
|
+
<DropdownMenu>
|
|
1687
|
+
<DropdownMenuTrigger asChild>
|
|
1688
|
+
<Button
|
|
1689
|
+
variant='ghost'
|
|
1690
|
+
color='neutral'
|
|
1691
|
+
size='medium'
|
|
1692
|
+
disabled={isLoading}
|
|
1693
|
+
aria-label='More actions'
|
|
1694
|
+
>
|
|
1695
|
+
<Ellipsis />
|
|
1696
|
+
</Button>
|
|
1697
|
+
</DropdownMenuTrigger>
|
|
1698
|
+
<DropdownMenuContent>
|
|
1699
|
+
<DropdownMenuItem onSelect={handleCopyLink}>
|
|
1700
|
+
<DropdownMenuItemIcon>
|
|
1701
|
+
<Copy />
|
|
1702
|
+
</DropdownMenuItemIcon>
|
|
1703
|
+
<DropdownMenuItemText>Copy link</DropdownMenuItemText>
|
|
1704
|
+
</DropdownMenuItem>
|
|
1705
|
+
<DropdownMenuSeparator />
|
|
1706
|
+
<DropdownMenuItem onSelect={handleExport}>
|
|
1707
|
+
<DropdownMenuItemIcon>
|
|
1708
|
+
<Download />
|
|
1709
|
+
</DropdownMenuItemIcon>
|
|
1710
|
+
<DropdownMenuItemText>Export report</DropdownMenuItemText>
|
|
1711
|
+
</DropdownMenuItem>
|
|
1712
|
+
</DropdownMenuContent>
|
|
1713
|
+
</DropdownMenu>
|
|
1714
|
+
</PageActions>
|
|
1715
|
+
</PageHeader>
|
|
1716
|
+
|
|
1717
|
+
<Tabs
|
|
1718
|
+
value={tab}
|
|
1719
|
+
onChange={setTab}
|
|
1720
|
+
className='flex min-h-0 flex-1 flex-col'
|
|
1721
|
+
data-testid='incident-tabs'
|
|
1722
|
+
>
|
|
1723
|
+
<TabsList>
|
|
1724
|
+
<TabsTrigger value='overview'>Overview</TabsTrigger>
|
|
1725
|
+
<TabsTrigger value='timeline'>
|
|
1726
|
+
Timeline {!isLoading && <NumericBadge>{TIMELINE.length}</NumericBadge>}
|
|
1727
|
+
</TabsTrigger>
|
|
1728
|
+
<TabsTrigger value='events' data-testid='incident-tab-events'>
|
|
1729
|
+
Related events {!isLoading && <NumericBadge>{RELATED_EVENTS.length}</NumericBadge>}
|
|
1730
|
+
</TabsTrigger>
|
|
1731
|
+
<TabsTrigger value='comments'>
|
|
1732
|
+
Comments {!isLoading && <NumericBadge>{comments.length}</NumericBadge>}
|
|
1733
|
+
</TabsTrigger>
|
|
1734
|
+
</TabsList>
|
|
1735
|
+
|
|
1736
|
+
<PageContent>
|
|
1737
|
+
<TabsContent value='overview'>
|
|
1738
|
+
<div className='grid grid-cols-[minmax(0,1fr)_400px] items-start gap-24'>
|
|
1739
|
+
<VStack gap={24}>
|
|
1740
|
+
{isOpen && !isLoading && (
|
|
1741
|
+
<Alert color='destructive' data-testid='incident-alert'>
|
|
1742
|
+
<AlertIcon />
|
|
1743
|
+
<AlertContent>
|
|
1744
|
+
<AlertTitle>Attack still in progress</AlertTitle>
|
|
1745
|
+
<AlertDescription>
|
|
1746
|
+
412 requests a minute from 4 addresses. Blocking mode is on for{' '}
|
|
1747
|
+
{INCIDENT.host}, so none reach the application.
|
|
1748
|
+
</AlertDescription>
|
|
1749
|
+
</AlertContent>
|
|
1750
|
+
<AlertControls>
|
|
1751
|
+
<Button
|
|
1752
|
+
variant='secondary'
|
|
1753
|
+
color='neutral'
|
|
1754
|
+
size='small'
|
|
1755
|
+
onClick={handleShowEvents}
|
|
1756
|
+
>
|
|
1757
|
+
View related events
|
|
1758
|
+
</Button>
|
|
1759
|
+
</AlertControls>
|
|
1760
|
+
</Alert>
|
|
1761
|
+
)}
|
|
1762
|
+
|
|
1763
|
+
<VStack gap={12}>
|
|
1764
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1765
|
+
Details
|
|
1766
|
+
</Heading>
|
|
1767
|
+
<div
|
|
1768
|
+
className='grid grid-cols-2 gap-x-8 gap-y-16 rounded-8 border border-border-primary-light p-16'
|
|
1769
|
+
data-testid='incident-attributes'
|
|
1770
|
+
>
|
|
1771
|
+
<Attribute loading={isLoading}>
|
|
1772
|
+
<AttributeLabel>Endpoint</AttributeLabel>
|
|
1773
|
+
<AttributeValue>
|
|
1774
|
+
<HStack gap={6}>
|
|
1775
|
+
<HttpMethod method={INCIDENT.method} />
|
|
1776
|
+
<InlineCodeSnippet code={INCIDENT.path} size='md' />
|
|
1777
|
+
</HStack>
|
|
1778
|
+
</AttributeValue>
|
|
1779
|
+
</Attribute>
|
|
1780
|
+
<Attribute loading={isLoading}>
|
|
1781
|
+
<AttributeLabel>Host</AttributeLabel>
|
|
1782
|
+
<AttributeValue>
|
|
1783
|
+
<InlineCodeSnippet code={INCIDENT.host} size='md' />
|
|
1784
|
+
</AttributeValue>
|
|
1785
|
+
</Attribute>
|
|
1786
|
+
<Attribute loading={isLoading}>
|
|
1787
|
+
<AttributeLabel>Attack type</AttributeLabel>
|
|
1788
|
+
<AttributeValue>
|
|
1789
|
+
<HStack gap={4}>
|
|
1790
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1791
|
+
SQL injection
|
|
1792
|
+
</Badge>
|
|
1793
|
+
<Badge type='secondary' color='slate' size='medium'>
|
|
1794
|
+
CWE-89
|
|
1795
|
+
</Badge>
|
|
1796
|
+
</HStack>
|
|
1797
|
+
</AttributeValue>
|
|
1798
|
+
</Attribute>
|
|
1799
|
+
<Attribute loading={isLoading}>
|
|
1800
|
+
<AttributeLabel>Parameter</AttributeLabel>
|
|
1801
|
+
<AttributeValue>
|
|
1802
|
+
<InlineCodeSnippet code={INCIDENT.parameter} size='md' />
|
|
1803
|
+
</AttributeValue>
|
|
1804
|
+
</Attribute>
|
|
1805
|
+
<Attribute loading={isLoading}>
|
|
1806
|
+
<AttributeLabel>Detection rule</AttributeLabel>
|
|
1807
|
+
<AttributeValue>
|
|
1808
|
+
<InlineCodeSnippet code={INCIDENT.rule} size='md' />
|
|
1809
|
+
</AttributeValue>
|
|
1810
|
+
</Attribute>
|
|
1811
|
+
<Attribute loading={isLoading}>
|
|
1812
|
+
<AttributeLabel>Requests</AttributeLabel>
|
|
1813
|
+
<AttributeValue>
|
|
1814
|
+
<FormatNumber value={INCIDENT.requests} notation='standard' />
|
|
1815
|
+
</AttributeValue>
|
|
1816
|
+
</Attribute>
|
|
1817
|
+
<Attribute loading={isLoading}>
|
|
1818
|
+
<AttributeLabel>Blocked</AttributeLabel>
|
|
1819
|
+
<AttributeValue>
|
|
1820
|
+
<FormatNumber value={INCIDENT.blockedShare} type='percent' decimals={1} />
|
|
1821
|
+
</AttributeValue>
|
|
1822
|
+
</Attribute>
|
|
1823
|
+
<Attribute loading={isLoading}>
|
|
1824
|
+
<AttributeLabel>First seen</AttributeLabel>
|
|
1825
|
+
<AttributeValue>
|
|
1826
|
+
<FormatDateTime
|
|
1827
|
+
value={INCIDENT.firstSeen}
|
|
1828
|
+
format='datetime'
|
|
1829
|
+
layout='inline'
|
|
1830
|
+
/>
|
|
1831
|
+
</AttributeValue>
|
|
1832
|
+
</Attribute>
|
|
1833
|
+
<Attribute loading={isLoading}>
|
|
1834
|
+
<AttributeLabel>Last seen</AttributeLabel>
|
|
1835
|
+
<AttributeValue>
|
|
1836
|
+
<FormatDateTime
|
|
1837
|
+
value={INCIDENT.lastSeen}
|
|
1838
|
+
format='datetime'
|
|
1839
|
+
layout='inline'
|
|
1840
|
+
/>
|
|
1841
|
+
</AttributeValue>
|
|
1842
|
+
</Attribute>
|
|
1843
|
+
<Attribute loading={isLoading} isEmpty={!isLoading}>
|
|
1844
|
+
<AttributeLabel>Ticket</AttributeLabel>
|
|
1845
|
+
<AttributeValue />
|
|
1846
|
+
</Attribute>
|
|
1847
|
+
<Attribute loading={isLoading} className='col-span-2'>
|
|
1848
|
+
<AttributeLabel>Source IPs</AttributeLabel>
|
|
1849
|
+
<AttributeValue>
|
|
1850
|
+
<HStack gap={8}>
|
|
1851
|
+
{INCIDENT.sourceIps.map(source => (
|
|
1852
|
+
<Ip key={source.ip}>
|
|
1853
|
+
<IpCountry code={source.country} />
|
|
1854
|
+
<IpAddress>{source.ip}</IpAddress>
|
|
1855
|
+
</Ip>
|
|
1856
|
+
))}
|
|
1857
|
+
</HStack>
|
|
1858
|
+
</AttributeValue>
|
|
1859
|
+
</Attribute>
|
|
1860
|
+
</div>
|
|
1861
|
+
</VStack>
|
|
1862
|
+
|
|
1863
|
+
<VStack gap={12}>
|
|
1864
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1865
|
+
Description
|
|
1866
|
+
</Heading>
|
|
1867
|
+
{isLoading ? (
|
|
1868
|
+
<VStack gap={8}>
|
|
1869
|
+
<Skeleton width='100%' height='16px' rounded={4} />
|
|
1870
|
+
<Skeleton width='72%' height='16px' rounded={4} />
|
|
1871
|
+
</VStack>
|
|
1872
|
+
) : (
|
|
1873
|
+
<Text size='sm'>
|
|
1874
|
+
An automated scanner is sending SQL injection payloads in the customer_id
|
|
1875
|
+
filter of the order search endpoint. Early requests returned 500 while the
|
|
1876
|
+
host was in monitoring mode, which suggests the value reaches the database
|
|
1877
|
+
unescaped. Since blocking was enabled every request is rejected, but the
|
|
1878
|
+
parameter should be fixed at the source.
|
|
1879
|
+
</Text>
|
|
1880
|
+
)}
|
|
1881
|
+
</VStack>
|
|
1882
|
+
|
|
1883
|
+
<VStack gap={12}>
|
|
1884
|
+
<Heading as='h2' size='md' weight='medium'>
|
|
1885
|
+
Sample request
|
|
1886
|
+
</Heading>
|
|
1887
|
+
{isLoading ? (
|
|
1888
|
+
<Skeleton width='100%' height='160px' rounded={8} />
|
|
1889
|
+
) : (
|
|
1890
|
+
<CodeSnippetRoot code={SAMPLE_REQUEST} language='text'>
|
|
1891
|
+
<CodeSnippetHeader>
|
|
1892
|
+
<CodeSnippetTitle>Request r-90412 · blocked</CodeSnippetTitle>
|
|
1893
|
+
<CodeSnippetActions>
|
|
1894
|
+
<CodeSnippetWrapButton />
|
|
1895
|
+
<CodeSnippetCopyButton />
|
|
1896
|
+
</CodeSnippetActions>
|
|
1897
|
+
</CodeSnippetHeader>
|
|
1898
|
+
<CodeSnippetContent>
|
|
1899
|
+
<CodeSnippetLineNumbers />
|
|
1900
|
+
<CodeSnippetCode />
|
|
1901
|
+
</CodeSnippetContent>
|
|
1902
|
+
</CodeSnippetRoot>
|
|
1903
|
+
)}
|
|
1904
|
+
</VStack>
|
|
1905
|
+
</VStack>
|
|
1906
|
+
|
|
1907
|
+
<Card className='h-auto' data-testid='incident-latest-activity'>
|
|
1908
|
+
<CardHeader>
|
|
1909
|
+
<CardTitle>Latest activity</CardTitle>
|
|
1910
|
+
<Button
|
|
1911
|
+
variant='ghost'
|
|
1912
|
+
color='neutral'
|
|
1913
|
+
size='small'
|
|
1914
|
+
disabled={isLoading}
|
|
1915
|
+
onClick={handleShowTimeline}
|
|
1916
|
+
>
|
|
1917
|
+
View timeline
|
|
1918
|
+
</Button>
|
|
1919
|
+
</CardHeader>
|
|
1920
|
+
<CardContent>
|
|
1921
|
+
{isLoading ? (
|
|
1922
|
+
<VStack gap={16}>
|
|
1923
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1924
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1925
|
+
<Skeleton width='100%' height='40px' rounded={6} />
|
|
1926
|
+
</VStack>
|
|
1927
|
+
) : (
|
|
1928
|
+
<Timeline>
|
|
1929
|
+
{TIMELINE.slice(0, 4).map(event => {
|
|
1930
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
1931
|
+
return (
|
|
1932
|
+
<TimelineItem key={event.id}>
|
|
1933
|
+
<TimelineConnector>
|
|
1934
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
1935
|
+
<Icon />
|
|
1936
|
+
</TimelineIndicator>
|
|
1937
|
+
<TimelineSeparator />
|
|
1938
|
+
</TimelineConnector>
|
|
1939
|
+
<TimelineContent>
|
|
1940
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
1941
|
+
<HStack gap={4}>
|
|
1942
|
+
<FormatDateTime
|
|
1943
|
+
value={event.at}
|
|
1944
|
+
format='datetime'
|
|
1945
|
+
layout='inline'
|
|
1946
|
+
/>
|
|
1947
|
+
<Text size='sm' color='secondary'>
|
|
1948
|
+
· {event.actor}
|
|
1949
|
+
</Text>
|
|
1950
|
+
</HStack>
|
|
1951
|
+
</TimelineContent>
|
|
1952
|
+
</TimelineItem>
|
|
1953
|
+
);
|
|
1954
|
+
})}
|
|
1955
|
+
</Timeline>
|
|
1956
|
+
)}
|
|
1957
|
+
</CardContent>
|
|
1958
|
+
</Card>
|
|
1959
|
+
</div>
|
|
1960
|
+
</TabsContent>
|
|
1961
|
+
|
|
1962
|
+
<TabsContent value='timeline'>
|
|
1963
|
+
<div className='max-w-[720px]'>
|
|
1964
|
+
<Timeline data-testid='incident-timeline'>
|
|
1965
|
+
{TIMELINE.map(event => {
|
|
1966
|
+
const Icon = INDICATOR[event.kind].icon;
|
|
1967
|
+
return (
|
|
1968
|
+
<TimelineItem key={event.id}>
|
|
1969
|
+
<TimelineConnector>
|
|
1970
|
+
<TimelineIndicator color={INDICATOR[event.kind].color}>
|
|
1971
|
+
<Icon />
|
|
1972
|
+
</TimelineIndicator>
|
|
1973
|
+
<TimelineSeparator />
|
|
1974
|
+
</TimelineConnector>
|
|
1975
|
+
<TimelineContent>
|
|
1976
|
+
<TimelineTitle>{event.title}</TimelineTitle>
|
|
1977
|
+
<TimelineDescription>{event.description}</TimelineDescription>
|
|
1978
|
+
<HStack gap={4}>
|
|
1979
|
+
<FormatDateTime value={event.at} format='datetime' layout='inline' />
|
|
1980
|
+
<Text size='sm' color='secondary'>
|
|
1981
|
+
· {event.actor}
|
|
1982
|
+
</Text>
|
|
1983
|
+
</HStack>
|
|
1984
|
+
</TimelineContent>
|
|
1985
|
+
</TimelineItem>
|
|
1986
|
+
);
|
|
1987
|
+
})}
|
|
1988
|
+
</Timeline>
|
|
1989
|
+
</div>
|
|
1990
|
+
</TabsContent>
|
|
1991
|
+
|
|
1992
|
+
<TabsContent value='events'>
|
|
1993
|
+
<Table
|
|
1994
|
+
aria-label='Related events'
|
|
1995
|
+
data={RELATED_EVENTS}
|
|
1996
|
+
columns={eventColumns}
|
|
1997
|
+
getRowId={getItemId}
|
|
1998
|
+
isLoading={isLoading}
|
|
1999
|
+
data-testid='incident-events-table'
|
|
2000
|
+
/>
|
|
2001
|
+
</TabsContent>
|
|
2002
|
+
|
|
2003
|
+
<TabsContent value='comments'>
|
|
2004
|
+
<VStack gap={24} className='max-w-[720px]' data-testid='incident-comments'>
|
|
2005
|
+
{comments.map(comment => (
|
|
2006
|
+
<VStack key={comment.id} gap={8}>
|
|
2007
|
+
<HStack justify='between'>
|
|
2008
|
+
<Avatar size='md'>
|
|
2009
|
+
<AvatarFallback name={comment.author} />
|
|
2010
|
+
<AvatarContent>
|
|
2011
|
+
<AvatarName>{comment.author}</AvatarName>
|
|
2012
|
+
<AvatarDescription>{comment.role}</AvatarDescription>
|
|
2013
|
+
</AvatarContent>
|
|
2014
|
+
</Avatar>
|
|
2015
|
+
<FormatDateTime value={comment.at} format='datetime' layout='inline' />
|
|
2016
|
+
</HStack>
|
|
2017
|
+
<Text size='sm'>{comment.body}</Text>
|
|
2018
|
+
</VStack>
|
|
2019
|
+
))}
|
|
2020
|
+
<VStack gap={12}>
|
|
2021
|
+
<Field>
|
|
2022
|
+
<FieldLabel>Add a comment</FieldLabel>
|
|
2023
|
+
<Textarea
|
|
2024
|
+
value={draft}
|
|
2025
|
+
onChange={handleDraftChange}
|
|
2026
|
+
minRows={3}
|
|
2027
|
+
placeholder='Share findings or next steps with the team'
|
|
2028
|
+
data-testid='incident-comment-input'
|
|
2029
|
+
/>
|
|
2030
|
+
</Field>
|
|
2031
|
+
<HStack justify='end'>
|
|
2032
|
+
<Button size='medium' disabled={!draft.trim()} onClick={handleAddComment}>
|
|
2033
|
+
<MessageSquare />
|
|
2034
|
+
Comment
|
|
2035
|
+
</Button>
|
|
2036
|
+
</HStack>
|
|
2037
|
+
</VStack>
|
|
2038
|
+
</VStack>
|
|
2039
|
+
</TabsContent>
|
|
2040
|
+
</PageContent>
|
|
2041
|
+
</Tabs>
|
|
2042
|
+
|
|
2043
|
+
<Dialog
|
|
2044
|
+
width={400}
|
|
2045
|
+
open={dialogOpen}
|
|
2046
|
+
onOpenChange={handleDialogOpenChange}
|
|
2047
|
+
data-testid='false-positive-dialog'
|
|
2048
|
+
>
|
|
2049
|
+
<DialogContent>
|
|
2050
|
+
<DialogHeader>
|
|
2051
|
+
<DialogTitle>Mark as false positive?</DialogTitle>
|
|
2052
|
+
<DialogDescription>
|
|
2053
|
+
This closes {INCIDENT.id} and adds a rule exception for {INCIDENT.method}{' '}
|
|
2054
|
+
{INCIDENT.path}, so matching requests stop raising incidents. You can reopen it later.
|
|
2055
|
+
</DialogDescription>
|
|
2056
|
+
</DialogHeader>
|
|
2057
|
+
<DialogFooter>
|
|
2058
|
+
<DialogClose asChild>
|
|
2059
|
+
<Button variant='ghost' color='neutral'>
|
|
2060
|
+
Cancel
|
|
2061
|
+
</Button>
|
|
2062
|
+
</DialogClose>
|
|
2063
|
+
<Button
|
|
2064
|
+
loading={pending}
|
|
2065
|
+
onClick={handleConfirmFalsePositive}
|
|
2066
|
+
data-testid='false-positive-confirm'
|
|
2067
|
+
>
|
|
2068
|
+
Mark as false positive
|
|
2069
|
+
</Button>
|
|
2070
|
+
</DialogFooter>
|
|
2071
|
+
</DialogContent>
|
|
2072
|
+
</Dialog>
|
|
2073
|
+
</Page>
|
|
2074
|
+
);
|
|
2075
|
+
};
|
|
2076
|
+
```
|
|
2077
|
+
|
|
2078
|
+
## Related
|
|
2079
|
+
|
|
2080
|
+
- [Complex drawer](../patterns/complex-drawer.md): the same incident in a side panel when the list must stay visible.
|
|
2081
|
+
- [Resource list page](../patterns/resource-list-page.md)
|
|
2082
|
+
- [Entity table](../patterns/entity-table.md)
|
|
2083
|
+
- [Confirmation dialogs](../patterns/confirmation-dialogs.md)
|
|
2084
|
+
- [Feedback toasts](../patterns/feedback-toasts.md)
|
|
2085
|
+
- [Application layout](../patterns/app-layout.md): the shell and breadcrumbs around this page.
|