From 45d070ba3ad417807388fe8063fcd5213f85547b Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 4 Mar 2016 14:41:35 -0500 Subject: [PATCH] reject extraneous data passed to mode strictly permissions are allowed, file type info should not be passed in alternate fixes #14771 --- lib/ansible/module_utils/basic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 1939fa72c31..ac2ceb84a5b 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -863,6 +863,10 @@ class AnsibleModule(object): msg="mode must be in octal or symbolic form", details=str(e)) + if mode != stat.S_IMODE(mode): + # prevent mode from having extra info orbeing invalid long number + self.fail_json(path=path, msg="Invalid mode supplied", details=str(e)) + prev_mode = stat.S_IMODE(path_stat.st_mode) if prev_mode != mode: