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

Knob to blacklist some template functions #1243

Merged
merged 3 commits into from
Aug 2, 2019

Conversation

notnoop
Copy link

@notnoop notnoop commented Aug 1, 2019

Exposes a knob for consul-template library users to disable some template functions. Functions like env and plugin may access sensitive values on host and are best disabled unilaterally.

Exposes a knob for consul-template library users to disable some template functions.  Functions like `env` and `plugin` may access sensitive values on host and are best disabled unilaterally.
@tgross
Copy link
Member

tgross commented Aug 2, 2019

I've pushed a commit on top of this with the following changes:

  • moves the configuration down to the template level (which works fine for Nomad's use case)
  • ensures we have access to change the blacklist in the configuration structs
  • changes the field name per recommendations from @eikenb

Here's what this looks like from the user's perspective:

demo.hcl:

template {
  source = "./demo.conf",
  function_blacklist = ["plugin"],
}

demo.conf:

{{ plugin "/bin/cat" "./secret_file.txt" }}

demo:

$ echo 'SUPER_SECRET_SHOULD_NOT_SEE' > ./secret_file.txt
$ make dev
==> Installing consul-template for darwin/amd64

$ consul-template -log-level=debug -config=./demo.hcl -dry -once
2019/08/02 14:57:43.041320 [ERR] (cli) ./demo.conf: execute: template: :2:3: executing "" at <plugin "/bin/cat" "./secret_file.txt">: error calling plugin: function is disabled

@eikenb
Copy link
Contributor

eikenb commented Aug 2, 2019

@tgross Do you have time to update the config example in the README.md with function_blacklist? I think between the delimiters and the wait is the best spot.

@tgross
Copy link
Member

tgross commented Aug 2, 2019

@eikenb I've done that. How's that look?

@eikenb
Copy link
Contributor

eikenb commented Aug 2, 2019

Looks good. Thanks.

@eikenb eikenb merged commit 5b79e6a into hashicorp:master Aug 2, 2019
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 2, 2019
pulls in configuration option for blacklisting template functions from
hashicorp/consul-template#1243
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 5, 2019
pulls in configuration option for blacklisting template functions from
hashicorp/consul-template#1243
hashicorp/consul-template#1246
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 5, 2019
pulls in configuration option for blacklisting template functions from
hashicorp/consul-template#1243
hashicorp/consul-template#1246
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 5, 2019
pulls in configuration option for blacklisting template functions from
hashicorp/consul-template#1243
hashicorp/consul-template#1246
@eikenb eikenb added this to the 0.21.0 milestone Aug 5, 2019
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 8, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 8, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 9, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 9, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254

[wip consul-template]
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254
@eikenb eikenb added the nomad Related to ingetration in Nomad label Aug 12, 2019
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254

pulls in vault KVv2 read fixes from:
hashicorp/consul-template#1253
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254

pulls in vault KVv2 read fixes from:
hashicorp/consul-template#1253
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254

pulls in vault KVv2 read fixes from:
hashicorp/consul-template#1253
tgross added a commit to hashicorp/nomad that referenced this pull request Aug 12, 2019
pulls in configuration option for blacklisting template functions from:
hashicorp/consul-template#1243
hashicorp/consul-template#1246

pulls in configuration option for file sandboxing from:
hashicorp/consul-template#1249
hashicorp/consul-template#1254

pulls in vault KVv2 read fixes from:
hashicorp/consul-template#1253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement nomad Related to ingetration in Nomad
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants