Repeater: CLI reply to 'setperm <key> 0' is lost when the removed ACL entry sits before the requester (stale ClientInfo* after array shift)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 77/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- backend, embedded-iot
Research direction
Read examples/simple_repeater/MyMesh.cpp around onPeerDataRecv() and src/helpers/ClientACL.cpp around applyPermissions(). Trace how setperm 0 compacts the ACL while the reply still uses the requester pointer. Preserve the requester details used to route the reply, then verify that revoking entries before, after, and at the requester still sends the CLI response to the admin.
Written by the indexing model from the issue text.
Description
Summary
On a repeater, setperm <prefix> 0 (revoke) often gets no CLI reply although the entry is removed. Cause: MyMesh::onPeerDataRecv() keeps a ClientInfo* into the ACL array across handleCommand(), and the revoke path compacts that array in place, so the reply is addressed/routed with another client's data.
Where
examples/simple_repeater/MyMesh.cpp (tag repeater-v1.17.1; main @ e94125987e is identical):
- L670 — requester resolved by index before the command runs:
ClientInfo* client = acl.getClientByIdx(i); - L739 —
handleCommand(...)runssetperm→ClientACL::applyPermissions() - L751-L757 — the same
clientpointer is used afterwards:createDatagram(..., client->id, ...),client->out_path_len,client->out_path
src/helpers/ClientACL.cpp L123-L132 — guest/revoke branch shifts the fixed array down in place:
num_clients--;
int i = c - clients;
while (i < num_clients) {
clients[i] = clients[i + 1];
i++;
}
If the removed row's index is ≤ the requester's own index, client now points at the next client's data, so the OK goes to the wrong destination hash/path and the admin never sees it. If the removed row sits after the requester, nothing moves under the pointer and the reply arrives. Edge case: when the requester occupies the last populated slot, its old slot is not overwritten (stale copy of itself), so the reply still arrives.
Same code in v1.15.0, v1.16.0, v1.17.0 and v1.17.1 (only line numbers differ in MyMesh.cpp).
Reproduce (observed on a stock repeater, v1.17.0-727fc05)
- Log in as admin A. Make sure a client B sits before A in the ACL and another client C sits after A (e.g. add B, remove and re-add A with a password login, then add C with
setperm <C> 1). setperm <B-prefix> 0→ no reply. Repeat the same command →Err - invalid params(B is already gone, so the first command did work).setperm <C-prefix> 0→OKas expected.setperm <A-prefix> 0(self-revoke) with another client after A → no reply either.
Expected
The CLI reply always goes to the admin who sent the command.
Suggested fix
Smallest change: before handleCommand(), copy what the reply needs (the requester's id, out_path, out_path_len) into locals and use those afterwards instead of client->.... Alternatives: look the requester up again by pubkey after the command, or defer the array compaction (mark permissions = 0 and compact later).
Clients can currently only treat a missing reply to setperm … 0 as "unconfirmed" and re-read the list with REQ_TYPE_GET_ACCESS_LIST.
- Dominant language
- C
- Stars
- 3.9k
- Forks
- 1.5k
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 28
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meshcore-dev/MeshCore
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
meshcore-dev/MeshCore#3622 ·
Maintainers usually reply within 1 day
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash sizeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
meshcore-dev/MeshCore#3571 · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
meshcore-dev/MeshCore#3567 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
meshcore-dev/MeshCore#3549 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
meshcore-dev/MeshCore#3409 · 2 comments ·
Maintainers usually reply within 1 day
All issues in meshcore-dev/MeshCore
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FujiNetWIFI/fujinet-firmware#2079 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
VirusTotal/yara#2255 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
state:needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zed-industries/zed#65836 · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
neutralinojs/neutralinojs#1861 ·
Maintainers usually reply within 1 day