@wallarm-org/gen-ui 0.0.0-stage → 1.0.0
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 +153 -2
- package/dist/a2ui/A2uiSurfaces.d.ts +16 -0
- package/dist/a2ui/A2uiSurfaces.js +61 -0
- package/dist/a2ui/catalog.d.ts +16 -0
- package/dist/a2ui/catalog.js +66 -0
- package/dist/a2ui/check.d.ts +4 -0
- package/dist/a2ui/check.js +34 -0
- package/dist/a2ui/express.d.ts +38 -0
- package/dist/a2ui/express.js +64 -0
- package/dist/a2ui/index.d.ts +8 -0
- package/dist/a2ui/index.js +4 -0
- package/dist/a2ui/prompt.d.ts +16 -0
- package/dist/a2ui/prompt.js +17 -0
- package/dist/a2ui/toA2uiSchema.d.ts +19 -0
- package/dist/a2ui/toA2uiSchema.js +61 -0
- package/dist/components/Alert.d.ts +11 -0
- package/dist/components/Alert.js +43 -0
- package/dist/components/AreaChart.d.ts +36 -0
- package/dist/components/AreaChart.js +90 -0
- package/dist/components/Badge.d.ts +11 -0
- package/dist/components/Badge.js +30 -0
- package/dist/components/BarList.d.ts +26 -0
- package/dist/components/BarList.js +66 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.js +40 -0
- package/dist/components/Card.d.ts +2 -0
- package/dist/components/Card.js +17 -0
- package/dist/components/ColumnChart.d.ts +32 -0
- package/dist/components/ColumnChart.js +114 -0
- package/dist/components/Grid.d.ts +29 -0
- package/dist/components/Grid.js +72 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.js +29 -0
- package/dist/components/HorizontalBarStack.d.ts +39 -0
- package/dist/components/HorizontalBarStack.js +67 -0
- package/dist/components/LineChart.d.ts +36 -0
- package/dist/components/LineChart.js +101 -0
- package/dist/components/Metric.d.ts +35 -0
- package/dist/components/Metric.js +85 -0
- package/dist/components/PieChart.d.ts +25 -0
- package/dist/components/PieChart.js +83 -0
- package/dist/components/Section.d.ts +5 -0
- package/dist/components/Section.js +39 -0
- package/dist/components/Stack.d.ts +18 -0
- package/dist/components/Stack.js +41 -0
- package/dist/components/Table.d.ts +30 -0
- package/dist/components/Table.js +128 -0
- package/dist/components/Text.d.ts +9 -0
- package/dist/components/Text.js +27 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.js +55 -0
- package/dist/core/check.d.ts +35 -0
- package/dist/core/check.js +63 -0
- package/dist/core/define.d.ts +64 -0
- package/dist/core/define.js +7 -0
- package/dist/core/format.d.ts +24 -0
- package/dist/core/format.js +74 -0
- package/dist/core/guards.d.ts +2 -0
- package/dist/core/guards.js +2 -0
- package/dist/fixtures/apiInventory.d.ts +36 -0
- package/dist/fixtures/apiInventory.js +287 -0
- package/dist/fixtures/attackSummary.d.ts +13 -0
- package/dist/fixtures/attackSummary.js +329 -0
- package/dist/fixtures/dashboard.d.ts +119 -0
- package/dist/fixtures/dashboard.js +428 -0
- package/dist/fixtures/incident.d.ts +44 -0
- package/dist/fixtures/incident.js +331 -0
- package/dist/fixtures/index.d.ts +13 -0
- package/dist/fixtures/index.js +9 -0
- package/dist/fixtures/liveMonitor.d.ts +9 -0
- package/dist/fixtures/liveMonitor.js +180 -0
- package/dist/fixtures/openui.d.ts +16 -0
- package/dist/fixtures/openui.js +74 -0
- package/dist/fixtures/scenarios.d.ts +13 -0
- package/dist/fixtures/scenarios.js +39 -0
- package/dist/fixtures/stream.d.ts +79 -0
- package/dist/fixtures/stream.js +147 -0
- package/dist/fixtures/weeklyReport.d.ts +46 -0
- package/dist/fixtures/weeklyReport.js +266 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/json-render/JsonRenderSurface.d.ts +13 -0
- package/dist/json-render/JsonRenderSurface.js +63 -0
- package/dist/json-render/catalog.d.ts +64 -0
- package/dist/json-render/catalog.js +50 -0
- package/dist/json-render/check.d.ts +4 -0
- package/dist/json-render/check.js +13 -0
- package/dist/json-render/index.d.ts +6 -0
- package/dist/json-render/index.js +4 -0
- package/dist/json-render/spec.d.ts +23 -0
- package/dist/json-render/spec.js +77 -0
- package/dist/openui/OpenUiSurface.d.ts +24 -0
- package/dist/openui/OpenUiSurface.js +30 -0
- package/dist/openui/catalog.d.ts +23 -0
- package/dist/openui/catalog.js +65 -0
- package/dist/openui/check.d.ts +4 -0
- package/dist/openui/check.js +68 -0
- package/dist/openui/index.d.ts +5 -0
- package/dist/openui/index.js +3 -0
- package/dist/playground/GenUiChatDemo.d.ts +11 -0
- package/dist/playground/GenUiChatDemo.js +148 -0
- package/dist/playground/GenUiPlayground.d.ts +15 -0
- package/dist/playground/GenUiPlayground.js +413 -0
- package/dist/playground/index.d.ts +3 -0
- package/dist/playground/index.js +2 -0
- package/dist/playground/useEmulatedAgent.d.ts +37 -0
- package/dist/playground/useEmulatedAgent.js +221 -0
- package/dist/render/ChartSkeleton.d.ts +6 -0
- package/dist/render/ChartSkeleton.js +26 -0
- package/dist/render/GuardedView.d.ts +18 -0
- package/dist/render/GuardedView.js +24 -0
- package/dist/render/Placeholder.d.ts +16 -0
- package/dist/render/Placeholder.js +15 -0
- package/dist/render/SurfaceBoundary.d.ts +15 -0
- package/dist/render/SurfaceBoundary.js +15 -0
- package/dist/render/warn.d.ts +1 -0
- package/dist/render/warn.js +2 -0
- package/package.json +94 -4
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { bind, node } from "./stream.js";
|
|
2
|
+
const DAYS = Array.from({
|
|
3
|
+
length: 7
|
|
4
|
+
}, (_, i)=>new Date(Date.UTC(2026, 10, 6 + i)).toISOString());
|
|
5
|
+
const API_INVENTORY_DATA = {
|
|
6
|
+
kpi: {
|
|
7
|
+
endpoints: 1842,
|
|
8
|
+
sensitive: 327,
|
|
9
|
+
unauthenticated: 46,
|
|
10
|
+
newThisWeek: 58
|
|
11
|
+
},
|
|
12
|
+
dataTypes: [
|
|
13
|
+
{
|
|
14
|
+
label: 'PII',
|
|
15
|
+
value: 168,
|
|
16
|
+
color: 'purple'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Credentials',
|
|
20
|
+
value: 74,
|
|
21
|
+
color: 'red'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Payment cards',
|
|
25
|
+
value: 52,
|
|
26
|
+
color: 'amber'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Health records',
|
|
30
|
+
value: 33,
|
|
31
|
+
color: 'blue'
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
newEndpoints: DAYS.map((x, i)=>{
|
|
35
|
+
const sensitive = 1 + 3 * i % 4;
|
|
36
|
+
return {
|
|
37
|
+
x,
|
|
38
|
+
sensitive,
|
|
39
|
+
other: 4 + 5 * i % 6
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
endpoints: [
|
|
43
|
+
{
|
|
44
|
+
id: 'ep-1',
|
|
45
|
+
method: 'GET',
|
|
46
|
+
path: '/api/v1/users/{id}/profile',
|
|
47
|
+
status: 200,
|
|
48
|
+
dataType: 'PII',
|
|
49
|
+
hits: 184220,
|
|
50
|
+
last: '2026-11-12T21:47:00Z'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'ep-2',
|
|
54
|
+
method: 'POST',
|
|
55
|
+
path: '/api/v1/payments/charge',
|
|
56
|
+
status: 201,
|
|
57
|
+
dataType: 'Payment cards',
|
|
58
|
+
hits: 92415,
|
|
59
|
+
last: '2026-11-12T21:52:00Z'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'ep-3',
|
|
63
|
+
method: 'POST',
|
|
64
|
+
path: '/internal/auth/token',
|
|
65
|
+
status: 200,
|
|
66
|
+
dataType: 'Credentials',
|
|
67
|
+
hits: 61038,
|
|
68
|
+
last: '2026-11-12T20:15:00Z'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'ep-4',
|
|
72
|
+
method: 'GET',
|
|
73
|
+
path: '/api/v2/patients/{id}/records',
|
|
74
|
+
status: 200,
|
|
75
|
+
dataType: 'Health records',
|
|
76
|
+
hits: 8771,
|
|
77
|
+
last: '2026-11-12T18:03:00Z'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'ep-5',
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
path: '/api/v1/accounts/{id}/email',
|
|
83
|
+
status: 204,
|
|
84
|
+
dataType: 'PII',
|
|
85
|
+
hits: 3402,
|
|
86
|
+
last: '2026-11-11T09:30:00Z'
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
};
|
|
90
|
+
const API_INVENTORY_ACTIONS = [
|
|
91
|
+
{
|
|
92
|
+
name: 'open_api_inventory',
|
|
93
|
+
description: 'Open the API Inventory page with the given filter.'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'export_endpoints',
|
|
97
|
+
description: 'Download the listed endpoints as a CSV file.'
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
const LAYOUT = [
|
|
101
|
+
[
|
|
102
|
+
node('root', 'Section', {
|
|
103
|
+
title: 'Sensitive data exposure',
|
|
104
|
+
subtitle: 'API Discovery · last 7 days'
|
|
105
|
+
}, [
|
|
106
|
+
'kpis',
|
|
107
|
+
'charts',
|
|
108
|
+
'endpoints',
|
|
109
|
+
'actions'
|
|
110
|
+
]),
|
|
111
|
+
node('kpis', 'Grid', {
|
|
112
|
+
columns: '4'
|
|
113
|
+
}, [
|
|
114
|
+
'm_endpoints',
|
|
115
|
+
'm_sensitive',
|
|
116
|
+
'm_unauth',
|
|
117
|
+
'm_new'
|
|
118
|
+
]),
|
|
119
|
+
node('charts', 'Grid', {
|
|
120
|
+
columns: '2'
|
|
121
|
+
}, [
|
|
122
|
+
'data_types',
|
|
123
|
+
'new_endpoints'
|
|
124
|
+
])
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
node('m_endpoints', 'Metric', {
|
|
128
|
+
title: 'Endpoints',
|
|
129
|
+
value: bind('/kpi/endpoints'),
|
|
130
|
+
caption: 'Discovered across all hosts'
|
|
131
|
+
}),
|
|
132
|
+
node('m_sensitive', 'Metric', {
|
|
133
|
+
title: 'With sensitive data',
|
|
134
|
+
value: bind('/kpi/sensitive'),
|
|
135
|
+
caption: 'Return or accept PII, credentials, cards'
|
|
136
|
+
}),
|
|
137
|
+
node('m_unauth', 'Metric', {
|
|
138
|
+
title: 'Unauthenticated',
|
|
139
|
+
value: bind('/kpi/unauthenticated'),
|
|
140
|
+
caption: 'Sensitive and reachable without auth'
|
|
141
|
+
}),
|
|
142
|
+
node('m_new', 'Metric', {
|
|
143
|
+
title: 'New this week',
|
|
144
|
+
value: bind('/kpi/newThisWeek'),
|
|
145
|
+
caption: 'First seen in the last 7 days'
|
|
146
|
+
})
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
node('data_types', 'PieChart', {
|
|
150
|
+
title: 'Sensitive data types',
|
|
151
|
+
items: bind('/dataTypes'),
|
|
152
|
+
centerLabel: 'endpoints'
|
|
153
|
+
}),
|
|
154
|
+
node('new_endpoints', 'ColumnChart', {
|
|
155
|
+
title: 'New endpoints per day',
|
|
156
|
+
series: [
|
|
157
|
+
{
|
|
158
|
+
key: 'sensitive',
|
|
159
|
+
label: 'With sensitive data',
|
|
160
|
+
color: 'red'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: 'other',
|
|
164
|
+
label: 'Other',
|
|
165
|
+
color: 'slate'
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
points: bind('/newEndpoints'),
|
|
169
|
+
xFormat: 'date'
|
|
170
|
+
})
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
node('endpoints', 'Table', {
|
|
174
|
+
title: 'Most used endpoints with sensitive data',
|
|
175
|
+
rowKey: 'id',
|
|
176
|
+
columns: [
|
|
177
|
+
{
|
|
178
|
+
key: 'method',
|
|
179
|
+
header: 'Method',
|
|
180
|
+
type: 'method'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: 'path',
|
|
184
|
+
header: 'Path',
|
|
185
|
+
type: 'code'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
key: 'status',
|
|
189
|
+
header: 'Status',
|
|
190
|
+
type: 'status'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: 'dataType',
|
|
194
|
+
header: 'Data type',
|
|
195
|
+
type: 'badge'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
key: 'hits',
|
|
199
|
+
header: 'Hits',
|
|
200
|
+
type: 'number'
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
key: 'last',
|
|
204
|
+
header: 'Last seen',
|
|
205
|
+
type: 'datetime',
|
|
206
|
+
format: 'datetime'
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
rows: bind('/endpoints')
|
|
210
|
+
})
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
node('actions', 'Stack', {
|
|
214
|
+
direction: 'row',
|
|
215
|
+
gap: '8'
|
|
216
|
+
}, [
|
|
217
|
+
'open',
|
|
218
|
+
'export'
|
|
219
|
+
]),
|
|
220
|
+
{
|
|
221
|
+
...node('open', 'Button', {
|
|
222
|
+
label: 'Open in API Inventory',
|
|
223
|
+
variant: 'primary'
|
|
224
|
+
}),
|
|
225
|
+
press: {
|
|
226
|
+
action: 'open_api_inventory',
|
|
227
|
+
params: {
|
|
228
|
+
filter: 'sensitive_data:any'
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
...node('export', 'Button', {
|
|
234
|
+
label: 'Export CSV',
|
|
235
|
+
variant: 'outline'
|
|
236
|
+
}),
|
|
237
|
+
press: {
|
|
238
|
+
action: 'export_endpoints',
|
|
239
|
+
params: {
|
|
240
|
+
filter: 'sensitive_data:any'
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
];
|
|
246
|
+
const API_INVENTORY_SCENARIO = {
|
|
247
|
+
id: 'api-inventory',
|
|
248
|
+
prompt: 'Which API endpoints expose sensitive data?',
|
|
249
|
+
summary: 'Endpoint KPIs, sensitive data types, new endpoints per day, a table of exposed endpoints',
|
|
250
|
+
surfaceId: 'api_inventory',
|
|
251
|
+
actions: API_INVENTORY_ACTIONS,
|
|
252
|
+
layout: LAYOUT,
|
|
253
|
+
data: [
|
|
254
|
+
{
|
|
255
|
+
after: 1,
|
|
256
|
+
values: [
|
|
257
|
+
{
|
|
258
|
+
path: '/kpi',
|
|
259
|
+
value: API_INVENTORY_DATA.kpi
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
after: 2,
|
|
265
|
+
values: [
|
|
266
|
+
{
|
|
267
|
+
path: '/dataTypes',
|
|
268
|
+
value: API_INVENTORY_DATA.dataTypes
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
path: '/newEndpoints',
|
|
272
|
+
value: API_INVENTORY_DATA.newEndpoints
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
after: 3,
|
|
278
|
+
values: [
|
|
279
|
+
{
|
|
280
|
+
path: '/endpoints',
|
|
281
|
+
value: API_INVENTORY_DATA.endpoints
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
};
|
|
287
|
+
export { API_INVENTORY_ACTIONS, API_INVENTORY_DATA, API_INVENTORY_SCENARIO };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One answer, "attacks in the last 24 hours", as an agent would stream it in each format.
|
|
3
|
+
* Both describe the same tree and the same data model, so a renderer swap is the only difference.
|
|
4
|
+
* Every array is in arrival order: feed it item by item to emulate streaming.
|
|
5
|
+
*/
|
|
6
|
+
import type { SpecStreamLine } from '@json-render/core';
|
|
7
|
+
import type { A2uiMessage } from '../a2ui/index.js';
|
|
8
|
+
import type { GenUiAction } from '../core/define.js';
|
|
9
|
+
export declare const ATTACK_SUMMARY_ACTIONS: readonly GenUiAction[];
|
|
10
|
+
export declare const ATTACK_SUMMARY_SURFACE = "attack_summary";
|
|
11
|
+
export declare const ATTACK_SUMMARY_A2UI: readonly A2uiMessage[];
|
|
12
|
+
/** `state` goes first: the provider reads it when the part mounts. */
|
|
13
|
+
export declare const ATTACK_SUMMARY_JSON_RENDER: readonly SpecStreamLine[];
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { WALLARM_A2UI_CATALOG_ID } from "../a2ui/index.js";
|
|
2
|
+
const ATTACK_SUMMARY_ACTIONS = [
|
|
3
|
+
{
|
|
4
|
+
name: 'block_ips',
|
|
5
|
+
description: 'Block the given source IPs (asks the user to approve first).'
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: 'open_attacks',
|
|
9
|
+
description: 'Open the Attacks page with the given filter.'
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
const STATS = {
|
|
13
|
+
attacks: 1240,
|
|
14
|
+
blocked: 1187,
|
|
15
|
+
sourceIps: [
|
|
16
|
+
'203.0.113.7',
|
|
17
|
+
'203.0.113.12',
|
|
18
|
+
'198.51.100.40'
|
|
19
|
+
],
|
|
20
|
+
endpoints: [
|
|
21
|
+
{
|
|
22
|
+
label: '/api/v1/auth/login',
|
|
23
|
+
value: 612,
|
|
24
|
+
color: 'red'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '/api/v1/users',
|
|
28
|
+
value: 318,
|
|
29
|
+
color: 'amber'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: '/api/v1/orders',
|
|
33
|
+
value: 174,
|
|
34
|
+
color: 'blue'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: '/api/v1/search',
|
|
38
|
+
value: 136,
|
|
39
|
+
color: 'slate'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
const ALERT = {
|
|
44
|
+
title: 'SQLi spike on /api/v1/auth/login',
|
|
45
|
+
description: '412 of the 612 hits came from 3 IPs in one hosting network over the last 2 hours.'
|
|
46
|
+
};
|
|
47
|
+
const ATTACK_SUMMARY_SURFACE = 'attack_summary';
|
|
48
|
+
const SURFACE = ATTACK_SUMMARY_SURFACE;
|
|
49
|
+
const ATTACK_SUMMARY_A2UI = [
|
|
50
|
+
{
|
|
51
|
+
version: '1.0',
|
|
52
|
+
createSurface: {
|
|
53
|
+
surfaceId: SURFACE,
|
|
54
|
+
catalogId: WALLARM_A2UI_CATALOG_ID
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
version: '1.0',
|
|
59
|
+
updateDataModel: {
|
|
60
|
+
surfaceId: SURFACE,
|
|
61
|
+
path: '/stats',
|
|
62
|
+
value: STATS
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
version: '1.0',
|
|
67
|
+
updateComponents: {
|
|
68
|
+
surfaceId: SURFACE,
|
|
69
|
+
components: [
|
|
70
|
+
{
|
|
71
|
+
id: 'root',
|
|
72
|
+
component: 'Stack',
|
|
73
|
+
children: [
|
|
74
|
+
'title',
|
|
75
|
+
'metrics',
|
|
76
|
+
'endpoints',
|
|
77
|
+
'alert',
|
|
78
|
+
'actions'
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'title',
|
|
83
|
+
component: 'Heading',
|
|
84
|
+
text: 'Attacks in the last 24 hours'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'metrics',
|
|
88
|
+
component: 'Stack',
|
|
89
|
+
direction: 'row',
|
|
90
|
+
children: [
|
|
91
|
+
'm_attacks',
|
|
92
|
+
'm_blocked'
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'm_attacks',
|
|
97
|
+
component: 'Metric',
|
|
98
|
+
title: 'Attacks',
|
|
99
|
+
value: {
|
|
100
|
+
'@path': '/stats/attacks'
|
|
101
|
+
},
|
|
102
|
+
delta: {
|
|
103
|
+
value: 12,
|
|
104
|
+
trend: 'up',
|
|
105
|
+
sentiment: 'negative'
|
|
106
|
+
},
|
|
107
|
+
caption: 'vs the previous 24 hours'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'm_blocked',
|
|
111
|
+
component: 'Metric',
|
|
112
|
+
title: 'Blocked',
|
|
113
|
+
value: {
|
|
114
|
+
'@path': '/stats/blocked'
|
|
115
|
+
},
|
|
116
|
+
caption: '95.7% of attacks'
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
version: '1.0',
|
|
123
|
+
updateComponents: {
|
|
124
|
+
surfaceId: SURFACE,
|
|
125
|
+
components: [
|
|
126
|
+
{
|
|
127
|
+
id: 'endpoints',
|
|
128
|
+
component: 'BarList',
|
|
129
|
+
title: 'Top attacked endpoints',
|
|
130
|
+
items: {
|
|
131
|
+
'@path': '/stats/endpoints'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
version: '1.0',
|
|
139
|
+
updateComponents: {
|
|
140
|
+
surfaceId: SURFACE,
|
|
141
|
+
components: [
|
|
142
|
+
{
|
|
143
|
+
id: 'alert',
|
|
144
|
+
component: 'Alert',
|
|
145
|
+
tone: 'warning',
|
|
146
|
+
...ALERT
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 'actions',
|
|
150
|
+
component: 'Stack',
|
|
151
|
+
direction: 'row',
|
|
152
|
+
gap: '8',
|
|
153
|
+
children: [
|
|
154
|
+
'block',
|
|
155
|
+
'open'
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'block',
|
|
160
|
+
component: 'Button',
|
|
161
|
+
label: 'Block 3 source IPs',
|
|
162
|
+
variant: 'primary',
|
|
163
|
+
destructive: true,
|
|
164
|
+
press: {
|
|
165
|
+
event: {
|
|
166
|
+
name: 'block_ips',
|
|
167
|
+
context: {
|
|
168
|
+
ips: {
|
|
169
|
+
'@path': '/stats/sourceIps'
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 'open',
|
|
177
|
+
component: 'Button',
|
|
178
|
+
label: 'Open in Attacks',
|
|
179
|
+
press: {
|
|
180
|
+
event: {
|
|
181
|
+
name: 'open_attacks',
|
|
182
|
+
context: {
|
|
183
|
+
filter: 'type:sqli'
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
const el = (path, value)=>({
|
|
193
|
+
op: 'add',
|
|
194
|
+
path: `/elements/${path}`,
|
|
195
|
+
value
|
|
196
|
+
});
|
|
197
|
+
const ATTACK_SUMMARY_JSON_RENDER = [
|
|
198
|
+
{
|
|
199
|
+
op: 'add',
|
|
200
|
+
path: '/state',
|
|
201
|
+
value: {
|
|
202
|
+
stats: STATS
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
op: 'add',
|
|
207
|
+
path: '/root',
|
|
208
|
+
value: 'root'
|
|
209
|
+
},
|
|
210
|
+
el('root', {
|
|
211
|
+
type: 'Stack',
|
|
212
|
+
props: {},
|
|
213
|
+
children: [
|
|
214
|
+
'title',
|
|
215
|
+
'metrics',
|
|
216
|
+
'endpoints',
|
|
217
|
+
'alert',
|
|
218
|
+
'actions'
|
|
219
|
+
]
|
|
220
|
+
}),
|
|
221
|
+
el('title', {
|
|
222
|
+
type: 'Heading',
|
|
223
|
+
props: {
|
|
224
|
+
text: 'Attacks in the last 24 hours'
|
|
225
|
+
},
|
|
226
|
+
children: []
|
|
227
|
+
}),
|
|
228
|
+
el('metrics', {
|
|
229
|
+
type: 'Stack',
|
|
230
|
+
props: {
|
|
231
|
+
direction: 'row'
|
|
232
|
+
},
|
|
233
|
+
children: [
|
|
234
|
+
'm_attacks',
|
|
235
|
+
'm_blocked'
|
|
236
|
+
]
|
|
237
|
+
}),
|
|
238
|
+
el('m_attacks', {
|
|
239
|
+
type: 'Metric',
|
|
240
|
+
props: {
|
|
241
|
+
title: 'Attacks',
|
|
242
|
+
value: {
|
|
243
|
+
$state: '/stats/attacks'
|
|
244
|
+
},
|
|
245
|
+
delta: {
|
|
246
|
+
value: 12,
|
|
247
|
+
trend: 'up',
|
|
248
|
+
sentiment: 'negative'
|
|
249
|
+
},
|
|
250
|
+
caption: 'vs the previous 24 hours'
|
|
251
|
+
},
|
|
252
|
+
children: []
|
|
253
|
+
}),
|
|
254
|
+
el('m_blocked', {
|
|
255
|
+
type: 'Metric',
|
|
256
|
+
props: {
|
|
257
|
+
title: 'Blocked',
|
|
258
|
+
value: {
|
|
259
|
+
$state: '/stats/blocked'
|
|
260
|
+
},
|
|
261
|
+
caption: '95.7% of attacks'
|
|
262
|
+
},
|
|
263
|
+
children: []
|
|
264
|
+
}),
|
|
265
|
+
el('endpoints', {
|
|
266
|
+
type: 'BarList',
|
|
267
|
+
props: {
|
|
268
|
+
title: 'Top attacked endpoints',
|
|
269
|
+
items: {
|
|
270
|
+
$state: '/stats/endpoints'
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
children: []
|
|
274
|
+
}),
|
|
275
|
+
el('alert', {
|
|
276
|
+
type: 'Alert',
|
|
277
|
+
props: {
|
|
278
|
+
tone: 'warning',
|
|
279
|
+
...ALERT
|
|
280
|
+
},
|
|
281
|
+
children: []
|
|
282
|
+
}),
|
|
283
|
+
el('actions', {
|
|
284
|
+
type: 'Stack',
|
|
285
|
+
props: {
|
|
286
|
+
direction: 'row',
|
|
287
|
+
gap: '8'
|
|
288
|
+
},
|
|
289
|
+
children: [
|
|
290
|
+
'block',
|
|
291
|
+
'open'
|
|
292
|
+
]
|
|
293
|
+
}),
|
|
294
|
+
el('block', {
|
|
295
|
+
type: 'Button',
|
|
296
|
+
props: {
|
|
297
|
+
label: 'Block 3 source IPs',
|
|
298
|
+
variant: 'primary',
|
|
299
|
+
destructive: true
|
|
300
|
+
},
|
|
301
|
+
on: {
|
|
302
|
+
press: {
|
|
303
|
+
action: 'block_ips',
|
|
304
|
+
params: {
|
|
305
|
+
ips: {
|
|
306
|
+
$state: '/stats/sourceIps'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
children: []
|
|
312
|
+
}),
|
|
313
|
+
el('open', {
|
|
314
|
+
type: 'Button',
|
|
315
|
+
props: {
|
|
316
|
+
label: 'Open in Attacks'
|
|
317
|
+
},
|
|
318
|
+
on: {
|
|
319
|
+
press: {
|
|
320
|
+
action: 'open_attacks',
|
|
321
|
+
params: {
|
|
322
|
+
filter: 'type:sqli'
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
children: []
|
|
327
|
+
})
|
|
328
|
+
];
|
|
329
|
+
export { ATTACK_SUMMARY_A2UI, ATTACK_SUMMARY_ACTIONS, ATTACK_SUMMARY_JSON_RENDER, ATTACK_SUMMARY_SURFACE };
|