Commit f37d80f
authored
waf: named IP lists — lists page, ipInList builder support, list chips (#329)
* waf: named IP lists — lists page, ipInList builder support, tests
Console part of SPEC-waf-ip-lists.md (§8):
- waf/lists page: NAME|TYPE|ENTRIES|REFERENCED BY|UPDATED table,
referenced-by links to each zone's manage page, create/edit modal
(name immutable on edit; live per-line entry validation + duplicate
flag + count via the new pure helper $lib/waf/lists.ts
parseIPListEntries), delete with the server's in-use referent error
surfaced verbatim. Writes gated on wafList.set / wafList.delete per
the permission pre-flight convention (waf.* does not imply wafList.*).
- $lib/waf/expression.ts: in_ip_list / not_in_ip_list ip operators
(OperatorMeta.valueKind 'listName'), buildExpression emits the
platform macro ipInList(<accessor>, "<name>") (never an invalid or
escaped name — the macro's name literal admits no escapes),
parseCondition round-trips both polarities at the same fidelity bar
as in_cidr, and wafListRefs — the TS twin of api's waflistmacro.go
scanner (string-literal/raw/bytes/triple/comment aware; malformed
usage carries no ref). Keep in sync with the Go scanner.
- Condition builder: the list picker Select is fed by wafList.list,
keyed on the project param (refetches on SPA project switch); without
wafList.list it renders disabled with the missing-permission hint.
Works unchanged for rule expressions and limit filters (same builder).
- waf index gains an "IP lists" link + palette action; manage page
shows a chip on rules/limits whose expression references a list
(client-side wafListRefs), linking to the lists page.
- api.d.ts: Api.WafListItem / WafListListResult / WafListType.
- mock.ts (dev): session-mutable wafList.* handlers; the seed zone's
allow rule now references office-ips so referencedBy and the in-use
delete guard are exercisable offline.
- tests: unit coverage for build/parse round-trip, scanner
literal-skipping, name/entry validation; Playwright specs for lists
CRUD, validation gating, permission gating, the builder picker
end-to-end (asserts the stored waf.set expression is the unexpanded
macro), round-trip into the visual builder, and manage-page chips.
Deviations from the spec text: the edit modal's name input is readonly
(not disabled) so the value stays legible — immutability + hint intact;
the "Lists" link lives on the firewall index page-head while the
reference chips live on the manage page, which is where rules/limits
actually render.
Composes with apiserver#238 (waf-test, server-side CEL compile
validation): the console stores and round-trips the UNEXPANDED macro
form only — any compile validation must run on the expanded expression
server-side. No shared files, no expected merge conflict.
Suite: bun lint + bun check clean; bun run test 364 passed.
* waf: review fixes — stale-guard + catch on list fetch, save error surface, gate IP-lists entry points
- WafConditionBuilder: reset + stale-response guard on the project-keyed
wafList.list fetch (out-of-order responses across an SPA project switch
can no longer populate another project's names) and a .catch so a
network-level failure doesn't escape as an unhandled rejection.
- WafListModal: catch network-level save failures so the user sees an
error instead of a silently cleared spinner.
- /waf: the "IP lists" header button and palette action are now gated on
wafList.list (GuardedButton / can()), matching the permission
pre-flight convention.
- expression.ts: comments documenting the intentional strict-parser vs
tolerant-chip-scanner asymmetry and the one scanner behavior that must
stay in sync with the Go twin (token-in-literal false positives).
Rollout note: depends on the apiserver wafList.* + macro-expansion PR;
that PR must expand ipInList(...) BEFORE apiserver#238's CEL compile
validation runs (the raw macro form is not valid engine CEL).1 parent a2ea908 commit f37d80f
16 files changed
Lines changed: 1457 additions & 25 deletions
File tree
- src
- lib
- components
- server
- waf
- routes/(auth)/(project)/waf
- edit
- limit
- lists
- manage
- types
- tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 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 | + | |
12 | 42 | | |
13 | 43 | | |
14 | 44 | | |
| |||
114 | 144 | | |
115 | 145 | | |
116 | 146 | | |
117 | | - | |
| 147 | + | |
| 148 | + | |
118 | 149 | | |
119 | 150 | | |
120 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | | - | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
39 | 60 | | |
40 | 61 | | |
41 | 62 | | |
| |||
128 | 149 | | |
129 | 150 | | |
130 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
131 | 171 | | |
132 | 172 | | |
133 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments