Closed trappitsch closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e7797c0
) 99.03% compared to head (be0261f
) 99.12%. Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Any ideas?
Nope, I'm not familiar with the process by which we would need to register classes for yaml.
Well, I'm gonna play with this more. The current implementation is as unsafe/safe (depending on your standpoint) as before. Being able to register classes would definitely help this. Might have to play with some actual hardware to figure out why the test don't pass in my first tests with this.
So, looking at this in more details, it seems like we are not loading classes (which could be excepted from the safe loader), but we are loading module.name with !!python/name
tags. The only way I can see to get this to work without restructuring a lot is to use typ="unsafe"
in the loader.
We have the following comment in the docstring of config.load_instruments
:
.. warning::
The configuration file must be trusted, as the class name references
allow for executing arbitrary code. Do not load instruments from
configuration files sent over network connections.
Note that keys in sections excluded by the ``conf_path`` argument are
still processed, such that any side effects that may occur due to
such processing will occur independently of the value of ``conf_path``.
The previous version with the older ruamel.yaml
used unsafe loading by default.
Added some tests to fully cover the config.load_instruments
. However, submitting to codecov seems to be failing... the latest action is v4
(here) and we are using v2
. Could this be an issue?
As far as I can tell, v2 is still supported, I only see reports that v1 doesn't work anymore as of 2022.
let's see if it's just flaky...
Here we go :)
Part of #406
Currently I'm using the
unsafe
loader, which would be okay since the docs specify that this is not safe for files you don't trust.However, we could try and register all
ik
classes with the yaml loader, see here. Scratching my head at the moment though why I can't even get the tests to run when I registerinstruments.Instrument
withAny ideas?