nasa / CTF

This is a new repository for a new tool to be added to the cFS ecosystem called cFS Test Framework (CTF).
27 stars 6 forks source link

possible KeyError #42

Closed snoyes closed 1 year ago

snoyes commented 2 years ago

https://github.com/nasa/CTF/blob/982311047cc2417ecdeaebed97ab8d967f40411d/lib/readers/json_script_reader.py#L195-L198

If command has no key 'params', then the variable params will be None (once issue #41 is fixed), so the condition on line 195 will prevent line 196 from setting command["params"]. Therefore on line 198, command["params"] may raise a KeyError.

A solution is to eliminate the if params is not None condition in line 195, so that line 196 always sets command["params"] to the sanitized params, even if it sets it to None. Then 198 will never produce a KeyError.

blueoceanwater commented 1 year ago

Thank you for reporting the issue and for contributing the code fix. We do not have a legal process in place to accept coding contributions from our end-users at this time. Hence, we will implement our own fix for it and will make it available for CTF v1.7 release. But please continue to report issues to help us improve the tool for everyone.