Commit b414de2
fix: restrict indexed input note asset removal (#3451)
* fix: restrict indexed input note asset removal
* refactor: share indexed input note removal guard
* test: make malicious input note theft regression explicit
* fix: require native account context for indexed input note asset removal
The account-origin check resolves the caller against the *active* account,
so the gate alone was bypassable: a malicious note script could route the
indexed removal through an attacker-controlled foreign account via FPI,
where that foreign account is active and vouches for its own procedures.
The full #3445 drain still worked end to end against a standard wallet.
Add exec.memory::assert_native_account to the guard, which closes that
path while leaving the one legitimate by-index caller intact (the fee
manager collects sponsorship note assets from the native account's auth
procedure).
Tests: a note-script-via-FPI regression test, and an explicit test that
transaction scripts are rejected too - the latter pins a behavior change
that was previously only implied by a deleted test.
---------
Co-authored-by: Claude (Opus) <noreply@anthropic.com>
Co-authored-by: Bobbin Threadbare <43513081+bobbinth@users.noreply.github.com>1 parent a1214f9 commit b414de2
5 files changed
Lines changed: 421 additions & 157 deletions
File tree
- crates
- miden-protocol/asm
- kernels/transaction/lib
- protocol/src
- miden-testing/src/kernel_tests/tx
- docs/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1119 | 1119 | | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | | - | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1123 | 1125 | | |
1124 | 1126 | | |
1125 | 1127 | | |
| |||
1132 | 1134 | | |
1133 | 1135 | | |
1134 | 1136 | | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
1135 | 1140 | | |
1136 | 1141 | | |
1137 | 1142 | | |
| |||
1175 | 1180 | | |
1176 | 1181 | | |
1177 | 1182 | | |
1178 | | - | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1179 | 1186 | | |
1180 | 1187 | | |
1181 | 1188 | | |
1182 | 1189 | | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
1183 | 1193 | | |
1184 | 1194 | | |
1185 | 1195 | | |
| |||
2074 | 2084 | | |
2075 | 2085 | | |
2076 | 2086 | | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
2077 | 2111 | | |
2078 | 2112 | | |
2079 | 2113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| |||
348 | 349 | | |
349 | 350 | | |
350 | 351 | | |
| 352 | + | |
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
| |||
0 commit comments