Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The entry is not whitelisted if it is a symbolic link to a directory #31238

Closed
dmak opened this issue Jan 28, 2020 · 6 comments
Closed

The entry is not whitelisted if it is a symbolic link to a directory #31238

dmak opened this issue Jan 28, 2020 · 6 comments
Labels

Comments

@dmak
Copy link
Contributor

dmak commented Jan 28, 2020

The problem

Given the following filesystem symlink:

# ls -ld /var/lib/homeassistant/.homeassistant
lrwxrwxrwx 1 root root 25 Jan 27 01:37 /var/lib/homeassistant/.homeassistant -> .homeassistant.2020-01-27

and the following YAML:

homeassistant:
  whitelist_external_dirs:
    - /var/lib/homeassistant/.homeassistant

sensor:
  - platform: filesize
    file_paths:
      - /var/lib/homeassistant/.homeassistant/home-assistant_v2.db

it is expected that sensor is correctly started, however the following error is reported:

[homeassistant.components.filesize.sensor] Filepath /var/lib/homeassistant/.homeassistant/home-assistant_v2.db is not valid or allowed

The following change in the configuration makes the sensor working:

whitelist_external_dirs:
  - /var/lib/homeassistant/.homeassistant.2020-01-27

It is expected that symlinks in whitelist_external_dirs are correctly expanded / handled.

Environment

Home Assistant version: 1.102.2
Operating system: Debian Linux x64
Other: forum post

@pnbruckner
Copy link
Contributor

Looks like maybe this code (in Config.is_allowed_path(), in homeassistant.core):

https://github.com/home-assistant/home-assistant/blob/e9e44dbd974220067fa667ca01896b7975a44a6e/homeassistant/core.py#L1321

should be:

                thepath.relative_to(pathlib.Path(whitelisted_path).resolve())

But that is fairly basic and it looks like it's been this way (i.e., not resolving the white listed paths) since the configuration option was added three years ago. But then again, maybe that was an oversight.

@pvizeli, what do you think? Should the white listed paths be resolved to handle links?

@stale
Copy link

stale bot commented Apr 29, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 29, 2020
@dmak
Copy link
Contributor Author

dmak commented Apr 29, 2020

The issue is still present in v0.106.5.

@stale stale bot removed the stale label Apr 29, 2020
@stale
Copy link

stale bot commented Jul 29, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 29, 2020
@dmak
Copy link
Contributor Author

dmak commented Aug 3, 2020

The issue is present in v0.111.4.

@stale stale bot removed the stale label Aug 3, 2020
@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants