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

Allow alternate $HOME to be used by CLI to support run inside JFrog artifactory plugin #1008

Closed
wants to merge 1 commit into from

Conversation

tsemachh
Copy link
Collaborator

@tsemachh tsemachh commented Jan 14, 2025

By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

When running inside JFROG artifactory $HOME is wrong so clio is failing on creating the .checkmarx folder
We changed from user.HomeDir to os.UserHomeDir()
On Unix: user.HomeDir might read from /etc/passwd while os.UserHomeDir() uses $HOME
On Windows: Both generally use similar APIs but os.UserHomeDir() is more direct

Recommendation:

os.UserHomeDir() is preferred since Go 1.12 unless you specifically need other user information
It's simpler, more efficient, and handles edge cases better

References

Include supporting link to GitHub Issue/PR number

Testing

Tried to override the $HOME and saw that CLI was creating directory in the right place

Checklist

  • I have added documentation for new/changed functionality in this PR (if applicable).
  • I have updated the CLI help for new/changed functionality in this PR (if applicable).
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

os.UserHomeDir() to get the homeDir as it enables overriding it using HOME env variable while previous Impl was reading from etc/passwd
Copy link

Logo
Checkmarx One – Scan Summary & Details09f5cf79-43b8-4204-85a0-8c24a09dc5a2

Great job, no security vulnerabilities found in this Pull Request

@tsemachh tsemachh closed this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant