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

aqua info: user name isn't masked on Windows #2731

Closed
suzuki-shunsuke opened this issue Mar 10, 2024 Discussed in #2511 · 1 comment · Fixed by #2902
Closed

aqua info: user name isn't masked on Windows #2731

suzuki-shunsuke opened this issue Mar 10, 2024 Discussed in #2511 · 1 comment · Fixed by #2902
Labels
bug Something isn't working command:info windows
Milestone

Comments

@suzuki-shunsuke
Copy link
Member

Discussed in https://github.com/orgs/aquaproj/discussions/2511

Originally posted by suzuki-shunsuke November 23, 2023

aqua info

$ aqua info
{
"version": "2.16.0",
"commit_hash": "70f84d66ba9af98008360fd7b846094f020b4c6f",
"os": "windows",
"arch": "amd64",
"pwd": "C:\Users\devnu",
"root_dir": "C:\Users\devnu\AppData\Local\aquaproj-aqua",
"env": {},
"config_files": []
}

Overview

aqua info should mask user name.
But user name isn't masked on Windows.

How to reproduce

Run aqua info on Windows.
I confirmed the issue with Git Bash and Powershell.

$ aqua info

Debug output

No response

Expected behaviour

aqua info should mask user name.

Actual behaviour

aqua info doesn't mask user name on Windows.

Important Factoids

No response

Reference

No response

@suzuki-shunsuke
Copy link
Member Author

func maskUser(s, username string) string {
return strings.ReplaceAll(s, username, "(USER)")
}

currentUser, err := user.Current()

userName := currentUser.Username

https://pkg.go.dev/os/user#Current
https://pkg.go.dev/os/user#User

type User struct {
	// Uid is the user ID.
	// On POSIX systems, this is a decimal number representing the uid.
	// On Windows, this is a security identifier (SID) in a string format.
	// On Plan 9, this is the contents of /dev/user.
	Uid [string](https://pkg.go.dev/builtin#string)
	// Gid is the primary group ID.
	// On POSIX systems, this is a decimal number representing the gid.
	// On Windows, this is a SID in a string format.
	// On Plan 9, this is the contents of /dev/user.
	Gid [string](https://pkg.go.dev/builtin#string)
	// Username is the login name.
	Username [string](https://pkg.go.dev/builtin#string)
	// Name is the user's real or display name.
	// It might be blank.
	// On POSIX systems, this is the first (or only) entry in the GECOS field
	// list.
	// On Windows, this is the user's display name.
	// On Plan 9, this is the contents of /dev/user.
	Name [string](https://pkg.go.dev/builtin#string)
	// HomeDir is the path to the user's home directory (if they have one).
	HomeDir [string](https://pkg.go.dev/builtin#string)
}

PWD: maskUser(param.PWD, userName),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working command:info windows
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant