handleLoginReq: layer ACL between admin pw and guest/blank pw#2437
Open
hank wants to merge 1 commit intomeshcore-dev:devfrom
Open
handleLoginReq: layer ACL between admin pw and guest/blank pw#2437hank wants to merge 1 commit intomeshcore-dev:devfrom
hank wants to merge 1 commit intomeshcore-dev:devfrom
Conversation
Reorder login auth so that, in priority:
1. Admin password match -> ADMIN (overrides ACL — a region_mgr or
other ACL'd client who knows the admin pw can still upgrade).
2. Sender pubkey is in the ACL -> use the stored permissions
(no password required; pubkey is itself an identity assertion).
3. Guest password match (or blank pw when guest pw is unset) -> GUEST.
4. Otherwise -> reject.
Previously the ACL was consulted only when `data[0] == 0` (blank pw),
so a non-blank password would skip the ACL entirely and fall through
to the password block. Phones that sent any non-empty password field
— even a stale one — would never see their ACL-granted role; they'd
either be rejected or assigned the role implied by the password match.
Implementation is a single-line change: gate the ACL lookup on "the
admin pw did NOT match". When admin matches, we skip the lookup so
the existing password block sets ADMIN unconditionally (the right
behavior for the upgrade case). When admin does not match, the ACL
takes over; only on an ACL miss do we fall through to guest/reject.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reorder login auth so that, in priority:
Previously the ACL was consulted only when
data[0] == 0(blank pw), so a non-blank password would skip the ACL entirely and fall through to the password block. Phones that sent any non-empty password field — even a stale one — would never see their ACL-granted role; they'd either be rejected or assigned the role implied by the password match.Implementation is a single-line change: gate the ACL lookup on "the admin pw did NOT match". When admin matches, we skip the lookup so the existing password block sets ADMIN unconditionally (the right behavior for the upgrade case). When admin does not match, the ACL takes over; only on an ACL miss do we fall through to guest/reject.
This change is needed to allow the upcoming region manager PR (#2438) to function properly. It should not break any existing functionality.
Tested in tandem with the region manager code changes with a change to meshcore-open on Android that adds permissionLevel 4 and shows the correct controls (CLI) in the app. Was able to exercise all region commands and was denied access to commands that the admin has access to, showing that the ACL was respected as sent. After authenticating as admin with the password, the acl on the repeater was changed to 3 for my pubkey and all admin functions were available. On login without a password after that, admin permissions were granted again (sticky). I think this is fine behavior.