Commit 1a68114
authored
fix: operator precedence bug in UpdateDelegate revoke authority (#253)
Due to Rust's operator precedence (&& binds tighter than ||), the
condition `A || B && C && D` was evaluated as `A || (B && C && D)`
instead of the intended `(A || (B && C)) && D`.
This meant the `plugin.manager() == Authority::UpdateAuthority` check
only applied to the additional_delegates branch, not the main
resolved_authorities branch. As a result, UpdateDelegate could revoke
authority on owner-managed plugins (FreezeDelegate, TransferDelegate)
that it should not control.
Added explicit parentheses to ensure the manager check applies to
both branches.1 parent 276f2a2 commit 1a68114
File tree
1 file changed
+8
-4
lines changed- programs/mpl-core/src/plugins/internal/authority_managed
1 file changed
+8
-4
lines changedLines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
151 | | - | |
152 | | - | |
| 155 | + | |
| 156 | + | |
153 | 157 | | |
154 | 158 | | |
155 | 159 | | |
| |||
0 commit comments