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

can I modify the path for trufflehog to store the temporary git info? #3724

Open
yang0369 opened this issue Dec 3, 2024 · 3 comments
Open

Comments

@yang0369
Copy link

yang0369 commented Dec 3, 2024

I believe "truffle git git-url" command will need to store the git repo/info into a local temporary path, so where is the path and what is the recommended way to modify it? thanks

@ahrav
Copy link
Collaborator

ahrav commented Dec 3, 2024

You can change it using the TMPDIR environment variable. If TMPDIR is not set, you can fall back to TEMP or TMP, though in my experience, most users rely on TMPDIR.

EDIT: For clarity, TMPDIR is the directory where the repository is cloned before being scanned. You can see this in the code here. The CloneRepo function passes the clonePath parameter, which is created using os.MkdirTmp. This function relies on one of the environment variables mentioned above.

@ahrav ahrav added question and removed enhancement labels Dec 3, 2024
@rgmz
Copy link
Contributor

rgmz commented Dec 3, 2024

where is the path and what is the recommended way to modify it?

I think this is an enhancement request.

The answer to the question is technically you can't modify the directory in a meaningful way; being able to do so could be useful (e.g., persist cloned repositories after scanning).

@yang0369
Copy link
Author

yang0369 commented Dec 4, 2024

You can change it using the TMPDIR environment variable. If TMPDIR is not set, you can fall back to TEMP or TMP, though in my experience, most users rely on TMPDIR.

EDIT: For clarity, TMPDIR is the directory where the repository is cloned before being scanned. You can see this in the code here. The CloneRepo function passes the clonePath parameter, which is created using os.MkdirTmp. This function relies on one of the environment variables mentioned above.

Thanks, I guess this is the code that created temp path here using os.MkdirTemp. I personally feel it might be useful to let user choose where to save instead of just the default system temp path (as what @rgmz suggested). e.g. To integrate trufflehog to my backend, one may need to know exactly where the temp files are stored in docker or cloud server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants