Skip to content
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

fix: escape keycloak password to improve shell compat #857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deployment/terraform/keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (t *Terraform) setupKeycloak(extAgent *ssh.ExtAgent) error {
}

// Authenticate as admin to execute keycloak commands
_, err = sshc.RunCommand(fmt.Sprintf("%s/kcadm.sh config credentials --server http://127.0.0.1:8080 --user %s --password %s --realm master", keycloakBinPath, t.config.ExternalAuthProviderSettings.KeycloakAdminUser, t.config.ExternalAuthProviderSettings.KeycloakAdminPassword))
_, err = sshc.RunCommand(fmt.Sprintf(`%s/kcadm.sh config credentials --server http://127.0.0.1:8080 --user "%s" --password '%s' --realm master`, keycloakBinPath, t.config.ExternalAuthProviderSettings.KeycloakAdminUser, strings.ReplaceAll(t.config.ExternalAuthProviderSettings.KeycloakAdminPassword, "'", "\\'")))
Copy link
Member

@agnivade agnivade Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought %q was meant to solve this scenario? Does that not work? 🤔

Wait nvm. It's the shell interpreting ~.

if err != nil {
return fmt.Errorf("failed to authenticate keycloak admin: %w", err)
}
Expand Down
Loading