mirror of https://github.com/k3s-io/k3s
Validate KUBE_USER and KUBE_PASSWORD early on
Make sure KUBE_USER and KUBE_PASSWORD contains valid chars as soon as we read them from kube config.pull/6/head
parent
acea7040bc
commit
07d98bebe8
|
@ -257,6 +257,16 @@ function load-or-gen-kube-basicauth() {
|
|||
if [[ -z "${KUBE_USER:-}" || -z "${KUBE_PASSWORD:-}" ]]; then
|
||||
gen-kube-basicauth
|
||||
fi
|
||||
|
||||
# Make sure they don't contain any funny characters.
|
||||
if ! [[ "${KUBE_USER}" =~ ^[-._@a-zA-Z0-9]+$ ]]; then
|
||||
echo "Bad KUBE_USER string."
|
||||
exit 1
|
||||
fi
|
||||
if ! [[ "${KUBE_PASSWORD}" =~ ^[-._@#%/a-zA-Z0-9]+$ ]]; then
|
||||
echo "Bad KUBE_PASSWORD string."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function load-or-gen-kube-bearertoken() {
|
||||
|
|
Loading…
Reference in New Issue