Skip to content

Commit

Permalink
Mark secutiry-related args as NoEcho
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Gleyzer committed Feb 20, 2025
1 parent 23c0a71 commit d9218cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions auth/src/main/x/auth/UserManagement.x
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UserManagement {
String getUser() = auth.get($"{Path}/users/me");

@Command("password", "Change password for current user")
void changePassword(String oldPassword = "", String newPassword = "") {
void changePassword(@NoEcho String oldPassword = "", @NoEcho String newPassword = "") {
if (oldPassword.empty || newPassword.empty) {
do {
oldPassword = console.readLine("Old password:", suppressEcho=True);
Expand Down Expand Up @@ -76,7 +76,7 @@ class UserManagement {
// ----- user management operations ------------------------------------------------------------

@Command("create-user", "Create user")
String createUser(String name, String password) =
String createUser(String name, @NoEcho String password) =
auth.post($"{Path}/users/{name}", password, Text);

@Command("show-user", "Get user by id")
Expand All @@ -86,7 +86,7 @@ class UserManagement {
String findUser(String name) = auth.get($"{Path}/users?{name=}");

@Command("reset-password", "Reset the password")
String resetPassword(Int userId, String password) =
String resetPassword(Int userId, @NoEcho String password) =
auth.patch($"{Path}/users/{userId}/password", password, Text);

@Command("set-user-permissions", "Set user permissions")
Expand Down
7 changes: 4 additions & 3 deletions platformCLI/src/main/x/platformCLI/AppManagement.x
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ class AppManagement {
platformCLI.put($"/apps/deployments/{deploymentName}?useAuth={on ? "true" : "false"}");

@Command("set-oauth-provider", "Set the 'oauth' provider info")
String setUseSetAuth(String deploymentName, String provider, String id, String secret) {
String setUseSetAuth(String deploymentName, String provider,
@NoEcho String clientId, @NoEcho String clientSecret) {
import convert.formats.Base64Format;

String b64Id = Base64Format.Instance.encode(id.utf8());
String b64Secret = Base64Format.Instance.encode(secret.utf8());
String b64Id = Base64Format.Instance.encode(clientId.utf8());
String b64Secret = Base64Format.Instance.encode(clientSecret.utf8());

return platformCLI.post($"/apps/deployments/{deploymentName}/providers/{provider}",
$"{b64Id}:{b64Secret}", Text);
Expand Down

0 comments on commit d9218cd

Please sign in to comment.