From dc3cfd30232a866d824721efb151ac558bc3b32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 11 Dec 2023 14:38:25 -1000 Subject: [PATCH] Fix detection of insecure interpolations in unless parameter When using the `unless` parameter of an `exec` resource with unsafe string interpolation, the linter should warn about the issue. It happen that it currently doesn't because unless is also a keyword. Adjust the linter to cope with this. --- lib/puppet-lint/plugins/check_unsafe_interpolations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet-lint/plugins/check_unsafe_interpolations.rb b/lib/puppet-lint/plugins/check_unsafe_interpolations.rb index 33838f1..480493c 100644 --- a/lib/puppet-lint/plugins/check_unsafe_interpolations.rb +++ b/lib/puppet-lint/plugins/check_unsafe_interpolations.rb @@ -33,7 +33,7 @@ def check_unsafe_title(title) def check_unsafe_interpolations(command_resources) command_resources[:tokens].each do |token| # Skip iteration if token isn't a command of type :NAME - next unless COMMANDS.include?(token.value) && token.type == :NAME + next unless COMMANDS.include?(token.value) && (token.type == :NAME || token.type == :UNLESS) # Don't check the command if it is parameterised next if parameterised?(token)