Make sure that all no_log parameters are processed even if some arguments have values of the wrong type - #81672
Make sure that all no_log parameters are processed even if some arguments have values of the wrong type#81672felixfontein wants to merge 1 commit into
Conversation
bcoca
left a comment
There was a problem hiding this comment.
code lgtm, but would like a test to avoid regressions
|
@bcoca it is impossible to test this situation without having #81631 merged, since the bug fixed by #81631 makes the module crash when the code from this PR adds an error message. Basically the test fixed in 1e61657 serves as a regression test for this PR - but only when #81631 is merged, since without it that test passes because the module crashes, and not necessarily because the code touched in this PR is correct. |
| bugfixes: | ||
| - argument spec validation - make sure that all ``no_log`` parameters are processed even if some arguments have values of the wrong type (https://github.com/ansible/ansible/pull/81672). |
There was a problem hiding this comment.
Since this is just a preventative measure, this should probably be a minor_changes fragment.
| bugfixes: | |
| - argument spec validation - make sure that all ``no_log`` parameters are processed even if some arguments have values of the wrong type (https://github.com/ansible/ansible/pull/81672). | |
| minor_changes: | |
| - argument spec validation - process all ``no_log`` parameters recursively before validating the argument spec (https://github.com/ansible/ansible/pull/81672). |
There was a problem hiding this comment.
Once #81631 or something equivalent is merged, this fixes a real CVE-worthy bug.
The only reason this isn't a bug right now is that a crash in another part is preventing this bug to have any effect. It is still a bug IMO.
…ents have values of the wrong type.
| def _list_no_log_values(argument_spec, params, errors=None): | ||
| """Return set of no log values | ||
|
|
||
| :arg argument_spec: An argument spec dictionary |
There was a problem hiding this comment.
errors missing among the params here?
SUMMARY
Currently the
no_logvalue processing terminates prematurely if values that should be dictionaries or lists of dictionaries have the wrong type. This can cause values passed tono_logparameters to show up in logs. The reason why that doesn't happen right now is another bug which makes argspec validation crash in that case later on (that bug is fixed in #81631). See the discussion in #81631 for details.The patch was provided by @s-hertel in #81631 (comment), I added a changelog fragment and refactored the code slightly to remove code duplication.
ISSUE TYPE