WTH can't I control what other users can access? (RBAC)

I hear you, the answer Frenk gave is a bit more nuanced though: they understand it, but can’t accept contributions in this specific area, both from an architectural point of view (with external auditing) and (my assumption) the amount of developer power needed to implement and maintain it in the code.

A quick read of the tread shows some people worked around it by building a proxy-like feature and using that to filter: GitHub - FezVrasta/ha-rbac: Role-based access control for Home Assistant. Guests see the lights, kids get their own dashboard, nobody sees where your phone is. · GitHub

I hear you and I hear Frenk. But honestly- and I say this with all respect to all involved- it’s all crap.

Poll everyone in this thread, hell everyone on this forum, hell everyone that uses HA, and give them 2 choices- either you have a mostly-functional security system now, that’s a 3rd party tool, that isn’t vetted or audited, but that mostly works, or we have no security for years to come while a ‘good’ security system is developed, tested, audited, a task which isn’t a priority and may never be. How many of those people would vote to wait?

You can always come up with valid reasons for anything. That doesn’t mean that

External auditing is for when you’re exposing the thing to the Internet and you need serious security. We don’t need that. We just need a way to prevent the kid from turning his sister’s bedroom light on and off.

The proposed solution in that github thread does that.

And if the answer is ‘we’re either doing this right or not at all’, then it SHOULD BE DONE, rather than postponed indefinitely.

I disagree. As much as I want to have RBAC, it must be done properly. We actually already have a half arsed rbac in HA.

The problem isn’t Frenk wanting to have it done properly. The problem is he (or whoever made the decision) prioritises other things over this, year after year after year. And I bet he (them) have good reasons for this, but it still sucks.

It would be nice to be able to configure an entity to be visible only to some users (like Dashboard cards - Home Assistant, but at entity level, instead of dashboard level), and then have the default automatically-generated dashboard rely on it automatically, so one can hide advanced entities from non-technical people in the house, without having to tinker with custom dashboards.

The problem is that most users really just need to restrict access at the frontend/UI level.
Again, most of us are not worried about true malicious actors, we’re just trying to add friction to mischief caused by an immature user who is only accessing the service via the companion app, or that a (trusted) guest can’t get themselves lost in the UI when operating a shared dashboard device or viewing a single page they’re accessing via a link we’ve sent them.

A problem I’ve found with a similar setup – using kiosk mode to restrict the display of controls, rather than the manipulation of them – is that people will invariably want the Home Assistant app on their own phone, and Home Assistant exposes all devices to Siri Shortcuts/Control Center, regardless of whether those devices or controls appear in a dashboard to which the user has access. Kiosk mode works for a railroaded, on-the-wall tablet, not so much a device that someone else has administrative control over.

Outsider view:

Then the developers are the wrong target. Need to address those that decide on tasks and priorities of developer attention.

I’m new to HA and I’m definitely not one getting invovled in politics, but one path would be (supposing there is demand, especially from larger installations like that telescope place mentione) to…

…collect necessary (ample?) funding or commitments to funding, then with that approach the foundation or whoever makes the decisions on what gets done.

Adding on here and relating it directly to the stated focus of this years Month of WTH around feedback from non-admin users.

When my kids ask why they can’t have their own dashboard or assist satellite, the answer is of course related to this. I hardly need to tell you that they don’t like that answer :slight_smile:

If we could get per-satellite entity exposure going, I’d be thrilled. But the real unlock, and the thing that would make my eldest daughter happiest as a Home Assistant user, is full RBAC, so I can give her a dashboard.

Those are my exact thoughts. As someone who uses HA at home and installs it for others, I refuse to expose it (for now) to others because of the potential for misconfiguration and alternations of device settings by casual users. If this year’s WTH is supposed to be about making the casual HA user’s life easier, then RBAC control is the foundation for all this.

I am a highly technical professional, so I understand the challenges of retrofitting proper RBAC… that being said, TOHF needs to stop trying for perfection and implement a stop-gap control. As others mentioned or demonstrated, a proxy server of some type could sit between the users/satellites and the HA instance and provide the filtering without having to rearchitect the core HA code.

