-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prior to this commit there was a possibility that malformed strings could be passed in to the resource. This could lead to unsafe executions on a remote system. The parameters that are susceptible are `install_secret_file`. This commit fixes the above by adding validation to ensure the given values confirm to expectation. `secret_file` is validated with a regular expression that ensures the given value is a valid path.
- Loading branch information
Showing
4 changed files
with
4 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
ignore: [] |
90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er. what's going on here? you take a command that was split up in multiple elements of an array and just merge it all together in one list? and then the hardened part is basically the commadn
test -f /.mysql_secret
?seems like a missed opportunity here...
90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anarcat PRs are welcome! Alternatively, open an issue and we can get this refactored.
90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, of course... i'm a little busy trying to mitigate #1513 in puppet 5 right now, which involves basically rolling back this patch and a few others... ;) so this is a little far down my list of priorities, unfortunately...
90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A safer technique than interpolating Puppet variables into shell commands is to let the shell do the interpolation itself.
The above code is safe for all possible characters in
$secret_file
.90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's worse is that the patch removes the empty password which is set, so it will prompt interactively for a new password! Also it doesn't solve the potential problem with whitespace in the install password. The below version fixes the issues. It keeps the extraction of only last word of secret, but it could be replaced by a
cat
if desired.90168d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good morning!
Some good suggestions here @kjetilho.
Would you mind putting them in to a new issue (if it’s not already)? It will be much easier to track also it’s much more visible to others.
Thank you!