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

Validate storage data from config and D-Bus #721

Closed
joseivanlopez opened this issue Aug 28, 2023 · 1 comment
Closed

Validate storage data from config and D-Bus #721

joseivanlopez opened this issue Aug 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@joseivanlopez
Copy link
Contributor

joseivanlopez commented Aug 28, 2023

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:

  • Sometimes we need quite similar validations when the settings are generated from the config file and from D-Bus.
  • The class Agama::Storage::ProposalSettingsReader reads the settings from config file.
  • The class Agama::DBus::Storage::ProposalSettingsConversion::FromDBus reads the settings from D-Bus data.

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
Copy link
Contributor Author

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.

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

No branches or pull requests

1 participant