This is actually my no.1 desire as well.

I’ve got a house that was built with automation in mind. Actually with HA in mind! There’s KNX for all the lights and shades and then various sensors, speakers, smart plugs, cameras and so forth on other protocols. And HA is very nicely tying them together.

I’ve got couple of kids and older one is reaching the age where I’d like to have her ability to start exploring stuff on her own. I really can’t do that, if she can accidentally turn off my freezer in the basement without even knowing what she’s done.

I like all the voice stuff. I like the addition of IR, modbus and everything else. I like context-renamed entities, yes. But on the approach of priorities, I thikn RBAC should be waaaay before those things.
There’s a lot of talk of making HA more accessible for everyone. Well THIS is the one thing that’s keeping it inaccessible from other members of my family. Or from guests that visit us.

And even if there are problems that are big and maybe too big to handle at the moment. The lack of discussion is maybe the biggest disappointment. It’s probably the only disappointment that I have with this otherwise awesome and inspiring project that brought me endless joy and lost me endless amount of time.
Let’s at least have an open and honest debate why we are (or aren’t) where we are at the moment and what (if anything) will be done to move forward.

I cast my WTH vote for this as well. SSO integration in addition to built in RBAC would be amazing.

Ok, so this has an BIGGG GitHub discussium and is mostly requested.
In the meantime, i found FezVrasta/ha-rbac basiaclly too good.

It was mentioned that the need for RBAC has been acknowledged, but that there are other aspects of HA that have been prioritized over it.

Thats definitely understandable, especially with the amount of growth its seen over the last few years.

When those decisions are made, and the updates are put out for those other aspects, is RBAC included in the design of the new system? We have seen multiple major framework changes over the last year alone. Did those changes push the overall project in the direction of RBAC or will they all have to also be reworked to add it?

With it touching on every single aspect of the system architecture, unless each new revision includes a consideration for future RBAC implementation it, the answer of “implementing it touches too many things” will always be present.

Until home assistant admin can assign an account to a user which can only access certain levels of entities, adoption into households will be strained.

I absolutely agree with this request. RBAC is one of the biggest missing features in Home Assistant, especially for families.

I use Home Assistant as the central smart home system for my entire household. I want my wife and children to have access to their own dashboards and devices without automatically giving them access to everything in the house.

For example:

  • Children should only be able to control selected lights and devices.
  • Family members should not have access to security settings, cameras or sensitive information.
  • Guests should have access only to a dedicated dashboard.
  • Each user should have permissions tailored to their needs.

Hiding cards or dashboards is not real access control. We need proper permissions enforced at the backend level, so users cannot access restricted devices or information through other means.

Home Assistant is becoming the central operating system of our homes. Multi-user access control should be a fundamental part of it, not an advanced enterprise feature.

And here is a real-life example from my home:

My wife recently asked me:

“So, are you telling me that with your fancy smart home system, you still can’t configure the kids’ tablet so they don’t see the security cameras?”

And honestly, I had no good answer.

WHAT THE HECK?! :sweat_smile:

We are building smart homes for our families, yet we cannot even decide which family member is allowed to see which camera, control which light, or access which part of the system.

Please, let’s make Home Assistant truly multi-user. This is not just a nice-to-have feature anymore. It’s a basic requirement for a modern smart home.

I think the more examples users can post of multi-user households, the better the devs and decision makers can understand the use case of a HA instance with multiple user accounts for multiple types of users. Homes with different populations: children, parents, guests, etc., have needs for this functionality in a way that maybe the more-familiar home concept with a single occupant or pair of domestic partners doesn’t need so much.

I’m sorry, but the concept of examples has been beaten to death… look at the post directly above yours (which incudes real world examples). People have been posting various examples for years. Either the OHF draws a line in the sand as to what the target date for RBAC is… or we all just keep posting this WTH over, and over, and over again.

