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

security: a more comprehensive env.denylist #24540

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/24540.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:security
security: Added more host environment variables to the default deny list for tasks
```
16 changes: 10 additions & 6 deletions command/agent/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ func environment() map[string]string {
// Update https://developer.hashicorp.com/nomad/docs/configuration/client#env-denylist
// whenever this is changed.
var DefaultEnvDenyList = []string{
"CONSUL_TOKEN",
"CONSUL_HTTP_TOKEN",
"VAULT_TOKEN",
"NOMAD_LICENSE",
"AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN",
"GOOGLE_APPLICATION_CREDENTIALS",
// product tokens
"CONSUL_TOKEN", "CONSUL_HTTP_TOKEN", "CONSUL_HTTP_TOKEN_FILE", "NOMAD_TOKEN", "VAULT_TOKEN",
// licenses
"CONSUL_LICENSE", "NOMAD_LICENSE", "VAULT_LICENSE",
// license paths
"CONSUL_LICENSE_PATH", "NOMAD_LICENSE_PATH", "VAULT_LICENSE_PATH",
// AWS sensitive variables
"AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_METADATA_URL",
// GCP sensitive variables
"GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_OAUTH_ACCESS_TOKEN",
}

// makeEnvRedactSet creates a set of well known environment variables that should be
Expand Down
4 changes: 4 additions & 0 deletions command/agent/host/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func TestMakeHostData(t *testing.T) {
t.Setenv("BOGUS_TOKEN", "foo")
t.Setenv("BOGUS_SECRET", "foo")
t.Setenv("ryanSECRETS", "foo")
t.Setenv("CONSUL_LICENSE_PATH", "foo")
t.Setenv("AWS_ACCESS_KEY_ID", "foo")
pkazmierczak marked this conversation as resolved.
Show resolved Hide resolved

host, err := MakeHostData()
must.NoError(t, err)
Expand All @@ -38,4 +40,6 @@ func TestMakeHostData(t *testing.T) {
must.Eq(t, "<redacted>", host.Environment["BOGUS_TOKEN"])
must.Eq(t, "<redacted>", host.Environment["BOGUS_SECRET"])
must.Eq(t, "<redacted>", host.Environment["ryanSECRETS"])
must.Eq(t, "<redacted>", host.Environment["CONSUL_LICENSE_PATH"])
must.Eq(t, "<redacted>", host.Environment["AWS_ACCESS_KEY_ID"])
}
9 changes: 9 additions & 0 deletions website/content/docs/configuration/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,21 @@ see the [drivers documentation](/nomad/docs/drivers).
```text
CONSUL_TOKEN
pkazmierczak marked this conversation as resolved.
Show resolved Hide resolved
CONSUL_HTTP_TOKEN
CONSUL_HTTP_TOKEN_FILE
NOMAD_TOKEN
VAULT_TOKEN
CONSUL_LICENSE
NOMAD_LICENSE
VAULT_LICENSE
CONSUL_LICENSE_PATH
NOMAD_LICENSE_PATH
VAULT_LICENSE_PATH
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
AWS_METADATA_URL
GOOGLE_APPLICATION_CREDENTIALS
GOOGLE_OAUTH_ACCESS_TOKEN
```

- `"user.denylist"` `(string: see below)` - Specifies a comma-separated
Expand Down
8 changes: 8 additions & 0 deletions website/content/docs/upgrade/upgrade-specific.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ upgrade. However, specific versions of Nomad may have more details provided for
their upgrades as a result of new features or changed behavior. This page is
used to document those details separately from the standard upgrade flow.

## Nomad 1.9.4

In Nomad 1.9.4, the [default client env deny
list](/nomad/docs/configuration/client#env-denylist) includes additional
environment variables to improve security. Users who need some of these secure
environment variables passed to their tasks should consult the list and
overwrite it in the configuration.

## Nomad 1.9.3

In Nomad 1.9.3, the mechanism used for calculating when objects are eligible
Expand Down