From 06142c4c5763b9cdae7469c7fd42d09e0529a2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Wed, 19 Oct 2022 11:59:26 -0400 Subject: [PATCH] module_utils.modules: expose module.params as a readonly dict Use a MappingProxyType without backend to ensure the `module.params` dict is readonly. --- plugins/module_utils/modules.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/modules.py b/plugins/module_utils/modules.py index d05f63f9763..5871d16fa12 100644 --- a/plugins/module_utils/modules.py +++ b/plugins/module_utils/modules.py @@ -54,6 +54,7 @@ import os import re import traceback +from types import MappingProxyType try: from cStringIO import StringIO @@ -163,7 +164,7 @@ def __init__(self, **kwargs): @property def params(self): - return self._module.params + return MappingProxyType(self._module.params) def _get_resource_action_list(self): actions = []