agama-project / agama

A service-based Linux installer
https://agama-project.github.io/
GNU General Public License v2.0
143 stars 43 forks source link

Validate storage data from config and D-Bus #721

Closed joseivanlopez closed 6 months ago

joseivanlopez commented 1 year ago

The settings for calculating a new proposal are generated from the config file for the initial proposal and from D-Bus for new proposals. In both cases, the provided data is not validated at all. That means that a wrong type could be given for a setting, or even unknwon settings could be passed.

All those issues should be validated and somehow reported. Maybe logging issues and using proper defaults is ok.

Some notes:

Crazy idea: perhaps, we could have an intermediate representation of the settings (e.g., Agama::Storage::RawProposalSettings). The settings from config file and from D-Bus would be converted to raw settings without any kind of validation. Then, the raw settings would be conveted to the real proposal settings, performing all validations and using proper default values. In that way, we don't need to check things twice.

joseivanlopez commented 6 months ago

Type validations were added to the proposal settings from D-Bus. And the config files are under our control, so I think it is enough.