-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tempest] Fix special chars in TEMPESTCONF_OVERRIDES #212
[tempest] Fix special chars in TEMPESTCONF_OVERRIDES #212
Conversation
Fix a regression introduced in PR openstack-k8s-operators#210 in which strings with special bash characters need to be escaped: cubswin:) has to be cubswin:\). The need to escape some characters breaks existing CI jobs. This patch fixes the regression so it's not necessary to escape special characters.
$* | ||
EOF | ||
} | ||
|
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.
this seam to work as indended
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:41:46]❯ ln -s /bin/echo .local/bin/discover-tempest-config
~ via 🐹 v1.20.12 via 🐍 v3.11.9
00:41:58]➜ function discover_tempest_config {
cat <<EOF | xargs discover-tempest-config
$*
EOF
}
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:04]➜ discover_tempest_config test
test
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:07]➜ discover_tempest_config test:)
bash: syntax error near unexpected token `)'
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:10]❯ data="test:)"
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:30]➜ discover_tempest_config ${data}
test:)
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:39]➜ data="test :)"
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:57]➜ discover_tempest_config ${data}
test :)
~ via 🐹 v1.20.12 via 🐍 v3.11.9
at least if the charters that need to be escapes are in a variable
or they are quoted when being passed to the function directly.
[00:42:58]➜ discover_tempest_config '${data}'
${data}
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:42:58]➜ discover_tempest_config '${data}'
${data}
~ via 🐹 v1.20.12 via 🐍 v3.11.9
interpolation or not of variable in string also works
[00:45:31]❯ data="test; echo do bad thing :("
~ via 🐹 v1.20.12 via 🐍 v3.11.9
00:47:04]➜ discover_tempest_config "${data}"
test; echo do bad thing :(
~ via 🐹 v1.20.12 via 🐍 v3.11.9
[00:47:08]➜ discover_tempest_config ${data}
test; echo do bad thing :(
it also prevent basic exploites like adding ; shell injection goes here
not that it nessicaly safe but i think this is safer then eval too.
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.
lgtm
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.
LGTM! 👍
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ASBishop, bshephar, gibizer, lpiwowar, mrkisaolamb, rabi, SeanMooney The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
3a65137
into
openstack-k8s-operators:main
Fix a regression introduced in PR #210 in which strings with special bash characters need to be escaped: cubswin:) has to be
cubswin:\)
. The need to escape some characters breaks existing CI jobs.This patch fixes the regression so it's not necessary to escape special characters.