Skip to content

Commit

Permalink
Fix detection of insecure interpolations in unless parameter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smortex committed Apr 8, 2024
1 parent b35bc5f commit 7b7b42d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/plugins/check_unsafe_interpolations.rb
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7b7b42d

Please sign in to comment.