Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Env vars are inserted unquoted #36

Closed
zilti opened this issue May 11, 2023 · 2 comments · Fixed by #43
Closed

Env vars are inserted unquoted #36

zilti opened this issue May 11, 2023 · 2 comments · Fixed by #43
Labels
bug Something isn't working

Comments

@zilti
Copy link

zilti commented May 11, 2023

The pot driver inserts values from the env block unquoted; meaning

env {
    somevar = "blah ; blah"
}

will turn into pot set-env -p mypot -E somevar=blah ; blah ..., which makes the deployment fail.

Workaround for me right now: putting single quotes inside the double quotes to quote the values myself.

@grembo
Copy link
Contributor

grembo commented May 11, 2023

Thanks for reporting.

Personally, I'm using something like this at the moment, so I didn't notice:

      template {
        data = <<-EOH
CONSUL_AGENT_URL=http://10.1.0.1:8500
RUST_LOG=info
        EOH
        destination = "${NOMAD_TASK_DIR}/environment"
        change_mode = "noop"
      }

(by workload reads in the environment from that file before starting the daemon).

Note that args works the same at the moment, hence the example:

        args = ["-g","'daemon off;'"]

I think for args this is on purpose, but for env it's wrong (I haven't tested, but this looks like it allows to execute arbitrary commands on the jailhost).

@grembo grembo added the bug Something isn't working label May 11, 2023
@zilti
Copy link
Author

zilti commented May 11, 2023

Yes, pretty sure it allows to execute arbitrary commands as well. I've seen that there are numerous different shell-quoting libraries for Go, so I decided to not make a pull request, but if you have a suggestion, I could work on it.

grembo added a commit to grembo/nomad-pot-driver that referenced this issue Sep 28, 2023
This might break existing workarounds in jobs.

Fixes bsdpot#36
grembo added a commit to grembo/nomad-pot-driver that referenced this issue Sep 28, 2023
This might break existing workarounds in jobs.

Fixes bsdpot#36
grembo added a commit to grembo/nomad-pot-driver that referenced this issue Sep 28, 2023
This might break existing workarounds in jobs.

Fixes bsdpot#36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants