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

Inferring version from terragrunt_version_constraint installs an HTML 404 page as an executable #143

Open
josh-wolfe-okcupid opened this issue Apr 25, 2024 · 0 comments

Comments

@josh-wolfe-okcupid
Copy link

josh@josh-laptop:~/tmp$ mkdir empty
josh@josh-laptop:~/tmp$ cd empty
josh@josh-laptop:~/tmp/empty$ cat ~/.tgswitch.toml 
bin = "/home/josh/.terragrunt.versions/terragrunt"
josh@josh-laptop:~/tmp/empty$ tgswitch --version

Version: 0.6.0
josh@josh-laptop:~/tmp/empty$ rm ~/.terragrunt.versions/terragrunt_*
josh@josh-laptop:~/tmp/empty$ echo 'terragrunt_version_constraint = "=0.38.12"' > terragrunt.hcl
josh@josh-laptop:~/tmp/empty$ tgswitch 
Reading configuration from home directory for .tgswitch.toml
Terragrunt file found: /home/josh/tmp/empty/terragrunt.hcl
Reading required version from constraint: =0.38.12
Matched version: 0.38.12
Downloading https://warrensbox.github.io/terragunt-versions-list/index.json/v0.38.12/terragrunt_linux_amd64 to terragrunt_linux_amd64
Downloading ...
9379 bytes downloaded.
Switched terragrunt to version "0.38.12" 
josh@josh-laptop:~/tmp/empty$ head `which terragrunt`
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:; connect-src 'self'">
    <title>Page not found &middot; GitHub Pages</title>
    <style type="text/css" media="screen">
      body {
        background-color: #f1f1f1;
        margin: 0;
josh@josh-laptop:~/tmp/empty$ terragrunt --version
/home/josh/.terragrunt.versions/terragrunt: line 1: syntax error near unexpected token `newline'
/home/josh/.terragrunt.versions/terragrunt: line 1: `<!DOCTYPE html>'

I probably don't need to explain how hazardous and dangerous this is.

Perhaps there's missing error checking on the HTTP status code? Also, when I tgswitch 0.38.12 explicitly, everything works, so it seems there's a bug specifically in the terragrunt_version_constraint inference path.

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

No branches or pull requests

1 participant