ACL endpoints missing companion identities #57

Closed
opened 2026-10-27 09:30:35 +01:00 by adam · 6 comments
Owner

The three ACL endpoints in api_endpoints.py only query repeater and room_server identities — companion identities are never included.

Affected endpoints:

  • acl_info (line ~2384) — no get_identities_by_type("companion") loop
  • acl_clients (line ~2455) — companions not added to identity_map
  • acl_stats (line ~2644) — identity_stats dict missing "companion" key, no companion counting loop

Fix: Add the same get_identities_by_type("companion") block that exists for room_server in each of the three endpoints. Each is a direct copy of the room_server block with "room_server" → "companion".

The three ACL endpoints in `api_endpoints.py` only query `repeater` and `room_server` identities — companion identities are never included. **Affected endpoints:** - `acl_info` (line ~2384) — no `get_identities_by_type("companion")` loop - `acl_clients` (line ~2455) — companions not added to `identity_map` - `acl_stats` (line ~2644) — `identity_stats` dict missing `"companion"` key, no companion counting loop **Fix:** Add the same `get_identities_by_type("companion")` block that exists for `room_server` in each of the three endpoints. Each is a direct copy of the room_server block with `"room_server"` → `"companion"`. <!-- github-sync-id:4062725836 -->
adam closed this issue 2026-10-27 09:30:35 +01:00
Author
Owner

@agessaman FYI

@agessaman FYI <!-- github-comment-id:4046770496 -->
Author
Owner

I'm struggling here a little bit, because companions really don't use login_manager at all—there's no OTA auth or ACL. So doing something like this is going to produce an entry but no more useful detail than that.

            for name, identity, config in identity_manager.get_identities_by_type("companion"):
                hash_byte = identity.get_public_key()[0]
                acl = acl_dict.get(hash_byte)

                if acl:
                    acl_info_list.append(
                        {
                            "name": name,
                            "type": "companion",
                            "hash": f"0x{hash_byte:02X}",
                            "max_clients": acl.max_clients,
                            "authenticated_clients": acl.get_num_clients(),
                            "has_admin_password": bool(acl.admin_password),
                            "has_guest_password": bool(acl.guest_password),
                            "allow_read_only": acl.allow_read_only,
                        }
                    )

I'll commit for consistency, but there are going to be a lot of empty values.

I'm struggling here a little bit, because companions really don't use login_manager at all—there's no OTA auth or ACL. So doing something like this is going to produce an entry but no more useful detail than that. ``` # Add companion identities for name, identity, config in identity_manager.get_identities_by_type("companion"): hash_byte = identity.get_public_key()[0] acl = acl_dict.get(hash_byte) if acl: acl_info_list.append( { "name": name, "type": "companion", "hash": f"0x{hash_byte:02X}", "max_clients": acl.max_clients, "authenticated_clients": acl.get_num_clients(), "has_admin_password": bool(acl.admin_password), "has_guest_password": bool(acl.guest_password), "allow_read_only": acl.allow_read_only, } ) ``` I'll commit for consistency, but there are going to be a lot of empty values. <!-- github-comment-id:4050878337 -->
Author
Owner

thanks for looking into it. if we think this is bloat or not useful, I defer to both of your expertise. the intent was to add more detail to the "sessions" section using its existing methods, but there are likely other ways to achieve that goal. What do you think?

thanks for looking into it. if we think this is bloat or not useful, I defer to both of your expertise. the intent was to add more detail to the "sessions" section using its existing methods, but there are likely other ways to achieve that goal. What do you think? <!-- github-comment-id:4051071608 -->
Author
Owner

@rightup @dmduran12

Okay, I gave this another look:

Image

There's not as much "Access Control" as "Sessions" here. I included whether it was registered (active and receiving packets) and whether a client is connected and the client's IP.

So a companion entry can look like:

{
  "name": "my-companion",
  "type": "companion",
  "hash": "0x42",
  "registered": true,
  "active": true,
  "client_ip": "192.168.1.100"
}

or when no client is connected:

{
  "name": "my-companion",
  "type": "companion",
  "hash": "0x42",
  "registered": true,
  "active": false,
  "client_ip": null
}
@rightup @dmduran12 Okay, I gave this another look: <img width="693" height="445" alt="Image" src="https://github.com/user-attachments/assets/09c74c76-2527-43d4-9997-210099b8ef1e" /> There's not as much "Access Control" as "Sessions" here. I included whether it was registered (active and receiving packets) and whether a client is connected and the client's IP. So a companion entry can look like: ``` { "name": "my-companion", "type": "companion", "hash": "0x42", "registered": true, "active": true, "client_ip": "192.168.1.100" } ``` or when no client is connected: ``` { "name": "my-companion", "type": "companion", "hash": "0x42", "registered": true, "active": false, "client_ip": null } ``` <!-- github-comment-id:4052436710 -->
Author
Owner

I think this is handled now and can be closed. Agree @dmduran12?

I think this is handled now and can be closed. Agree @dmduran12? <!-- github-comment-id:4078294377 -->
Author
Owner

It's still untested on console, but we can resolve to tidy things up!

It's still untested on console, but we can resolve to tidy things up! <!-- github-comment-id:4078300347 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/pyMC_Repeater#57