Commit 04c4c5c
fix(frontend): use parsed Zod output and pin id/chainId in customEvmNetworksStore
Two defense-in-depth changes on the store's write paths:
- add and update now build the stored entry from parsed.data rather than
the raw input/merged object. Zod strips unknown keys by default, so
parsed.data is the canonical schema shape; the prior code left any
caller-supplied extra properties in the in-memory state.
- update explicitly pins id and chainId to the existing entry's values
before validation. TypeScript already excludes these from
CustomEvmNetworkPatch, but an `as any` caller could previously sneak
them in; the schema would not catch an id that no longer corresponds
to its chainId.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 51400d4 commit 04c4c5c
File tree
2 files changed
+34
-3
lines changed- src/frontend/src
- eth/stores
- tests/eth/stores
2 files changed
+34
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
130 | | - | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
193 | 201 | | |
194 | 202 | | |
195 | 203 | | |
| |||
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
227 | 252 | | |
228 | 253 | | |
229 | 254 | | |
| |||
0 commit comments