Don’t apologize for your opinion, it’s just as valid as mine. But I am still gonna encourage repetition: it’s a valid practice in education. I believe it’ll eventually sink in. (Or if not, maybe more of the decision makers will start families of their own someday and first-hand knowledge will prevail.)

Arguably not crucial in most households. But the ones who do need it should have it, of course, because delimiting access is something that belongs in a system like this. And (although they may not be the focus) in commercial environments if you want to use HA, access controls become quite necessary.

I read all 38 posts and then went looking in core and the docs. This is my take on it:

  1. HA has had a permission model since 0.82 in November 2018, and most of it is enforced.

    Groups with policies per area, device, domain and entity with read, control and edit (code). The developer docs still call it “not enabled or enforced yet”, but that is out of date: service calls, state reads, state events and history are all filtered today. What is missing is a short and specific list: no deny rules, no way to create a group without editing a storage file, and a handful of read paths with no check (logbook, templates over WebSocket, the entity registry list, the camera proxy). So the model was never the blocker. Finishing it is. Roles and a UI on top of the holes give us a nicer settings page and a false sense of safety.

  2. Nobody here asks for roles.

    You ask for “my daughter controls her own lights”, “the cat sitter sees two cameras”, “the kids’ tablet must not show the cameras”. That is scope: which things, for whom. And it has to hold through every door: history, Assist, the phone app. Steets and Lubinko said it already.

  3. Scripts are where roles break down.

    When a family member presses a dashboard button, does the script run with her rights or with the rights of the admin who wrote it? With hers, things break. That is what the mqtt.publish change did in 2026.10 (post 8). With the admin’s, a sloppy script is a hole. Roles have no answer. The script needs a narrow permission of its own and the user needs only the right to run it.

  4. Add a small fourth: access that expires, for guests.

On “quick fix now” vs. “do it right” (posts 22 and 23): I think that’s a false choice. Do it right, in slices that are each complete, using this simple plan, for example:

  1. Write down the threat model: family and guests with a login, not hostile code. Integrations stay trusted, which answers Sir_Goodenough’s worry in post 7.
  2. Finish the 2019 audit: every check goes through one place. Nothing changes for anyone.
  3. Add scopes for non-admin users with a UI. That covers nearly every example in this thread.
  4. Give scripts their own permissions.
  5. Add expiry and other conditions.

No policy set means HA behaves as today, at every step.

Step 0 needs no code. It is what the working group ChrisQXR asked for could start on tomorrow. Nothing here happens unless the project owns it, as frenck made clear in discussion 1374. But “it touches everything” is a reason to slice it, not a reason to wait.

So if you want the textbook labels, step 2 is relationship based (ReBAC), 3 is capability based (CapBAC) and 4 is attribute based (ABAC). I do not care what we call it as long as we stop calling it RBAC. That name describes the part core has had since 2018.

I run three properties in one instance so this is not academic for me. Happy to help with step 0.

The technical plan for core developers is in the next post: hybrid authorization plan

Technical plan referred to in my previous post.

Technical plan for HA Core devs: a hybrid authorization architecture (click to expand)

This technical plan was written with heavy help from Claude Fable 5.2 MAX (Anthropic) with a 1M token context window, which analyzed and searched a complete copy of the full core source tree at commit 5ef31b7, analyzed the permission related parts in detail. I decided the structure and the extent of the gap analysis myself, and I have reviewed the content. Please treat the architecture design parts as a starting point for discussion rather than finished work. [It cost me a full day of usage quota, so consider it my contribution to the Month of WTH.]

TL;DR

This is a purely technical proposal. It says nothing about priorities, funding or who should do the work. It only answers: if core wanted per-user access control, what could the architecture look like and how could it land without breaking anyone?

  • Core already enforces entity policies on service calls and on most state reads. The work is closing a known list of gaps, not building from zero.
  • One authorize() function in front of the checks core already does. The natural place is ServiceRegistry.async_call plus the two admin decorators.
  • Three evaluators behind it: relations (who may touch which entity), capabilities (what a script may do on a user’s behalf) and conditions (when a grant is valid).
  • No policy configured means exactly today’s behaviour.
  • Six small phases. Each can merge and ship alone. The first two change no behaviour for existing installs.

