← Back to issue list

home interface plug attribute "read: all" triggers ValidationError

View original Github issue

Metadata

Project
snapcraft
Number
#5171
Type
issue
State
open
Author
florcabral
Labels
Created
2024-12-07 22:18:28+00:00
Updated
2024-12-12 17:12:52+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description Snapcraft fails to compile a snap when trying to use the home interface plug attribute "read: all". This ValidationError is thrown: `Input should be a valid list [type=list_type, input_value={'home': {'read': ['all']}}, input_type=dict]`. The "read: all" feature seems to be introduced by [this MR](https://github.com/canonical/snapd/pull/5016), and is documented in the [home interfaces](https://snapcraft.io/docs/home-interface) doc. Its description is "read (plug): optional, when set to ‘all’, also allows reading non-hidden files in the home directories of all users as traditional file permissions allow." If the plug is defined separately, a warning is issued: INFO snap "os-release" has bad plugs or slots: home-all (home plug requires "read" be 'all'), but no access to home is given. Ie, ``` plugs: home-all: interface: home read: [all] ``` ### To Reproduce Try to build a snap (ie, simple example provided below, taken from [snapcraft docs](https://snapcraft.io/docs/defining-a-command)) using the home interface's read attribute: ``` plugs: home: read: all ``` ### Environment Ubuntu 24.04, LXD ### snapcraft.yaml ```yaml name: os-release base: core22 version: '0.2' summary: Outputs the contents of /etc/os-release description: Prints the contents of os-release grade: stable confinement: strict apps: part-os-release: command: bin/os-release.sh plugs: home: read: [all] parts: part-os-release: plugin: dump source: . organize: os-release.sh: bin/ ``` ### Relevant log output ```shell $ snapcraft Traceback (most recent call last): File "/snap/snapcraft/13008/bin/snapcraft", line 8, in <module> sys.exit(main()) File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/application.py", line 485, in main return cli.run() File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/cli.py", line 252, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/cli.py", line 225, in _run_dispatcher dispatcher.run() File "/snap/snapcraft/13008/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 494, in run return self._loaded_command.run(self._parsed_command_args) File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/commands/core22/lifecycle.py", line 266, in run super().run(parsed_args) File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/commands/core22/lifecycle.py", line 139, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft/13008/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 102, in run project = models.Project.unmarshal(yaml_data_for_arch) File "/snap/snapcraft/13008/lib/python3.10/site-packages/craft_application/models/base.py", line 61, in unmarshal return cls.model_validate(data) File "/snap/snapcraft/13008/lib/python3.10/site-packages/pydantic/main.py", line 596, in model_validate return cls.__pydantic_validator__.validate_python( pydantic_core._pydantic_core.ValidationError: 1 validation error for Project apps.part-os-release.plugs Input should be a valid list [type=list_type, input_value={'home': {'read': ['all']}}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/list_type ``` ### Additional context _No response_

Evaluation history

No evaluation history available.