Skip to content

Fix room server: Read-Only ACL role can still post messages - #3340

Open
smellyspice wants to merge 1 commit into
meshcore-dev:devfrom
smellyspice:fix/room-server-readonly-can-post
Open

Fix room server: Read-Only ACL role can still post messages#3340
smellyspice wants to merge 1 commit into
meshcore-dev:devfrom
smellyspice:fix/room-server-readonly-can-post

Conversation

@smellyspice

Copy link
Copy Markdown

Summary

The room server's ACL has four roles: Guest, Read-Only, Read-Write, and Admin. A contact can be given the Read-Only role directly via the setperm CLI command (or the app's ACL/permissions editor, which uses it). However, that role doesn't actually prevent posting.

Root cause

The check that decides whether an incoming plain-text message gets accepted as a post only excludes the Guest role:

if ((client->permissions & PERM_ACL_ROLE_MASK) == PERM_ACL_GUEST) {
  // dropped, no ack
} else {
  addPost(client, ...);  // accepted and stored
}

A client explicitly set to PERM_ACL_READ_ONLY is not PERM_ACL_GUEST, so it falls into the else branch and gets to post exactly like a Read-Write client would.

Fix

Exclude both PERM_ACL_GUEST and PERM_ACL_READ_ONLY from the posting gate, so only PERM_ACL_READ_WRITE and PERM_ACL_ADMIN can post.

Testing

  • pio run -e heltec_v4_r8_room_server: builds successfully
  • Native unit tests (pio test -e native) currently fail to build on this branch's base for an unrelated, pre-existing reason (missing <cstdlib> include in ConfigSerializer.cpp, causing atoi/atof/atol to be undeclared) — not something this change touches.

Compatibility

The room server's TXT_TYPE_PLAIN post-acceptance check only excludes
clients with the Guest role (assigned via a blank/read-only login).
A client explicitly given the Read-Only role via 'setperm' is not
Guest, so it falls through to the posting branch and gets accepted
and stored like a Read-Write client's post.

Exclude both Guest and Read-Only from the posting gate, so only
Read-Write and Admin roles can post.
smellyspice added a commit to smellyspice/MeshCore that referenced this pull request Sep 2, 2026
- storePost() now mirrors the posts[] cyclic queue to flash (/posts) on
  every write; begin() restores it before the board starts serving, so
  a reboot no longer wipes the archive clients sync against.
- Fix: a contact explicitly assigned the Read-Only ACL role (via
  setperm) could still post -- the posting gate only excluded Guest.
  Now excludes both. Same fix as upstream PR meshcore-dev#3340.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant