Created
November 23, 2023 13:06
-
-
Save hartraft/c7c0c725b0a25b3ef28697e2ef630f7e to your computer and use it in GitHub Desktop.
However, it's essential to use eval with caution because it can introduce security risks, especially if the input to eval is not sanitized properly. If the content being evaluated includes user input or external data, there's a risk of code injection. Avoid using eval with untrusted input. Here's an example of a risky use of eval:
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
#!/bin/bash | |
user_input="; rm -rf /" | |
# This is dangerous! | |
eval "echo Hello $user_input World" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment