-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Anonymize paths in fastlane env
output
#7037
Conversation
i really like that. recently was thinking about doing a |
@hjanuschka This is a good idea, but it should be done in another pull request IMHO. I wonder how much data we could anonymize automatically, without needing |
@@ -270,6 +270,10 @@ def self.print_fastlane_files | |||
env_output | |||
end | |||
|
|||
def self.anonymized_path(path) | |||
return ENV['HOME'] ? path.gsub(/^#{ENV['HOME']}/, '~') : path |
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.
In the super edgy edge case that the user's home dir is the prefix of other folders this is gonna output garbage. Example: $HOME=/work
, anonymized_path("/workspace/whatever/fastlane")
=> ~space/whatever/fastlane
.
Might be more applicable to linux where the user's home dir is not generally inside the /Users/
folder.
@hjanuschka Yeah, I've thought about something like that before. Sounds good to me, @0xced do you have any thoughts about that? |
This way, the username is not leaked. Also, it makes it easy to visually spot when a path is in the user’s home directory.
8299e9f
to
8a93790
Compare
I updated the code, and added a spec. With $HOME == /Users/john With $HOME == /work |
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.
Looks good now! Thanks for your contribution 🚀
bundle exec rspec
from the subdirectory of each tool you modified. Alternatively, runrake test_all
from the root directory.bundle exec rubocop -a
to ensure the code style is validThis way, the username is not leaked. Also, it makes it easy to visually spot when a path is in the user’s home directory.