@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
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RuleBuilder Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for the Rule Builder component system.
|
|
5
|
-
* Compatible with PointSelector and @wallarm-org/rules-lib.
|
|
6
|
-
*
|
|
7
|
-
* @example Basic usage
|
|
8
|
-
* ```tsx
|
|
9
|
-
* import { RuleBuilder, newGroup, newAction } from '@wallarm-org/design-system';
|
|
10
|
-
*
|
|
11
|
-
* const [condition, setCondition] = useState(newGroup('and'));
|
|
12
|
-
* const [action, setAction] = useState(newAction('add_attack'));
|
|
13
|
-
*
|
|
14
|
-
* <RuleBuilder
|
|
15
|
-
* ruleId='sql-injection-rule'
|
|
16
|
-
* ruleDescription='Detect SQL injection attempts'
|
|
17
|
-
* condition={condition}
|
|
18
|
-
* action={action}
|
|
19
|
-
* onConditionChange={setCondition}
|
|
20
|
-
* onActionChange={setAction}
|
|
21
|
-
* attackTypes={[
|
|
22
|
-
* { value: 'sqli', label: 'SQL Injection' },
|
|
23
|
-
* { value: 'xss', label: 'Cross-Site Scripting' },
|
|
24
|
-
* ]}
|
|
25
|
-
* />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
import type { PointSelectorValue, RuleContext, Segment } from '../PointSelector/types.js';
|
|
29
|
-
/**
|
|
30
|
-
* How a group of conditions combines.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* // AND: all conditions must match
|
|
35
|
-
* const andGroup: GroupCondition = {
|
|
36
|
-
* kind: 'group',
|
|
37
|
-
* id: '1',
|
|
38
|
-
* operator: 'and',
|
|
39
|
-
* children: [condition1, condition2]
|
|
40
|
-
* };
|
|
41
|
-
*
|
|
42
|
-
* // OR: at least one condition must match
|
|
43
|
-
* const orGroup: GroupCondition = {
|
|
44
|
-
* kind: 'group',
|
|
45
|
-
* id: '2',
|
|
46
|
-
* operator: 'or',
|
|
47
|
-
* children: [condition1, condition2]
|
|
48
|
-
* };
|
|
49
|
-
*
|
|
50
|
-
* // NOT: no conditions should match (inverted)
|
|
51
|
-
* const notGroup: GroupCondition = {
|
|
52
|
-
* kind: 'group',
|
|
53
|
-
* id: '3',
|
|
54
|
-
* operator: 'not',
|
|
55
|
-
* children: [condition1]
|
|
56
|
-
* };
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export type GroupOperator = 'and' | 'or' | 'not';
|
|
60
|
-
/**
|
|
61
|
-
* A condition on a value in the request or response.
|
|
62
|
-
* Uses PointSelector for value selection and condition definition.
|
|
63
|
-
*
|
|
64
|
-
* @example Check if header equals specific value
|
|
65
|
-
* ```tsx
|
|
66
|
-
* const condition: FieldCondition = {
|
|
67
|
-
* kind: 'field',
|
|
68
|
-
* id: 'cond-1',
|
|
69
|
-
* context: 'http_request',
|
|
70
|
-
* value: {
|
|
71
|
-
* segments: [
|
|
72
|
-
* { kind: 'native', value: 'header' },
|
|
73
|
-
* { kind: 'key', value: 'authorization' }
|
|
74
|
-
* ],
|
|
75
|
-
* canonical: '[http:header][\'authorization\']',
|
|
76
|
-
* condition: 'equal',
|
|
77
|
-
* value: 'Bearer admin-token',
|
|
78
|
-
* ignoreCase: false,
|
|
79
|
-
* },
|
|
80
|
-
* };
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @example With binding (for bind_point)
|
|
84
|
-
* ```tsx
|
|
85
|
-
* const condition: FieldCondition = {
|
|
86
|
-
* kind: 'field',
|
|
87
|
-
* id: 'cond-2',
|
|
88
|
-
* context: 'http_request',
|
|
89
|
-
* value: { ...pointValue },
|
|
90
|
-
* bindPoint: 'user_id', // Action can reference this as target_ref: 'user_id'
|
|
91
|
-
* };
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export interface FieldCondition {
|
|
95
|
-
kind: 'field';
|
|
96
|
-
id: string;
|
|
97
|
-
context: RuleContext;
|
|
98
|
-
value: PointSelectorValue;
|
|
99
|
-
/** Bind name for bind_point (format 0.10.1+). Allows actions to reference matched nodes. */
|
|
100
|
-
bindPoint?: string;
|
|
101
|
-
/** Point reference name for point_ref (format 0.10.1+). */
|
|
102
|
-
pointRef?: string;
|
|
103
|
-
/** Point role for point_role (format 0.10.1+). */
|
|
104
|
-
pointRole?: string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* A condition the wizard cannot open (a point it cannot build).
|
|
108
|
-
* Kept as is, shown as code, never silently rewritten.
|
|
109
|
-
*/
|
|
110
|
-
export interface RawCondition {
|
|
111
|
-
kind: 'raw';
|
|
112
|
-
id: string;
|
|
113
|
-
check: Record<string, unknown>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* "An attack was detected" — proton's `attack_present`.
|
|
117
|
-
* When `absent: true`, becomes `attack_absent` (attack is NOT present).
|
|
118
|
-
*/
|
|
119
|
-
export interface AttackCondition {
|
|
120
|
-
kind: 'attack';
|
|
121
|
-
id: string;
|
|
122
|
-
/** Empty string: any attack. */
|
|
123
|
-
attackType: string;
|
|
124
|
-
/** `flow` (anywhere in the request) or a specific point. */
|
|
125
|
-
point: string;
|
|
126
|
-
/** SDK canonical version when point was canonicalized */
|
|
127
|
-
canonicalVersion?: number;
|
|
128
|
-
/** When true, checks that attack is NOT present (attack_absent). */
|
|
129
|
-
absent?: boolean;
|
|
130
|
-
/** Attack source filter: 'rule', 'stamp', 'xml', 'gzip', 'deflate', 'brotli', 'zip', 'json'. */
|
|
131
|
-
source?: string;
|
|
132
|
-
/** Stamp IDs filter (requires source: 'stamp'). */
|
|
133
|
-
stampIds?: string[];
|
|
134
|
-
/** Rule IDs filter (requires source: 'rule'). */
|
|
135
|
-
ruleIds?: string | string[];
|
|
136
|
-
/** XML property filter: 'dtd', 'xinclude', 'stylesheet', 'xslt', 'schema', 'xml_base' (requires source: 'xml'). */
|
|
137
|
-
property?: string | string[];
|
|
138
|
-
/** XML reference filter (requires source: 'xml'). Format 0.10.3+. */
|
|
139
|
-
reference?: {
|
|
140
|
-
operator: 'equal' | 'startswith' | 'regex';
|
|
141
|
-
value: string | string[];
|
|
142
|
-
};
|
|
143
|
-
/** Known attack labels (CVE, vuln, technique, payload, tool). Format 0.10.4+ adds tool. */
|
|
144
|
-
known?: {
|
|
145
|
-
cve?: string[];
|
|
146
|
-
vuln?: string[];
|
|
147
|
-
technique?: string[];
|
|
148
|
-
payload?: string[];
|
|
149
|
-
tool?: string[];
|
|
150
|
-
};
|
|
151
|
-
/** Known false positive reasons. */
|
|
152
|
-
knownFalse?: string | string[];
|
|
153
|
-
/** Bind name for bind_attack (format 0.10.1+). Allows actions to reference matched attacks. */
|
|
154
|
-
bindAttack?: string;
|
|
155
|
-
}
|
|
156
|
-
/** The engine's own findings a rule can react to. */
|
|
157
|
-
export type SignalType = 'key_duplicate' | 'resource_overlimit';
|
|
158
|
-
/**
|
|
159
|
-
* "A request anomaly was detected" — proton's `signal_present`.
|
|
160
|
-
* When `absent: true`, becomes `signal_absent` (signal is NOT present).
|
|
161
|
-
*/
|
|
162
|
-
export interface SignalCondition {
|
|
163
|
-
kind: 'signal';
|
|
164
|
-
id: string;
|
|
165
|
-
signalType: SignalType | '';
|
|
166
|
-
/** `key_duplicate`: the container whose keys repeat (`[http:header]`, etc). */
|
|
167
|
-
point: string;
|
|
168
|
-
/** SDK canonical version when point was canonicalized */
|
|
169
|
-
canonicalVersion?: number;
|
|
170
|
-
/** `resource_overlimit`: which limit was exceeded. */
|
|
171
|
-
limit: string;
|
|
172
|
-
/** When true, checks that signal is NOT present (signal_absent). */
|
|
173
|
-
absent?: boolean;
|
|
174
|
-
/** `key_duplicate`: the duplicated key as a star key segment (e.g., "['q']"). */
|
|
175
|
-
key?: string;
|
|
176
|
-
/** Bind name for bind_point (format 0.10.1+). Allows actions to reference matched nodes. */
|
|
177
|
-
bindPoint?: string;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* "A tag is present" — proton's `tag_present`.
|
|
181
|
-
* When `absent: true`, becomes `tag_absent` (tag is NOT present).
|
|
182
|
-
*/
|
|
183
|
-
export interface TagCondition {
|
|
184
|
-
kind: 'tag';
|
|
185
|
-
id: string;
|
|
186
|
-
/** Tag key to check for. */
|
|
187
|
-
tagKey: string;
|
|
188
|
-
/** Optional tag value to check. Empty string means any value. */
|
|
189
|
-
tagValue: string;
|
|
190
|
-
/** `flow` (anywhere in the request) or a specific point. */
|
|
191
|
-
point: string;
|
|
192
|
-
/** SDK canonical version when point was canonicalized */
|
|
193
|
-
canonicalVersion?: number;
|
|
194
|
-
/** When true, checks that tag is NOT present (tag_absent). */
|
|
195
|
-
absent?: boolean;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* "Sample a percentage of flows" — proton's `sample`.
|
|
199
|
-
* No context, no point, just a percent value (0-100).
|
|
200
|
-
*/
|
|
201
|
-
export interface SampleCondition {
|
|
202
|
-
kind: 'sample';
|
|
203
|
-
id: string;
|
|
204
|
-
/** Percent of flows to sample (0-100). */
|
|
205
|
-
percent: number;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* A group of conditions combined with an operator.
|
|
209
|
-
* Forms the tree structure of conditions.
|
|
210
|
-
*/
|
|
211
|
-
export interface GroupCondition {
|
|
212
|
-
kind: 'group';
|
|
213
|
-
id: string;
|
|
214
|
-
operator: GroupOperator;
|
|
215
|
-
children: ConditionNode[];
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Union of all condition node types.
|
|
219
|
-
* Forms a recursive tree structure via GroupCondition.
|
|
220
|
-
*/
|
|
221
|
-
export type ConditionNode = FieldCondition | RawCondition | AttackCondition | SignalCondition | TagCondition | SampleCondition | GroupCondition;
|
|
222
|
-
/**
|
|
223
|
-
* Proton condition tree: `{ operator, checks: [...] }`, checks can be nested.
|
|
224
|
-
*/
|
|
225
|
-
export interface ProtonCondition {
|
|
226
|
-
operator: GroupOperator;
|
|
227
|
-
checks: (ProtonCondition | Record<string, unknown>)[];
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Proton check object (leaf node in condition tree).
|
|
231
|
-
*/
|
|
232
|
-
export interface ProtonCheck {
|
|
233
|
-
type: string;
|
|
234
|
-
context?: RuleContext;
|
|
235
|
-
point?: string | string[];
|
|
236
|
-
value?: string | string[];
|
|
237
|
-
case_sensitive?: boolean;
|
|
238
|
-
attack?: {
|
|
239
|
-
attack_type?: string | string[];
|
|
240
|
-
};
|
|
241
|
-
signal?: {
|
|
242
|
-
signal_type?: string;
|
|
243
|
-
limit?: string;
|
|
244
|
-
};
|
|
245
|
-
tag?: {
|
|
246
|
-
key?: string;
|
|
247
|
-
value?: string;
|
|
248
|
-
};
|
|
249
|
-
percent?: number;
|
|
250
|
-
[key: string]: unknown;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Action types that a rule can perform.
|
|
254
|
-
*/
|
|
255
|
-
export type ActionKind = 'add_attack' | 'add_tag' | 'suppress_attack' | 'mark_attack' | 'combine' | 'processing_time_limit' | 'processing_space_limit' | 'entry_limits' | 'disable_parsers' | 'allow_parsers' | 'force_parser' | 'disable_rule';
|
|
256
|
-
/**
|
|
257
|
-
* Where an action applies: the whole request (`flow`) or a specific point.
|
|
258
|
-
*/
|
|
259
|
-
export interface ActionTarget {
|
|
260
|
-
whole: boolean;
|
|
261
|
-
context: RuleContext;
|
|
262
|
-
segments: Segment[];
|
|
263
|
-
/** SDK canonical form (stored after validation) */
|
|
264
|
-
canonical?: string;
|
|
265
|
-
/** SDK canonical version when point was canonicalized */
|
|
266
|
-
canonicalVersion?: number;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* UI model for action configuration.
|
|
270
|
-
* Different from API format — use toProtonAction/fromProtonAction for conversion.
|
|
271
|
-
*
|
|
272
|
-
* @example Add attack tag
|
|
273
|
-
* ```tsx
|
|
274
|
-
* const action: ActionDraft = {
|
|
275
|
-
* kind: 'add_attack',
|
|
276
|
-
* target: { whole: true, context: 'http_request', segments: [] },
|
|
277
|
-
* attackType: 'sqli',
|
|
278
|
-
* comment: 'SQL injection detected in user input',
|
|
279
|
-
* };
|
|
280
|
-
* ```
|
|
281
|
-
*
|
|
282
|
-
* @example Suppress specific attack using binding
|
|
283
|
-
* ```tsx
|
|
284
|
-
* const action: ActionDraft = {
|
|
285
|
-
* kind: 'suppress_attack',
|
|
286
|
-
* target: { whole: true, context: 'http_request', segments: [] },
|
|
287
|
-
* attackRef: 'detected_attack', // References bind_attack from condition
|
|
288
|
-
* };
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
|
-
* @example Combine duplicate headers
|
|
292
|
-
* ```tsx
|
|
293
|
-
* const action: ActionDraft = {
|
|
294
|
-
* kind: 'combine',
|
|
295
|
-
* target: {
|
|
296
|
-
* whole: false,
|
|
297
|
-
* context: 'http_request',
|
|
298
|
-
* segments: [
|
|
299
|
-
* { kind: 'native', value: 'header' },
|
|
300
|
-
* { kind: 'key', value: 'cookie' }
|
|
301
|
-
* ],
|
|
302
|
-
* canonical: '[http:header][\'cookie\']',
|
|
303
|
-
* },
|
|
304
|
-
* separator: ', ',
|
|
305
|
-
* };
|
|
306
|
-
* ```
|
|
307
|
-
*/
|
|
308
|
-
export interface ActionDraft {
|
|
309
|
-
kind: ActionKind | 'raw';
|
|
310
|
-
target: ActionTarget;
|
|
311
|
-
experimental?: boolean;
|
|
312
|
-
priority?: string;
|
|
313
|
-
/** Reference to bound attacks (for suppress_attack, mark_attack). */
|
|
314
|
-
attackRef?: string;
|
|
315
|
-
/** Reference to bound nodes (for actions with point destination). */
|
|
316
|
-
targetRef?: string;
|
|
317
|
-
/** Landing beside bound nodes. Per rules-framework-actions.md:193-197 */
|
|
318
|
-
targetRole?: 'value' | 'name';
|
|
319
|
-
attackType?: string;
|
|
320
|
-
comment?: string;
|
|
321
|
-
/** Known attack labels (CVE, vuln, technique, payload, tool) - for add_attack and mark_attack. Format 0.10.4+ adds tool. */
|
|
322
|
-
known?: {
|
|
323
|
-
cve?: string[];
|
|
324
|
-
vuln?: string[];
|
|
325
|
-
technique?: string[];
|
|
326
|
-
payload?: string[];
|
|
327
|
-
tool?: string[];
|
|
328
|
-
};
|
|
329
|
-
/** Known false positive reasons - for add_attack and mark_attack. */
|
|
330
|
-
knownFalse?: string | string[];
|
|
331
|
-
tagKey?: string;
|
|
332
|
-
tagValue?: string;
|
|
333
|
-
separator?: string;
|
|
334
|
-
limit?: string;
|
|
335
|
-
softLimit?: string;
|
|
336
|
-
hardLimit?: string;
|
|
337
|
-
parsers?: string | string[];
|
|
338
|
-
parser?: string;
|
|
339
|
-
ruleIds?: string[];
|
|
340
|
-
raw?: Record<string, unknown>;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Proton action object (API format).
|
|
344
|
-
*/
|
|
345
|
-
export interface ProtonAction {
|
|
346
|
-
action_type: string;
|
|
347
|
-
target?: Array<{
|
|
348
|
-
context: RuleContext;
|
|
349
|
-
point: string;
|
|
350
|
-
}>;
|
|
351
|
-
experimental?: boolean;
|
|
352
|
-
priority?: number;
|
|
353
|
-
attack?: {
|
|
354
|
-
attack_type?: string | string[];
|
|
355
|
-
comment?: string;
|
|
356
|
-
known?: {
|
|
357
|
-
cve?: string[];
|
|
358
|
-
vuln?: string[];
|
|
359
|
-
technique?: string[];
|
|
360
|
-
payload?: string[];
|
|
361
|
-
};
|
|
362
|
-
known_false?: string | string[];
|
|
363
|
-
};
|
|
364
|
-
tag?: {
|
|
365
|
-
key?: string;
|
|
366
|
-
value?: string;
|
|
367
|
-
};
|
|
368
|
-
separator?: string;
|
|
369
|
-
limit?: string;
|
|
370
|
-
entry_size_soft_limit?: string;
|
|
371
|
-
entry_size_hard_limit?: string;
|
|
372
|
-
parsers?: string | string[];
|
|
373
|
-
parser?: string;
|
|
374
|
-
rule_ids?: string[];
|
|
375
|
-
[key: string]: unknown;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Choice option for selects/dropdowns.
|
|
379
|
-
*/
|
|
380
|
-
export interface Choice {
|
|
381
|
-
value: string;
|
|
382
|
-
label: string;
|
|
383
|
-
description?: string;
|
|
384
|
-
}
|
|
File without changes
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RuleBuilder Constants
|
|
3
|
-
*
|
|
4
|
-
* Choice lists and constant values for RuleBuilder UI.
|
|
5
|
-
*/
|
|
6
|
-
import type { ActionKind, Choice } from '../types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Operator choices for condition groups.
|
|
9
|
-
*/
|
|
10
|
-
export declare const OPERATOR_CHOICES: Choice[];
|
|
11
|
-
/**
|
|
12
|
-
* Action type choices in menu order.
|
|
13
|
-
*/
|
|
14
|
-
export declare const ACTION_KIND_CHOICES: Choice[];
|
|
15
|
-
/**
|
|
16
|
-
* Signal type choices.
|
|
17
|
-
*/
|
|
18
|
-
export declare const SIGNAL_TYPE_CHOICES: Choice[];
|
|
19
|
-
/**
|
|
20
|
-
* Check type choices (for FieldCondition).
|
|
21
|
-
* These map to PointSelector's condition types.
|
|
22
|
-
*/
|
|
23
|
-
export declare const CHECK_TYPE_CHOICES: Choice[];
|
|
24
|
-
/**
|
|
25
|
-
* Context choices (request/response).
|
|
26
|
-
*/
|
|
27
|
-
export declare const CONTEXT_CHOICES: Choice[];
|
|
28
|
-
/**
|
|
29
|
-
* Duplicate container choices for signal conditions.
|
|
30
|
-
*/
|
|
31
|
-
export declare const DUPLICATE_CONTAINERS: Choice[];
|
|
32
|
-
/**
|
|
33
|
-
* Resource limit choices for signal conditions.
|
|
34
|
-
* Per spec: rules-framework.md:481-486
|
|
35
|
-
*/
|
|
36
|
-
export declare const RESOURCE_LIMITS: Choice[];
|
|
37
|
-
/**
|
|
38
|
-
* Which action kinds require a target specification.
|
|
39
|
-
* Maps action kind to: 'flow' (whole request only), 'point' (specific point only), or 'either'.
|
|
40
|
-
*/
|
|
41
|
-
export declare const TARGET_REQUIREMENT: Record<ActionKind, 'flow' | 'point' | 'either'>;
|
|
42
|
-
/**
|
|
43
|
-
* Condition node kinds that can be added.
|
|
44
|
-
*/
|
|
45
|
-
export declare const ADDABLE_NODE_KINDS: readonly ['field', 'attack', 'signal', 'tag', 'sample', 'group'];
|
|
46
|
-
/**
|
|
47
|
-
* Default separator for combine action.
|
|
48
|
-
*/
|
|
49
|
-
export declare const DEFAULT_SEPARATOR = ", ";
|
|
50
|
-
/**
|
|
51
|
-
* Default priority value.
|
|
52
|
-
*/
|
|
53
|
-
export declare const DEFAULT_PRIORITY = "0";
|
|
54
|
-
/**
|
|
55
|
-
* Parser choices for disable_parsers, allow_parsers, and force_parser actions.
|
|
56
|
-
*/
|
|
57
|
-
export declare const PARSER_CHOICES: Choice[];
|
|
58
|
-
/**
|
|
59
|
-
* Attack source choices for attack condition filters.
|
|
60
|
-
*/
|
|
61
|
-
export declare const ATTACK_SOURCE_CHOICES: Choice[];
|
|
62
|
-
/**
|
|
63
|
-
* XML property choices for XML attack source filters.
|
|
64
|
-
*/
|
|
65
|
-
export declare const XML_PROPERTY_CHOICES: Choice[];
|