-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(misconf): disable git terminal prompt on tf module load #8026
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: nikpivkin <[email protected]>
7ce0161
to
8afcff0
Compare
} | ||
|
||
terminalPrompt := os.Getenv("GIT_TERMINAL_PROMPT") | ||
if err := os.Setenv("GIT_TERMINAL_PROMPT", "0"); err != nil { |
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.
does it fallback to HTTP if this environment variable is set? Just wondering what happens with the current input.
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.
This variable disables prompt when cloning a repository: https://git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode
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.
I was asking about the behavior that takes place when this is set.
2024-12-05T17:34:29-07:00 DEBUG [module resolver] Caching module key="cb2ee13f53c538b535a73ca65544a8a2"
2024-12-05T17:34:29-07:00 DEBUG [module resolver] Downloading module source="github.com/xxxxx/xxxxx?ref=v1"
2024-12-05T17:34:30-07:00 ERROR [terraform evaluator] Failed to load module. Maybe try 'terraform init'? err="failed to download: error downloading 'https://github.com/xxxxx/xxxxx.git?ref=v1': /usr/bin/git exited with 128: Cloning into '/var/folders/x7/p59nrsgs671_264kc0pv7k1m0000gn/T/.aqua/cache/cb2ee13f53c538b535a73ca65544a8a2'...\nfatal: could not read Username for 'https://github.com': terminal prompts disabled\n"
2024-12-05T17:34:30-07:00 DEBUG [terraform evaluator] Starting post-submodules evaluation...
The error message is not entirely correct as in this case the prompt is disabled because of this changes introduced in the PR but we also didn't try downloading either to realize that it isn't a valid repo. Should we do that?
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.
Trivy successfully clones a repository if it is public. Otherwise, if the user has not provided credentials, Trivy logs a message that contains an error: could not read Username for “https://github.com”: terminal prompts disabled
. I didn't quite understand about the fallback to HTTP, since it's the source that points to the git repository.
Description
Related issues
Checklist