fix(acl): rebase runtime-resolved scope ids past baked ACL#15291
fix(acl): rebase runtime-resolved scope ids past baked ACL#15291derek-knox wants to merge 16 commits into
Conversation
f64bbea to
e7a55b1
Compare
Package Changes Through 6dce431There are 1 changes which include tauri with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
@tweidinger No worries if this isn't top-of-your list as I know open source is hard. Is there anything I can do/improve in the PR to make it easier for you? |
|
I'm traveling without personal laptop and asked @chippers to review this and get it merged into dev. |
Seen this, I have eyes on it but I don't have an ETA for when I can get to it. Ideally this weekend. |
|
@chippers Sounds good, thanks for the heads up. |
Summary
Runtime-added capabilities (feature
dynamic-acl) collided with build-time-baked ACL scopes becauseResolved::resolverestartsscope_idat 0 on each call. Fresh scope entries were merged into an unrelated plugin's bucket — e.g. an httpurl-shape entry landing inside opener'spath-shape bucket atscope_id=1, later failing plugin-http'sEntryRawdeserializer.Adds a small
rebase_scope_idshelper that offsets everyscope_idin the freshResolvedby the current max bakedscope_idbefore the existing merge loop. Zero-offset is a no-op for the first-capability case.Note
I'm under the impression I followed all guidelines, but if I missed something just let me know
Happy to add an integration-level test exercising the full add_capability path if preferred—kept it out to keep the diff tight. Just let me know.
Why this is safe
#[cfg(feature = "dynamic-acl")]—defaultbuilds unaffected.rebase_scope_idsis crate-private and feature-gated.RuntimeAuthority::new.Verification
crates/tauri/src/ipc/authority.rsmod tests:rebase_scope_ids_shifts_keys_and_scope_idsrebase_scope_ids_zero_offset_is_nooprebase_scope_ids_prevents_cross_plugin_scope_collision(regression for the exact bug)cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test -p tauri --all-featurespass locally.app.add_capability(...)—EntryRawdeserialization no longer fails.Change file:
.changes/fix-dynamic-acl-scope-id-collision.md(patch:bugontauri).