Two open problems could change this plan: user-aware template rendering and calls that carry no user. Both are described in their own section below and should be answered before phase 3 is promised.

All code references are to commit 5ef31b7 (dev, 2026-11-11).

Scope and threat model

The design protects against people with a valid login who use the normal clients: family members, guests, a cat sitter.

In scope: service calls, state reads and subscriptions, history and logbook, templates rendered for a user, WebSocket and REST commands, the companion app, scripts and automations as actors.

Out of scope: code running inside the core process. Integrations, custom components and apps stay trusted. Authorization is not a sandbox. Also out of scope: authentication, SSO, multi-tenant hosting and a finer split of admin rights (see the admin section).

What core has today

The entity policy model is real and enforced in more places than the developer docs suggest. The gaps are specific and listable.

Already in place

What Where Behaviour
Policy format entities.py L15-L44 Keys entity_ids, device_ids, area_ids, domains, all. Values read, control, edit. Only True is valid
Precedence entities.py L100-L105, util.py L72-L77 Entity, then device, then area, then domain, then all. First answer wins
Group merge merge.py L26-L32 Most permissive wins
Entity services service.py L711-L718, L662-L681 Non-admin with a user_id: explicit target without control raises, “all” targets are filtered
Admin services service.py L1010-L1014 is_admin or Unauthorized
State reads commands.py L403-L414, L157-L170, api L219-L226 get_states, state events and REST states are filtered on read
History history/websocket_api.py L143 Filtered through filter_entity_ids_by_permission

Verified gaps

