-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-v1.json
More file actions
3216 lines (3216 loc) · 78.6 KB
/
Copy pathapi-v1.json
File metadata and controls
3216 lines (3216 loc) · 78.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"openapi": "3.1.0",
"info": {
"title": "zig-waf control plane",
"version": "1.0.0",
"license": {
"name": "MIT",
"identifier": "MIT"
},
"description": "The versioned control-plane API. The path prefix carries the version: a breaking change to any operation takes a new prefix rather than mutating one clients already call.\n\nAuthorization is a property of the operation, not of its handler \u2014 every operation declares the action it requires, and an identity that cannot perform that action is refused before the handler runs. src/api.zig holds the same table, and a test fails the build if this document and that table disagree, because a published contract clients are written against must not describe an API that does not exist."
},
"servers": [
{
"url": "/api/v1"
}
],
"components": {
"securitySchemes": {
"sessionCookie": {
"type": "apiKey",
"in": "cookie",
"name": "waf_session"
},
"apiToken": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"Error": {
"type": "object",
"description": "The single shape every failure takes. One shape rather than per-operation bodies is deliberate: a client writes one error path, and an operation cannot invent a failure representation its callers have never seen.",
"required": [
"code",
"message"
],
"additionalProperties": false,
"properties": {
"code": {
"type": "string",
"description": "A stable, machine-readable identifier for the failure. Clients branch on this; the message is for people and may be reworded.",
"examples": [
"unauthenticated",
"forbidden",
"not_found",
"malformed_request"
]
},
"message": {
"type": "string",
"description": "A human-readable explanation, safe to display."
},
"detail": {
"type": "string",
"description": "Optional context about what specifically was wrong. Never contains credentials, tokens, or the contents of a rejected secret."
}
}
},
"Identity": {
"type": "object",
"description": "Who the caller is and what they may do.",
"required": [
"email",
"role"
],
"properties": {
"email": {
"type": "string",
"description": "The identity the credential resolves to.",
"format": "email"
},
"role": {
"type": "string",
"description": "The role whose permissions apply to this caller.",
"enum": [
"viewer",
"operator",
"admin"
]
}
}
},
"SessionRequest": {
"type": "object",
"description": "Credentials presented to start a session.",
"required": [
"email",
"password"
],
"additionalProperties": false,
"properties": {
"email": {
"type": "string",
"description": "The account to authenticate as.",
"format": "email"
},
"password": {
"type": "string",
"description": "The account password. Never logged, never echoed back.",
"format": "password",
"writeOnly": true
}
}
},
"Session": {
"type": "object",
"description": "An established session.",
"required": [
"email",
"role",
"expires_at"
],
"properties": {
"email": {
"type": "string",
"description": "The authenticated identity.",
"format": "email"
},
"role": {
"type": "string",
"description": "The role the session carries.",
"enum": [
"viewer",
"operator",
"admin"
]
},
"expires_at": {
"type": "string",
"description": "When the session stops being accepted.",
"format": "date-time"
}
}
},
"TokenRequest": {
"type": "object",
"description": "A request to mint an API token.",
"required": [
"name",
"role",
"expires_in_seconds"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "A name unique among the caller's tokens, used to revoke it.",
"minLength": 1
},
"role": {
"type": "string",
"description": "The role the token carries. It cannot exceed the issuer's own role.",
"enum": [
"viewer",
"operator",
"admin"
]
},
"expires_in_seconds": {
"type": "integer",
"description": "Lifetime from issuance. A token without an expiry is a credential nobody remembers to revoke, so this is required.",
"format": "int64",
"minimum": 60
}
}
},
"Token": {
"type": "object",
"description": "A freshly issued token. The secret appears in this response and nowhere else: the control plane stores only a hash, so a lost token is reissued rather than recovered.",
"required": [
"name",
"secret",
"role",
"expires_at"
],
"properties": {
"name": {
"type": "string",
"description": "The token name, used to revoke it."
},
"secret": {
"type": "string",
"description": "The bearer credential. Returned once, at issuance.",
"readOnly": true
},
"role": {
"type": "string",
"description": "The role the token carries.",
"enum": [
"viewer",
"operator",
"admin"
]
},
"expires_at": {
"type": "string",
"description": "When the token stops being accepted.",
"format": "date-time"
}
}
},
"Node": {
"type": "object",
"description": "An enrolled WAF node.",
"required": [
"node_id",
"hostname",
"version",
"status"
],
"properties": {
"node_id": {
"type": "string",
"description": "The node identifier, assigned at enrollment and stable for its life."
},
"hostname": {
"type": "string",
"description": "The host the node reported at its last enrollment."
},
"version": {
"type": "string",
"description": "The engine version the node reported."
},
"status": {
"type": "string",
"description": "Lifecycle state. A node is active from enrollment until it is retired.",
"enum": [
"active",
"retired"
]
},
"last_seen_at": {
"description": "The last heartbeat, or null if the node has never sent one.",
"type": [
"string",
"null"
],
"format": "date-time"
}
}
},
"NodeList": {
"type": "object",
"description": "Enrolled nodes, with the inventory counts behind them.",
"required": [
"nodes"
],
"properties": {
"nodes": {
"type": "array",
"description": "The nodes, ordered by identifier.",
"items": {
"$ref": "#/components/schemas/Node"
}
},
"active": {
"type": "integer",
"description": "How many nodes are active.",
"format": "int64",
"minimum": 0
},
"retired": {
"type": "integer",
"description": "How many nodes are retired.",
"format": "int64",
"minimum": 0
}
}
},
"EnrollmentRequest": {
"type": "object",
"description": "An enrollment. Idempotent: re-enrolling an existing node refreshes its hostname and version rather than failing, so a node that restarts mid-enrollment is not stuck.",
"required": [
"node_id",
"hostname",
"version"
],
"additionalProperties": false,
"properties": {
"node_id": {
"type": "string",
"description": "The identifier to enroll under.",
"minLength": 1
},
"hostname": {
"type": "string",
"description": "The host the node runs on.",
"minLength": 1
},
"version": {
"type": "string",
"description": "The engine version the node runs.",
"minLength": 1
}
}
},
"Heartbeat": {
"type": "object",
"description": "The result of a heartbeat.",
"required": [
"last_seen_at"
],
"properties": {
"last_seen_at": {
"type": "string",
"description": "The heartbeat the control plane recorded.",
"format": "date-time"
}
}
},
"LabelRequest": {
"type": "object",
"description": "A label value used to target rollouts.",
"required": [
"value"
],
"additionalProperties": false,
"properties": {
"value": {
"type": "string",
"description": "The value to set for this label key.",
"minLength": 1
}
}
},
"Policy": {
"type": "object",
"description": "A named rule-set bundle.",
"required": [
"name",
"latest_version"
],
"properties": {
"name": {
"type": "string",
"description": "The policy name."
},
"latest_version": {
"type": "integer",
"description": "The highest published version.",
"format": "int64",
"minimum": 1
}
}
},
"PolicyList": {
"type": "object",
"description": "Published policies.",
"required": [
"policies"
],
"properties": {
"policies": {
"type": "array",
"description": "The policies, ordered by name.",
"items": {
"$ref": "#/components/schemas/Policy"
}
}
}
},
"PolicyPublication": {
"type": "object",
"description": "A new policy version. Versions are immutable: republishing an existing (name, version) is a conflict rather than an overwrite, because a node that already applied that version would otherwise be running different rules from one that fetches it later.",
"required": [
"name",
"version",
"content"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The policy to publish under.",
"minLength": 1
},
"version": {
"type": "integer",
"description": "The version number, which must not already exist.",
"format": "int64",
"minimum": 1
},
"content": {
"type": "string",
"description": "The SecLang bundle."
},
"signature": {
"type": "string",
"description": "Optional Ed25519 signature over the content, base64. A node verifies it before applying the bundle, so a bundle altered in transit is refused rather than enforced."
}
}
},
"PolicyVersion": {
"type": "object",
"description": "One immutable version of a policy.",
"required": [
"name",
"version",
"content"
],
"properties": {
"name": {
"type": "string",
"description": "The policy name."
},
"version": {
"type": "integer",
"description": "The version number.",
"format": "int64",
"minimum": 1
},
"content": {
"type": "string",
"description": "The SecLang bundle."
},
"signature": {
"description": "The Ed25519 signature over the content, base64, or null if the version was published unsigned.",
"type": [
"string",
"null"
]
}
}
},
"Rule": {
"type": "object",
"description": "One rule within a policy version.",
"required": [
"id",
"phase"
],
"properties": {
"id": {
"type": "integer",
"description": "The rule id from its `id:` action.",
"format": "int64"
},
"phase": {
"type": "integer",
"description": "The phase the rule evaluates in.",
"format": "int32",
"minimum": 1,
"maximum": 5
},
"message": {
"type": "string",
"description": "The rule's `msg:` text, empty when it declares none."
},
"source": {
"type": "string",
"description": "The rule as written."
}
}
},
"RuleList": {
"type": "object",
"description": "The rules a policy version contains.",
"required": [
"rules"
],
"properties": {
"rules": {
"type": "array",
"description": "The rules, in the order the engine evaluates them.",
"items": {
"$ref": "#/components/schemas/Rule"
}
}
}
},
"SignatureVerification": {
"type": "object",
"description": "Whether a published version's signature verifies against the control plane's key.",
"required": [
"verified"
],
"properties": {
"verified": {
"type": "boolean",
"description": "True only if a signature is present and valid. An unsigned version verifies as false rather than as trusted."
},
"reason": {
"type": "string",
"description": "Why verification failed, when it did."
}
}
},
"Exclusion": {
"type": "object",
"description": "A rule exclusion scoped to a policy.",
"required": [
"rule_id",
"target"
],
"properties": {
"rule_id": {
"type": "integer",
"description": "The rule the exclusion applies to.",
"format": "int64"
},
"target": {
"type": "string",
"description": "The variable or argument excluded, e.g. `ARGS:token`."
},
"reason": {
"type": "string",
"description": "Why the exclusion exists. Recorded because an exclusion nobody can justify later is one nobody dares remove."
}
}
},
"ExclusionRequest": {
"type": "object",
"description": "An exclusion to add to a policy.",
"required": [
"rule_id",
"target",
"reason"
],
"additionalProperties": false,
"properties": {
"rule_id": {
"type": "integer",
"description": "The rule to exclude.",
"format": "int64"
},
"target": {
"type": "string",
"description": "The variable or argument to exclude.",
"minLength": 1
},
"reason": {
"type": "string",
"description": "Why this exclusion is being made."
}
}
},
"ExclusionList": {
"type": "object",
"description": "A policy's exclusions.",
"required": [
"exclusions"
],
"properties": {
"exclusions": {
"type": "array",
"description": "The exclusions, ordered by rule id.",
"items": {
"$ref": "#/components/schemas/Exclusion"
}
}
}
},
"RolloutState": {
"type": "object",
"description": "Where a staged rollout stands. The counts are what `advance` is decided on: a version widens only when every node assigned it is responsive and confirmed.",
"required": [
"name",
"version",
"assigned",
"unresponsive",
"unconfirmed",
"healthy"
],
"properties": {
"name": {
"type": "string",
"description": "The policy being rolled out."
},
"version": {
"type": "integer",
"description": "The version currently assigned to the cohort.",
"format": "int64",
"minimum": 1
},
"assigned": {
"type": "integer",
"description": "Nodes assigned this version.",
"format": "int64",
"minimum": 0
},
"unresponsive": {
"type": "integer",
"description": "Assigned nodes whose last heartbeat is older than the heartbeat window, or that have never sent one.",
"format": "int64",
"minimum": 0
},
"unconfirmed": {
"type": "integer",
"description": "Assigned nodes that have not reported running this version.",
"format": "int64",
"minimum": 0
},
"healthy": {
"type": "boolean",
"description": "Whether the cohort is evidence the version is safe to widen: non-empty, fully responsive, and fully confirmed."
}
}
},
"RolloutAssignment": {
"type": "object",
"description": "The version to assign, and to whom.",
"required": [
"version",
"node_ids"
],
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"description": "The policy version to assign.",
"format": "int64",
"minimum": 1
},
"node_ids": {
"type": "array",
"description": "The nodes to assign it to.",
"items": {
"type": "string"
}
}
}
},
"Drift": {
"type": "object",
"description": "A node running something other than what it was assigned.",
"required": [
"node_id",
"assigned_version"
],
"properties": {
"node_id": {
"type": "string",
"description": "The node."
},
"assigned_version": {
"type": "integer",
"description": "The version it was assigned.",
"format": "int64"
},
"running_version": {
"description": "The version it last reported running, or null if it has never reported one.",
"type": [
"integer",
"null"
],
"format": "int64"
}
}
},
"DriftList": {
"type": "object",
"description": "Nodes that have drifted from their assignment.",
"required": [
"drifted",
"count"
],
"properties": {
"drifted": {
"type": "array",
"description": "The drifted nodes.",
"items": {
"$ref": "#/components/schemas/Drift"
}
},
"count": {
"type": "integer",
"description": "How many nodes have drifted.",
"format": "int64",
"minimum": 0
}
}
},
"Event": {
"type": "object",
"description": "One security event recorded by a node.",
"required": [
"id",
"node_id",
"occurred_at",
"action",
"uri"
],
"properties": {
"id": {
"type": "string",
"description": "The event's row identifier, as a string because it exceeds the range a JSON number is guaranteed to carry exactly."
},
"node_id": {
"type": "string",
"description": "The node that recorded it."
},
"occurred_at": {
"type": "string",
"description": "When the node recorded it.",
"format": "date-time"
},
"action": {
"type": "string",
"description": "What the engine did, e.g. `deny` or `pass`."
},
"uri": {
"type": "string",
"description": "The request URI."
},
"message": {
"type": "string",
"description": "The rule message."
}
}
},
"EventPage": {
"type": "object",
"description": "A page of events. Paging is by cursor rather than offset: a page is defined by where the previous one ended, so events arriving between requests neither shift rows into a page already read nor skip rows the reader never saw.",
"required": [
"events"
],
"properties": {
"events": {
"type": "array",
"description": "The events, oldest first.",
"items": {
"$ref": "#/components/schemas/Event"
}
},
"next_occurred_at": {
"description": "Pass as `after_occurred_at` for the next page. Null when the page is the last one.",
"type": [
"string",
"null"
],
"format": "date-time"
},
"next_id": {
"description": "Pass as `after_id` for the next page, together with `next_occurred_at`. Null when the page is the last one.",
"type": [
"string",
"null"
]
}
}
},
"EventSubmission": {
"type": "object",
"description": "One event a node is submitting.",
"required": [
"node_id",
"occurred_at",
"action",
"uri"
],
"additionalProperties": false,
"properties": {
"node_id": {
"type": "string",
"description": "The node that recorded it.",
"minLength": 1
},
"occurred_at": {
"type": "string",
"description": "When the node recorded it.",
"format": "date-time"
},
"action": {
"type": "string",
"description": "What the engine did.",
"minLength": 1
},
"uri": {
"type": "string",
"description": "The request URI."
},
"message": {
"type": "string",
"description": "The rule message."
},
"key": {
"type": "string",
"description": "An idempotency key unique to this event on this node, e.g. its transaction id. Re-submitting the same key at the same `occurred_at` is skipped rather than duplicated, so a node may safely re-send a batch it never saw acknowledged. Omit it and the event is always inserted."
}
}
},
"EventBatch": {
"type": "object",
"description": "A batch of events to ingest, committed all-or-nothing.",
"required": [
"events"
],
"additionalProperties": false,
"properties": {
"events": {
"type": "array",
"description": "The events. One commit covers the whole batch.",
"items": {
"$ref": "#/components/schemas/EventSubmission"
}
}
}
},
"IngestionResult": {
"type": "object",
"description": "What ingestion did with a batch. `received` minus `inserted` is how many were recognized as already ingested \u2014 the expected outcome of a re-sent batch, not an error.",
"required": [
"received",
"inserted",
"deduplicated"
],
"properties": {
"received": {
"type": "integer",
"description": "Events in the batch.",
"format": "int64",
"minimum": 0
},
"inserted": {
"type": "integer",
"description": "Events newly recorded.",
"format": "int64",
"minimum": 0
},
"deduplicated": {
"type": "integer",
"description": "Events skipped as already ingested.",
"format": "int64",
"minimum": 0
}
}
},
"SavedSearch": {
"type": "object",
"description": "A named event search belonging to the caller.",
"required": [
"name",
"query"
],
"properties": {
"name": {
"type": "string",
"description": "The search name, unique per user."
},
"query": {
"type": "object",
"description": "The search parameters, as saved.",
"additionalProperties": true
}
}
},
"SavedSearchRequest": {
"type": "object",
"description": "A search to save under this name, replacing any existing one.",
"required": [
"query"
],
"additionalProperties": false,
"properties": {
"query": {
"type": "object",
"description": "The search parameters to save.",
"additionalProperties": true
}
}
},
"SavedSearchList": {
"type": "object",
"description": "The caller's saved searches.",
"required": [
"searches"
],
"properties": {
"searches": {
"type": "array",
"description": "The searches, ordered by name.",
"items": {
"$ref": "#/components/schemas/SavedSearch"
}
}
}
},
"Alert": {
"type": "object",
"description": "An alert rule and its delivery target.",
"required": [
"name",
"event_action",
"webhook_url",
"enabled"
],
"properties": {
"name": {
"type": "string",
"description": "The rule name."
},
"event_action": {
"type": "string",
"description": "The event action that fires this rule."
},
"webhook_url": {
"type": "string",
"description": "Where a firing alert is delivered.",
"format": "uri"
},
"enabled": {
"type": "boolean",
"description": "Whether the rule fires."
},
"signed": {
"type": "boolean",
"description": "Whether deliveries carry an HMAC-SHA256 signature. The secret itself is never returned."
},
"silenced_until": {
"description": "When the rule resumes firing, or null if it is not silenced.",
"type": [
"string",
"null"
],
"format": "date-time"
}
}
},
"AlertRequest": {
"type": "object",
"description": "An alert rule to create.",
"required": [
"name",
"event_action",
"webhook_url"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "A name unique among alert rules.",
"minLength": 1
},
"event_action": {
"type": "string",
"description": "The event action that should fire it.",
"minLength": 1
},
"webhook_url": {
"type": "string",
"description": "Where to deliver it.",
"format": "uri"
},
"secret": {
"type": "string",
"description": "Optional signing secret. When set, each delivery carries an HMAC-SHA256 signature over its body so the receiver can tell a real alert from anything else that finds the URL.",
"writeOnly": true
}
}
},
"AlertList": {
"type": "object",
"description": "Alert rules.",
"required": [
"alerts"
],
"properties": {
"alerts": {
"type": "array",
"description": "The rules, ordered by name.",
"items": {
"$ref": "#/components/schemas/Alert"
}
}
}
},
"SilenceRequest": {
"type": "object",
"description": "How long to stop a rule from firing.",
"required": [
"until"
],
"additionalProperties": false,
"properties": {
"until": {
"type": "string",
"description": "When the rule resumes firing. A silence always ends: one without an expiry is an alert quietly deleted.",
"format": "date-time"
},
"reason": {
"type": "string",
"description": "Why it is being silenced."
}
}
},
"FailingChannel": {
"type": "object",
"description": "A delivery target that is failing.",
"required": [
"name",
"webhook_url",
"consecutive_failures"
],
"properties": {
"name": {
"type": "string",
"description": "The alert rule."
},
"webhook_url": {
"type": "string",