ctc-oss / fapolicy-analyzer

Tools to assist with the configuration and management of fapolicyd.
https://ctc-oss.github.io/fapolicy-analyzer
GNU General Public License v3.0
12 stars 5 forks source link

Config changes from saved sessions do not restore #917

Closed jw3 closed 11 months ago

jw3 commented 11 months ago

Test

  1. Save a session file that contains a trust, rule, and config modification.
  2. Restore
  3. Observe that the trust and rule are restored while the config quietly is not.

The trust record is serialized as a dict, the rule and config as strings.

The application is attempting to use nested exception handling to derive the flavor of string being deserialized from the session file.

https://github.com/ctc-oss/fapolicy-analyzer/blob/master/fapolicy_analyzer/ui/changeset_wrapper.py#L35-L59

The root deficiency here lies in the format of the session file. A new format that includes a type discriminator should be defined. At that time the deserialize function can be rewritten to match.

tparchambault commented 11 months ago

We originally used a dict because of the supported translation to/fro json. Can we embed the strings into a dict so that we can maintain the json session file format? *-ish? Maybe that's a higher level dict now comprised of two sub-dicts? In any event, I'd like to maintain the json file format if possible.