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
13 stars 5 forks source link

Error handling around environment parsing #644

Closed jw3 closed 1 year ago

jw3 commented 2 years ago
  1. Enter an environment that is not in K=V format, for example /home/dave/.cargo/bin
  2. Run the profiler
  3. Observe silent failure with stack trace in console
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/fapolicy_analyzer/ui/profiler_page.py", line 166, in on_test_activate
    self._fapd_profiler.start_prof_session(profiling_args)
  File "/usr/lib/python3.6/site-packages/fapolicy_analyzer/ui/faprofiler.py", line 257, in start_prof_session
    self.faprofSession = FaProfSession(dictArgs, self)
  File "/usr/lib/python3.6/site-packages/fapolicy_analyzer/ui/faprofiler.py", line 63, in __init__
    dictProfTgt["envText"]
  File "/usr/lib/python3.6/site-packages/fapolicy_analyzer/ui/faprofiler.py", line 50, in _comma_delimited_kv_string_to_dict
    for k, v in dict(x.strip().split("=") for x in string_in.split(",")).items()
ValueError: dictionary update sequence element #0 has length 1; 2 is required
tparchambault commented 1 year ago

Adding env string validation code to the current validation functions within faprofiler.py