Gap Where Effect
No deny Schema accepts only True, merge is most permissive “Everything except the cameras” cannot be expressed
Default is everything system_policies.py L5-L9 The Users group has entities: True
No group management config/auth.py L89 The API can assign group_ids but cannot create a group or edit its policy
No user means no check service.py L711, L1010 Both checks sit under if call.context.user_id
Scripts run as the caller script/entity.py L427, helpers/script.py L1091-L1096 The caller’s context is passed to every action. This is why mqtt.publish fails for non-admins
Automations run as nobody automation/entity.py L486-L487 New Context(parent_id=...) without a user, so fully trusted
Generic services 359 plain services.async_register( calls against 123 async_register_admin_service( in components No central check. Example: shell_command L175
Templates over WebSocket commands.py L804-L816 render_template has no admin or entity check. The REST twin is admin only (api L503)
Logbook logbook/websocket_api.py L247-L257 No reference to the user’s permissions in the logbook files
Entity registry list config/entity_registry.py L39-L43 Not admin gated and not filtered
Camera proxy camera/__init__.py L326-L345 Any authenticated user passes. The camera component never calls check_entity
Admin is binary 75 files use the WebSocket require_admin, 14 the HTTP one, 58 register admin services One flag: models.py L92-L96

Architecture

One decision function with three evaluators and today’s checks as the fallback. It is one pipeline and not three access control systems.

enforcement points
  ServiceRegistry.async_call        every service call, entity or not
  websocket / http require_admin    admin commands and views
  read helpers                      states, events, history, logbook, templates
        |
        v
  authorize(request)
        |
        +-- 1 relation evaluator     who may touch this resource      ALLOW / DENY / ABSTAIN
        +-- 2 capability evaluator   may this principal do this call  ALLOW / ABSTAIN
        +-- 3 condition evaluator    is the grant valid right now     can turn ALLOW into DENY
        +-- 4 legacy adapter         today's check_entity / is_admin  used when all abstain
        |
        v
  decision + reason code  -->  audit log

The request

@dataclass(frozen=True, slots=True)
class AuthzRequest:
    actor: str | None          # user_id that started the chain, None = system
    principal: str | None      # entity_id of the script or automation executing, None = the actor
    action: str                # "read", "control", "edit", "call:mqtt.publish", "admin:<op>"
    resource: tuple[str, str]  # ("entity", id), ("service", "domain.name"), ("config", key)
    attrs: Mapping[str, Any]   # rendered service data and resolved targets

Resolution rules

  1. A DENY from any evaluator wins.
  2. If every evaluator abstains the legacy adapter decides. This is what makes “no policy” identical to today.
  3. A capability ALLOW may lift an admin-only restriction only for services registered as delegable.
  4. Admins and the owner short-circuit to ALLOW exactly as now.
  5. In enforced mode an evaluator error means DENY. In shadow mode it means the legacy result plus a log entry.

Why ServiceRegistry.async_call

Every call builds its ServiceCall in one place (core.py L3012-L3014). A check there covers the 359 generic service registrations that have no check today, without touching one integration. The entity resolver keeps doing the per-entity filtering it already does.

The three evaluators in one line each

  • Relations (ReBAC): the existing entity policy, extended with deny, labels and a services category. Details under policy semantics.
  • Capabilities (CapBAC): a grant attached to a script or automation that names exactly which privileged call it may make. Details under carrying the principal.
  • Conditions (ABAC): valid_until on a group membership or a grant. Time windows later. No state based conditions in the first version because the state can change between check and execution.

Does the hybrid hold together?

Yes, on one condition: the three models are inputs to one function and share one request type. Built as three subsystems it would not be worth the cost. Relations cover nearly every request in the forum thread. Capabilities are the risky part, so they come late and only for services that opt in.

Carrying the principal

Recommendation: add an optional principal to ServiceCall and leave Context alone.

Today a service call knows only context.user_id and context.parent_id (core.py L1348-L1364). It cannot tell “Emma called this” from “a script Emma started called this”.

Option How Verdict
A. Field on Context Context.principal Rejected. A script reuses the caller’s Context object for all its actions, so it would need a child context per run. That changes the id chain the logbook uses for attribution, and Context is serialised into events
B. Field on ServiceCall hass.services.async_call(..., principal="script.open_garage") Recommended. Never serialised, never accepted from a client, two call sites to change
C. Infer from parent_id Walk the context chain Rejected. Ambiguous and forgeable by anything that can create a context

What option B touches:

Rules:

  • actor is always context.user_id. principal defaults to the actor.
  • A nested script sets its own principal. Nothing is inherited.
  • Device actions and events fired by a script carry no principal and are judged on the actor alone. That is the safe default.
  • In-process code can pass any principal. That is accepted: such code can already call with no user and skip every check.

Capabilities, in two steps

Step one is coarse and cheap: an admin marks a script as elevated. Its actions are then judged as if no user were present, which is exactly how automations behave today. It makes the existing input_button plus automation workaround explicit and auditable.

Step two is fine grained grants, for scripts that take input:

# stored per script entity, editable by admins only
grants:
  - service: mqtt.publish
    data:
      topic: garage/door/set
      payload: OPEN
      retain: false
  • Matched against the rendered service data at call time. Templates are never analysed statically.
  • Needs an opt-in at registration, for example async_register_admin_service(..., delegable=True).
  • “May run the script” needs nothing new. It is control on the script entity.

Policy semantics

Keep today’s allow logic byte for byte and add deny as a separate layer that always wins.

Today: each group has an allow policy, a user’s policy is the most permissive merge of their groups, and lookup goes entity, device, area, domain, all with the first answer winning. That cannot express a deny, and making False a value inside the same tree would fight the “most permissive wins” merge.

Proposed evaluation for a non-admin user:

  1. Collect deny rules from all the user’s groups (union).
  2. If any deny rule matches the entity at any level for this permission: DENY.
  3. Otherwise run the existing allow logic unchanged.
# group "kids"
policy:
  entities:
    area_ids:
      emma_room: {read: true, control: true}
    label_ids:
      shared_lights: {read: true, control: true}
  deny:
    entities:
      domains:
        camera: {read: true, control: true}
  services:
    allow: [script.turn_on, light.turn_on, light.turn_off]

Design choices:

  • Deny always wins. A narrow allow does not override a broad deny. It is order independent and easy to explain. The cost is that “deny the garage except one light” needs the light left out of the denied set.
  • Two ways to scope. “Only her room” is a group with a narrow allow and no membership in Users. “Everything except cameras” is Users plus a group with a deny. Both are needed.
  • Labels join areas and devices as a key. They are the only way to scope entities that have no device.
  • Area lookup needs a fix. _lookup_area returns nothing for an entity without a device and ignores an area set on the entity itself (entities.py L53-L69). Helpers placed in an area would be invisible to an area policy.
  • Services category. Generic services have no entity to check. A scoped group lists the ones it may call. The Users group keeps “all” so nothing changes for existing users.
  • New entities follow their scope. In a scoped group they stay invisible until placed in an allowed area or labelled.
  • Admins are untouched. Deny rules never apply to an admin or the owner.

Read paths

Most state reads are already filtered. Four paths found so far are not, and templates are the hard one.

Path Today Plan
get_states, subscribe_entities, state events Filtered on read Route through the facade, no behaviour change
REST /api/states Filtered Same
History (WebSocket and REST) Filtered Same
Logbook stream and query No permission check found Filter entries by entity read
render_template over WebSocket No check See below
Entity registry list Unfiltered Filter to readable entities for non-admins
Camera and image proxy Any authenticated user Check read on the entity when the request is authenticated by user and not by token
Device and area registry, statistics, calendar, todo, media browsing, search Not surveyed Phase 0 inventory

Templates. The frontend renders templates for ordinary users, so making the command admin only would break dashboards. The template engine has no notion of a user. The proposal is a read filter bound to the render: when a render is started on behalf of a non-admin user, state lookups for entities without read behave as if the entity did not exist. Templates rendered by scripts, automations and template entities are not affected because they run without a user. This is the largest unknown in the plan and needs a prototype before anyone commits to it.

Cost. The state stream check runs per event per connection. It is already there for non-admins (commands.py L157-L170) and uses the compiled function cached on the permissions object. Deny adds one more compiled predicate. Admins keep the short circuit.

Storage and migration

Put everything new in a separate store and leave .storage/auth at version 1.

Groups and their policies live in the auth store (auth_store.py L28-L29). A user holds a plain list of group ids.

Data Where Why
Custom groups with allow policy Existing auth store, existing format Already supported on load. Only the API to create them is missing
Deny rules, labels key, services category New store, keyed by group id An older core never sees keys its schema would reject
Membership expiry New store, keyed by user id and group id The user record keeps its plain list
Elevated flag and grants New store, keyed by entity registry id Survives entity renames and keeps the script YAML schema untouched

Consequences to accept:

  • Downgrade fails open. An older core ignores the new store, so deny rules and expiry stop applying. This must be stated in the release notes. A repair issue on the next upgrade can remind the admin.
  • Rollback inside one version is deleting the policy in the UI. No policy is today’s behaviour.
  • Deleted entities, groups and users need a cleanup listener so the new store does not keep dangling ids.

The admin side and the frontend

Admin stays binary in this plan. Splitting it is a separate project. What the facade does is give every admin check a name instead of a bare boolean, for example admin:config_entries.edit. The HTTP decorator already accepts perm_category and permission (http/decorators.py L50-L53) and the config entries views use them. Naming the checks costs nothing now and is what a later “may edit dashboards” or “may edit automations in area X” would be built on.

What the frontend needs

Need Today Proposal
Know who the user is auth/current_user returns is_admin (auth/__init__.py L616) Unchanged
Hide what cannot be read Filtered states mean the entity does not exist for that client Nothing new. Cards already handle a missing entity
Disable controls on read only entities Not possible New command auth/permissions returning the user’s compiled scope, or a can_control flag in the entity subscription
Explain a refusal Unauthorized without a reason Reason code from the facade in the error
Manage groups and policies Hand editing .storage/auth Admin only WebSocket commands for group and policy CRUD plus a settings page

The companion apps use the same WebSocket API (mobile_app/helpers.py L125-L127 builds a context with the registration’s user) so they inherit the backend decisions. The frontend is never the control.

Worked examples

A child controls only her own room. Emma is in group “kids” and not in Users. The group allows read and control on area emma_room. light.emma_ceiling resolves to that area: ALLOW. light.noah_desk has no match: denied and filtered from her state stream, history and logbook.

Everything except the cameras. A teenager stays in Users and is added to a group with a deny on domain camera. The deny layer answers first. The camera proxy applies the same check.

A dashboard button that publishes MQTT.

Emma presses the button
  actor=emma principal=-      control script.open_garage        ALLOW  relation
script.open_garage runs
  actor=emma principal=script call:mqtt.publish topic=garage/.. ALLOW  grant matches, service delegable
Emma calls mqtt.publish herself
  actor=emma principal=-      call:mqtt.publish anything        DENY   legacy: admin only

A cat sitter for one week. The sitter’s membership in “cat care” has valid_until. After that date the condition evaluator turns every ALLOW from that group into DENY. The login still works and shows an empty home.

Two problems that could change this plan

The first is a technical risk: can it be built? The second is a design gap: what should the rule be? Neither is solved here.

1. Templates can read any state

  • What the code shows. The WebSocket command render_template has no admin check and no entity check (commands.py L804-L816). Its REST twin is admin only (api L503). A scoped user can send {{ states('camera.front_door') }} and read around every other filter.
  • Why the easy fix is unlikely to work. Making the command admin only would probably break dashboards, since the frontend renders templates for ordinary users. How widely it does so is not verified here.
  • What is needed. The template engine has to know on whose behalf it renders, and it has no such notion today. The proposal is a read filter bound to the render so that entities without read behave as if they did not exist.
  • What is unknown. Whether that can be done cleanly in the template state objects, what it costs per state access and what it breaks. It needs a prototype and a benchmark.
  • If it cannot be done. Phase 2 has a hole that cannot be closed and scoped accounts are not safe to offer.

2. Calls without a user are fully trusted

  • What the code shows. Both permission checks sit under if call.context.user_id (service.py L711 and L1010). No user means no check.
  • Who calls without a user. Automations always do (automation/entity.py L486-L487). A voice satellite falls back to an empty context (assist_satellite/entity.py L499). Anything triggered from outside without a login, such as a webhook trigger, ends up in an automation.
  • Why it matters. A scoped user who can trigger one of these acts with full rights. Emma may control only one input_button, but the automation behind it can do anything. Anyone in the room speaks to the satellite with full rights.
  • What is defensible. Automations: an admin wrote them, so the admin granted it. The UI should still show which automations a scoped group can trigger.
  • What is not. Voice. It needs a rule, for example a scope per satellite (“this device may control this area”), which fits the relation model but is not designed here.
  • What is needed. A decision per source: does it map to a user, to a device scope or does it stay trusted? Until then per-user scoping is easy to walk around.

Rollout in phases

Each phase is useful alone and none depends on a later one being accepted.

Phase Change Who notices Proof it is safe
0. Inventory Complete the gap tables above for every component that returns state or media. Add a lint rule that flags new direct is_admin and check_entity calls Nobody, no runtime code The list itself
1. Facade authorize() with only the legacy adapter. Call it from ServiceRegistry.async_call, both require_admin decorators and the read helpers. Reason codes and an audit hook Nobody Differential test: old and new decision compared across the whole test suite
2. Close read gaps Logbook, entity registry list, camera and image proxy, template read filter Only users already in a hand made custom group Existing tests plus one test per closed path
3. Relations Deny layer, labels, area lookup fix, services category, group and policy API, settings UI, shadow mode per group Only users an admin places in a custom group Shadow log shows what would be denied before it is enforced
4. Capabilities principal on ServiceCall. Elevated flag first, grants and delegable second. Pilot: mqtt.publish Only scripts an admin marks Adversarial tests: templated data, nested scripts, parallel runs
5. Conditions valid_until on memberships and grants Only where set Clock based tests

Phases 0 to 2 add no new concept. They finish what the 2018 model started and are the part worth an external review. Phase 3 is where users first see a feature.

Phase 3 should not be promised until the two problems above have an answer. Phases 0 to 2 do not depend on them, except that the template filter in phase 2 is itself the first of the two.

Alternatives considered

Alternative Why not
External engine as a service (OpenFGA, OPA) A network hop on every state event and service call. One more process to run on a Pi. If it is down the home either locks or opens
Embedded policy language (Rego, Cedar, Casbin) A new dependency and a language no user will write. HA’s graph is small and fixed: user, group, entity, device, area, label. The existing compiled dict policy already fits it
Reverse proxy in front of core (ha-rbac) Sees requests, not what a script does inside core. Must understand every WebSocket command, and an unknown new command passes by default. Good stopgap, wrong layer for the end state
Frontend only hiding Not access control. The companion app, shortcuts and the API still reach everything
More admin only services The mqtt.publish route. Safe but breaks legitimate dashboards because scripts run as the caller
All scripts run with the author’s rights Simple, and it is how automations work now. But every script becomes an escalation path and nothing records what was granted. Kept as the opt-in elevated flag in phase 4
Replace the policy model with roles Roles do not say which lamps. Scope by area and label is what the use cases need and what core already models

Gap analysis

What this plan still does not solve, ordered by how much it could hurt.

# Gap Why it matters What would close it
1 Template read filter is unproven Without it a scoped user reads any state through render_template. It is the one item that could sink phase 2 A prototype on the template state objects with a benchmark
2 Read surface is not fully mapped Device and area registries, statistics, calendar, todo, media browsing, search, traces, diagnostics and notifications are unsurveyed. One missed path is a leak Phase 0 as a real deliverable with a test per path
3 Calls without a user stay trusted Webhooks, voice satellites (assist_satellite/entity.py L499 falls back to an empty context) and automations all skip the checks. A scoped user who can trigger one of them acts with full rights Name system principals explicitly. Decide per source whether it maps to a user, a device owner or stays trusted
4 Voice has no clear actor A satellite in a shared room speaks for whoever is nearby A per satellite scope (“this device may control this area”) would fit the relation model. Not designed here
5 Automations amplify A user with control on one input_button can fire an automation that does anything By design, but the UI should show which automations a scoped group can trigger
6 Generic services need curation 359 registrations. A scoped group must list what it may call and nobody knows the safe set A reviewed default list shipped with core, or a safe_for_users flag at registration
7 Deny always wins may be too blunt No exceptions inside a denied set Accept for version one. Revisit with real feedback
8 Event allowlist leaks metadata Registry update events go to every user and carry entity ids (events.py L30-L50) Filter payloads for non-admins
9 Downgrade fails open New restrictions vanish on an older core Documented behaviour plus a repair issue
10 Grants and user input A granted script that forwards a field into the call is a confused deputy unless the grant pins the data Forbid wildcards in version one. Lint scripts whose granted call uses a field
11 Admin stays all or nothing No “teenager may edit her own dashboard” Out of scope here. The named checks from phase 1 are the hook
12 Apps and ingress Per user visibility of apps (post 4 in the thread) lives in the Supervisor integration Separate design
13 Cost is unmeasured Deny adds a predicate on the state stream. The template filter adds a lookup per state access Benchmarks in phases 2 and 3 on a large install
14 Authentication is untouched Trusted networks and shared tablets decide who the actor is before any of this runs Out of scope, but a scoped model is only as good as the login in front of it
15 No effort estimate Deliberate. Any number here would be a guess Phase 0 output makes an estimate possible

Verdict. Relations plus the closed read gaps are low risk and cover most real requests. Capabilities are sound in design but carry the security risk. Conditions are trivial once the rest exists. The two things that could change the plan are gap 1 and gap 3.