Repository navigation
Adds new integration [jeromelefeuvre/ha-disk-usage-explorer] - #13363
jeromelefeuvre wants to merge 1 commit into
Conversation
8cd9d00 to
b6e34ef
Compare
frenck
left a comment
There was a problem hiding this comment.
Hi @jeromelefeuvre, thanks for the submission! 👋
One thing needs to change before this can go in.
- The
scan,cancel,browseandsuggest_directoriesservices are registered withhass.services.async_registerincustom_components/disk_usage_explorer/__init__.py(lines 65 to 85), so any logged-in Home Assistant user can call them, admin or not.browsereturns the full file and folder tree (names and sizes) below the configured roots andsuggest_directorieslists subfolders. The roots default to/mediaand/config(config_flow.pyline 15) and are only checked as "existing absolute directory" (config_flow.pylines 52 to 64), not againsthass.config.is_allowed_path. A non-admin user can therefore map everything in the config directory. Please do one of these:- register the four services with
homeassistant.helpers.service.async_register_admin_service(it acceptssupports_response), or - check every configured root in the config flow and every requested path in
_resolve_scan_pathwithhass.config.is_allowed_path, and drop/configfrom the default.
- register the four services with
Once that is addressed, push a new release and re-request review.
../Frenck
Blogging my personal ramblings at frenck.dev
Or subscribe to my free bi-weekly newsletter: frenck.dev/newsletter
All four actions are now registered with async_register_admin_service, so only administrators (and automations, which run without a user) can scan or list folders. The config flow now suggests only /media. The card shows a notice instead of the path field to non-admin users, and the README warns about allowing /config. Requested in hacs/default#13363. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review! Addressed in v0.3.2 (commit):
I updated the release and action links in the description. 🤖 Generated with Claude Code |
b6e34ef to
885f17a
Compare
|
While you review, I ran a security pass of my own and released v0.3.3:
The description links point to v0.3.3. 🤖 Generated with Claude Code |
frenck
left a comment
There was a problem hiding this comment.
Hi @jeromelefeuvre, thanks for the quick turnaround on the admin-only services, that earlier ask is settled in v0.3.3.
One thing is left. DiskScanner.__init__ in custom_components/disk_usage_explorer/scanner.py (line 88) calls Path(root).resolve() for every configured root, and async_setup_entry in custom_components/disk_usage_explorer/__init__.py (line 96) builds the scanner directly on the event loop. Path.resolve() walks the path with filesystem calls, so on slow or network-mounted storage (a NAS share under /media, for example) setup stalls the whole event loop, blocking every other integration. The roots are already resolved and validated in _validate_roots in the config flow, so you can drop the .resolve() in __init__ and use Path(root). If you prefer to keep a second resolve as a safety net, do it in the executor with await hass.async_add_executor_job(...) before creating the scanner.
Once that is addressed, push a new release and re-request review.
../Frenck
Blogging my personal ramblings at frenck.dev
Or subscribe to my free bi-weekly newsletter: frenck.dev/newsletter
Checklist
Links
Link to current release: https://github.com/jeromelefeuvre/ha-disk-usage-explorer/releases/tag/v0.3.3
Link to successful HACS action (without the
ignorekey): https://github.com/jeromelefeuvre/ha-disk-usage-explorer/actions/runs/41948848607/job/126987697036Link to successful hassfest action (if integration): https://github.com/jeromelefeuvre/ha-disk-usage-explorer/actions/runs/41948848607/job/126987697345
Disk Usage Explorer is an integration with a bundled dashboard card: it scans a folder in read-only mode and shows disk usage as an interactive donut chart.
🤖 Generated with Claude Code