NonFungibleAssetDelta cancellation doesn't verify asset equality before removing
- 主要言語
- Rust
- スター
- 132
- フォーク
- 167
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 110
説明
`crates/miden-protocol/src/account/delta/vault.rs:427-439`:
```rust
fn apply_action(&mut self, asset: NonFungibleAsset, action: NonFungibleDeltaAction) -> ... {
match self.0.entry(asset.vault_key()) {
Entry::Vacant(entry) => { entry.insert((asset, action)); },
Entry::Occupied(entry) => {
let (_prev_asset, previous_action) = *entry.get();
if previous_action == action {
return Err(...);
}
entry.remove(); // cancel out — but discards `asset`
},
}
}
```
When a non-fungible asset is added and then removed (opposite actions), the entry is removed from the map. But the second call discards the `asset` parameter entirely it doesn't verify that the asset being removed matches the one that was added beyond having the same vault key. If two distinct non-fungible assets happen to share a vault key (same faucet ID, same asset ID), the cancellation silently drops the second operation without checking asset equivalence.
Fix: verify the removed asset matches the previously added asset before cancelling.
コントリビューションガイド
評価
この issue はまだ評価されていません。