Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5772a70
[Server] Read server settings from UC_ environment variables
shba24 Nov 3, 2026
85fb47b
[CLI] Drop a comment that restates the code
shba24 Nov 3, 2026
1943aef
[Server] Point the client secret warning at bin/uc auth login
shba24 Nov 4, 2026
476239b
[CLI] Test reading the client secret from the environment
shba24 Nov 4, 2026
7376e27
Merge main into stack/ep31-config-secrets-env
shba24 Nov 5, 2026
e34f160
[Helm] Keep the old secret variables for custom server.properties tem…
shba24 Nov 5, 2026
f437c79
[Docs] Fix wording from the AI review
shba24 Nov 5, 2026
b7c2155
[Server] Rewrap a Javadoc line over 100 characters
shba24 Nov 5, 2026
ccf1dc3
Merge main into stack/ep31-config-secrets-env
shba24 Nov 6, 2026
45908d7
Skip the env log line for the client secret; note auth.enabled in the…
shba24 Nov 6, 2026
bce4fd4
Rewrap the Helm upgrading note
shba24 Nov 6, 2026
c04f82f
Test the secrets-in-file warnings and the Helm secret wiring
shba24 Nov 6, 2026
c6d1143
Pass whole storage credentials to the server; precompile env patterns
shba24 Nov 6, 2026
03c0541
Keep storage credentials out of the generated server.properties
shba24 Nov 6, 2026
39433fe
Rewrap the Helm upgrading note
shba24 Nov 6, 2026
b63005a
Drop the precompiled env patterns
shba24 Nov 6, 2026
765315f
Test the secrets-in-file warnings through the log
shba24 Nov 6, 2026
c556936
Drop the docs note on exact-name variables
shba24 Nov 6, 2026
b39674e
Drop the rotation rationale from the docs
shba24 Nov 6, 2026
68c80c7
Shorten the secretEnv comment
shba24 Nov 6, 2026
0a43917
Restore the secrets fixture comment
shba24 Nov 6, 2026
6af48d7
Say that the UC_ variables take precedence over a custom template
shba24 Nov 6, 2026
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
22 changes: 22 additions & 0 deletions .github/workflows/helm-chart-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ jobs:
# An explicit grace period of 0 is kept.
out="$(helm template uc helm --set server.deployment.terminationGracePeriodSeconds=0)"
grep -qE '^ +terminationGracePeriodSeconds: 0$' <<<"$out"
# Storage secrets reach the server as UC_ variables, not through server.properties.
secrets=(-f helm/ci/secrets-values.yaml --set auth.enabled=true --set auth.clientSecretName=ci-oauth)
out="$(helm template uc helm "${secrets[@]}" --set server.config.extraProperties=null)"
# Every part of a credential, so a restart after a rotation reads one set.
for ref in UC_S3_ACCESSKEY_0:ci-s3-credentials:accessKey UC_S3_SECRETKEY_0:ci-s3-credentials:secretKey \
UC_ADLS_TENANTID_0:ci-adls-credentials:tenantId UC_ADLS_CLIENTID_0:ci-adls-credentials:clientId \
UC_ADLS_CLIENTSECRET_0:ci-adls-credentials:clientSecret; do
IFS=: read -r name secret key <<<"$ref"
grep -A4 -- "- name: $name\$" <<<"$out" | tr -d '\n' | grep -qE "name: \"$secret\" +key: $key( |\$)"
done
# None in the file, which the init container writes only at pod start.
! grep -qE 'server\.client-secret|s3\.(accessKey|secretKey)|adls\.(tenantId|clientId|clientSecret)' <<<"$out" || exit 1
# The deprecated init container variables are there only for a custom template.
legacy='S3_ACCESS_KEY_0 S3_SECRET_KEY_0 ADLS_TENANT_ID_0 ADLS_CLIENT_ID_0 ADLS_CLIENT_SECRET_0 OAUTH_CLIENT_SECRET'
! grep -qE -- "- name: (${legacy// /|})\$" <<<"$out" || exit 1
out="$(helm template uc helm "${secrets[@]}")"
for name in $legacy; do
grep -qE -- "- name: $name\$" <<<"$out"
done
grep -A6 -- '- name: OAUTH_CLIENT_SECRET$' <<<"$out" | grep -qF 'optional: true'
out="$(helm template uc helm -f helm/ci/secrets-values.yaml)"
! grep -qE -- '- name: OAUTH_CLIENT_SECRET$' <<<"$out" || exit 1

- name: Build the server and UI images
run: |
Expand Down
14 changes: 14 additions & 0 deletions docs/docker_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ The configuration will create a bind mount to the local files in `./etc/conf`.
The UC server can be configured by editing the configuration files on the host,
and the mount will reflect the changes in the container.

Set secrets as environment variables of the `server` service, not in the mounted
`server.properties`, where they are deprecated (see
[Secrets](./server/configuration.md#secrets)). For example, in `compose.yaml`:

```yaml
services:
server:
environment:
UC_S3_SECRETKEY_0: ${UC_S3_SECRETKEY_0}
```

Compose fills in `${UC_S3_SECRETKEY_0}` from your shell or a `.env` file, so the
secret stays out of `compose.yaml`.

The configuration will also create a persistent, named volume to store the
server's data. This will persist between restarts of the container. See the
[deployment](./server/deployment.md) page for more details on how to configure other
Expand Down
8 changes: 6 additions & 2 deletions docs/integrations/unity-catalog-spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,23 @@ To have Unity Catalog work with cloud object storage as the storage location for
s3.awsRoleArn.0=<S3_ROLE>
# Optional (If blank, it will use DefaultCredentialsProviderChain)
s3.accessKey.0=<SECRET>
s3.secretKey.0=<SECRET>
```

Set the secret key in the `UC_S3_SECRETKEY_0` environment variable. Keeping `s3.secretKey.0` in
`server.properties` is deprecated (see [Secrets](../server/configuration.md#secrets)).

=== "Azure ADLSgen2"

```sh
## ADLS Storage Config (Multiple configs can be added by incrementing the index)
adls.storageAccountName.0=<ADLS_STORAGEACCOUNTNAME>
adls.tenantId.0=<ADLS_TENANTID>
adls.clientId.0=<ADLS_CLIENTID>
adls.clientSecret.0=<SECRET>
```

Set the client secret in the `UC_ADLS_CLIENTSECRET_0` environment variable. Keeping `adls.clientSecret.0` in
`server.properties` is deprecated (see [Secrets](../server/configuration.md#secrets)).

=== "Google Cloud Storage"

```sh
Expand Down
3 changes: 3 additions & 0 deletions docs/integrations/unity-catalog-xtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ For enabling server to vend AWS temporary credentials to access S3 buckets, the
- `s3.secretKey.i`: The AWS secret key used to sign API requests to AWS.
- `s3.sessionToken.i`: THE AWS session token, used to verify that the request is coming from a trusted source.

Set the secret key and the session token in the `UC_S3_SECRETKEY_<i>` and `UC_S3_SESSIONTOKEN_<i>` environment variables;
keeping them in `server.properties` is deprecated (see [Secrets](../server/configuration.md#secrets)).

## Run the Unity Server

```sh
Expand Down
15 changes: 12 additions & 3 deletions docs/server/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,25 @@ Once you have configured your identity provider, the next step is to configure y

## Configure UC Server Settings

Start by editing `etc/conf/server.properties` with the **Client ID** and **Client secret** provided to you by the
Identity Provider.
Start by editing `etc/conf/server.properties` with the **Client ID** provided to you by the Identity Provider.
`bin/uc auth login` reads the **Client secret** from the `UC_SERVER_CLIENT_SECRET` environment variable, so set it in
the shell where you run that command; the server does not need it. Setting `server.client-secret` in
`server.properties` still works but is deprecated (see [Secrets](configuration.md#secrets)).

```sh
server.authorization=enable
server.authorization-url=https://accounts.google.com/o/oauth2/auth
server.token-url=https://oauth2.googleapis.com/token
server.client-id=<Client ID provided earlier>
server.client-secret=<Client secret provided earlier>
server.allowed-issuers=https://accounts.google.com
server.allowed-jwks-uris=https://www.googleapis.com/oauth2/v3/certs
server.audiences=<Client ID provided earlier>
```

```sh
export UC_SERVER_CLIENT_SECRET='<Client secret provided earlier>'
```

### Issuer and Audience Validation

When authorization is enabled, the server validates incoming identity tokens against configured issuers and audiences:
Expand Down Expand Up @@ -151,6 +156,10 @@ For Google deployments that do not use Helm, set
`server.allowed-jwks-uris=https://www.googleapis.com/oauth2/v3/certs` in `server.properties`
before starting the new server. Helm includes this URL by default.

Move `server.client-secret` from `server.properties` to the `UC_SERVER_CLIENT_SECRET` environment variable of the shell
where you run `bin/uc auth login`; the server does not read it. The file still works, but is deprecated (see
[Secrets](configuration.md#secrets)).

### Permission-check migration

`server.authorization.strict-privilege-checks` is a temporary migration setting. It defaults to
Expand Down
18 changes: 11 additions & 7 deletions docs/server/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This configuration tells the Unity Catalog server which role it should use as th

```ini
# server.properties (AWS-hosted)
aws.s3.masterRoleArn=arn:aws:iam::1234567:role/UCMasterRole-EXAMPLE
aws.masterRoleArn=arn:aws:iam::1234567:role/UCMasterRole-EXAMPLE
aws.region=us-west-2
```

Expand All @@ -60,17 +60,18 @@ The Unity Catalog server can also take an **IAM user** in place of the UC master

## Configure in *server.properties* or environment variables

When running on-premises and without *AWS IAM Roles Anywhere* deployment, Unity Catalog server has to be configured manually to provide the credential of the master user. In the `server.properties` file the IAM **user** arn can be specified for the key `aws.s3.masterRoleArn` despite the fact that the key is called `masterRoleArn`:
When running on-premises and without *AWS IAM Roles Anywhere* deployment, Unity Catalog server has to be configured manually to provide the credential of the master user. In the `server.properties` file the IAM **user** arn can be specified for the key `aws.masterRoleArn` despite the fact that the key is called `masterRoleArn`:

```ini
# server.properties (on‑prem with IAM user — only if Roles Anywhere isn’t possible)
aws.s3.masterRoleArn=arn:aws:iam::1234567:user/UCMasterRole-EXAMPLE
aws.s3.accessKey= # Leave it blank to delegate to DefaultCredentialsProvider
aws.s3.secretKey= # Leave it blank to delegate to DefaultCredentialsProvider
aws.masterRoleArn=arn:aws:iam::1234567:user/UCMasterRole-EXAMPLE
# Leave it blank to delegate to DefaultCredentialsProvider
aws.accessKey=
aws.region=us-west-2
```
It's recommended to leave `aws.s3.accessKey` and `aws.s3.secretKey` unset so that
[`DefaultCredentialsProvider`](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/auth/credentials/DefaultCredentialsProvider.html) is still used if it’s properly configured. Otherwise these keys can be also configured through environment variables instead.
It's recommended to leave `aws.accessKey` and `aws.secretKey` unset so that
[`DefaultCredentialsProvider`](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/auth/credentials/DefaultCredentialsProvider.html) is still used if it’s properly configured. Otherwise set the secret key (`aws.secretKey`) in the `UC_AWS_SECRETKEY` environment variable, not in
`server.properties`, where it is deprecated (see [Secrets](configuration.md#secrets)).

# Create and configure both the S3 storage and storage credential

Expand Down Expand Up @@ -165,6 +166,9 @@ s3.accessKey.0=...
s3.secretKey.0=...
```

A secret key in `server.properties` is deprecated; until you migrate, set it in the `UC_S3_SECRETKEY_<n>` environment
variable instead (see [Secrets](configuration.md#secrets)).

The following steps are recommended to migrate the old credential configs:

1. Comment out the old configs in the `server.properties` file
Expand Down
47 changes: 47 additions & 0 deletions docs/server/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,53 @@ The server config file is at the location `etc/conf/server.properties` (relative
lowercase hex, raw non-ASCII) is rejected with `400`, and an external location whose URL has such an escape
cannot hold one.

### Secrets

Any setting can also come from an environment variable named `UC_`, then the key in upper case, with `_` for each
character that is not a letter or digit. For example, `s3.region.0` is `UC_S3_REGION_0`. Set secrets this way, not in
`server.properties`:

| Key in `server.properties` | Environment variable |
| --- | --- |
| `server.client-secret` | `UC_SERVER_CLIENT_SECRET` |
| `aws.secretKey` | `UC_AWS_SECRETKEY` |
| `s3.secretKey.<n>`, `s3.sessionToken.<n>` | `UC_S3_SECRETKEY_<n>`, `UC_S3_SESSIONTOKEN_<n>` |
| `adls.clientSecret.<n>` | `UC_ADLS_CLIENTSECRET_<n>` |

```sh
export UC_S3_SECRETKEY_0='<secret key>'
bin/start-uc-server
```

A variable takes precedence over the same key in `server.properties`, and a variable named exactly as the key comes
before the `UC_` one. An empty `UC_` variable is ignored, and line breaks at the end of its value are dropped, as a
Kubernetes Secret made from a file often ends with one. The prefix keeps variables that runtimes set for their own use,
such as `AWS_REGION`, from changing settings. The server logs the name of each environment variable it uses for a
setting, never its value. `server.client-secret` is read by `bin/uc auth login`, not by the server.
The Helm chart passes each S3 and ADLS credential to the server container from its Kubernetes Secret, in
`UC_S3_ACCESSKEY_<n>` and `UC_S3_SECRETKEY_<n>`, or `UC_ADLS_TENANTID_<n>`, `UC_ADLS_CLIENTID_<n>` and
`UC_ADLS_CLIENTSECRET_<n>`.

!!! warning "Deprecated: secrets in `server.properties`"
Secrets in `server.properties` still work, but this is deprecated. The server logs a warning at startup for each
secret set in the file that no environment variable or system property supplies, and always for
`server.client-secret`. Move them to environment variables.

#### Upgrading

- A `UC_` variable that is already set in the server's environment now takes precedence over the same key in
`server.properties`.
- `bin/uc auth login` reads `UC_SERVER_CLIENT_SECRET` before `server.client-secret` in `etc/conf/server.properties`.
- Helm: use the server image from the chart's release, which is the default. An older server image doesn't read these
variables, so S3 and ADLS lose their secrets.
- Helm: the rendered `server.properties` no longer holds `server.client-secret` or the S3 and ADLS credentials
(`s3.accessKey.<n>`, `s3.secretKey.<n>`, `adls.tenantId.<n>`, `adls.clientId.<n>`, `adls.clientSecret.<n>`). The
init container has `S3_ACCESS_KEY_<n>`, `S3_SECRET_KEY_<n>`, `ADLS_TENANT_ID_<n>`, `ADLS_CLIENT_ID_<n>`,
`ADLS_CLIENT_SECRET_<n>` and, with `auth.enabled`, `OAUTH_CLIENT_SECRET` only when `server.config.override` or
`extraProperties` is set, so a template that uses them still gets them; that is deprecated. The server container's
`UC_` variables still take precedence over the template's values. A container added through `extraInitContainers`
or `extraContainers` that needs these secrets must read them from the Kubernetes Secret itself.

## Local file system storage

Unity Catalog can store data on the server's local file system, which is convenient for development and single-machine
Expand Down
12 changes: 11 additions & 1 deletion etc/conf/server.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ server.env=dev
# authorization-url=https://accounts.google.com/o/oauth2/auth
# token-url=https://oauth2.googleapis.com/token
# client-id=111122223333-abab1212cdcd3434.apps.googleusercontent.com
# client-secret=GOCSPX-ababfoobarcdcd-5q
# client-secret: set it in the UC_SERVER_CLIENT_SECRET environment variable
# server.allowed-issuers=https://accounts.google.com
# server.allowed-jwks-uris=https://www.googleapis.com/oauth2/v3/certs
# server.audiences=111122223333-abab1212cdcd3434.apps.googleusercontent.com
server.authorization=disable
server.authorization-url=
server.token-url=
server.client-id=
# Only bin/uc auth login reads it. Deprecated here: set it in the UC_SERVER_CLIENT_SECRET environment
# variable of the shell that runs that command instead (see Secrets in docs/server/configuration.md).
server.client-secret=
server.redirect-port=

Expand Down Expand Up @@ -116,6 +118,8 @@ aws.masterRoleArn=
# The AWS credential of masterRoleArn to be used by server. If not set, server uses the
# DefaultCredentialsProvider.
aws.accessKey=
# Deprecated here: set it in the UC_AWS_SECRETKEY environment variable instead
# (see Secrets in docs/server/configuration.md).
aws.secretKey=
# The region of AWS. If running on-premises, pick the nearest region.
aws.region=
Expand All @@ -128,14 +132,20 @@ s3.region.0=
s3.awsRoleArn.0=
# Optional (If blank, it will use DefaultCredentialsProviderChain)
s3.accessKey.0=
# Deprecated here: set the secret in an environment variable instead, for example UC_S3_SECRETKEY_0
# (see Secrets in docs/server/configuration.md).
s3.secretKey.0=
# Test Only (If you provide a session token, it will just use those session creds, no downscoping)
# Deprecated here: set it in an environment variable instead, for example UC_S3_SESSIONTOKEN_0
# (see Secrets in docs/server/configuration.md).
s3.sessionToken.0=

## ADLS Storage Config (Multiple configs can be added by incrementing the index)
adls.storageAccountName.0=
adls.tenantId.0=
adls.clientId.0=
# Deprecated here: set the secret in an environment variable instead, for example UC_ADLS_CLIENTSECRET_0
# (see Secrets in docs/server/configuration.md).
adls.clientSecret.0=

## GCS Storage Config (Multiple configs can be added by incrementing the index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,24 @@ public Oauth2CliExchange() throws IOException {
}
}

/**
* The client secret from {@code UC_SERVER_CLIENT_SECRET}, or else from {@code
* server.client-secret} in the file. The variable name and the line-break trimming match the
* server (see Secrets in configuration.md).
*/
public static String clientSecret(Map<String, String> env, Properties fileProperties) {
String secret = env.getOrDefault("UC_SERVER_CLIENT_SECRET", "").replaceAll("[\\r\\n]+$", "");
return secret.isEmpty() ? fileProperties.getProperty("server.client-secret") : secret;
}

// TODO: Some of this should probably be done server side.
public String authenticate() throws IOException {

// TODO: These properties, especially client-secret should probably be server side.
String authorizationUrl = serverProperties.getProperty("server.authorization-url");
String tokenUrl = serverProperties.getProperty("server.token-url");
String clientId = serverProperties.getProperty("server.client-id");
String clientSecret = serverProperties.getProperty("server.client-secret");
String clientSecret = clientSecret(System.getenv(), serverProperties);

// Find a random available port
int port = findAvailablePort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.fasterxml.jackson.databind.JsonNode;
import io.unitycatalog.cli.utils.Oauth2CliExchange;
import io.unitycatalog.server.base.auth.BaseAuthCRUDTest;
import io.unitycatalog.server.security.JwtClaim;
import io.unitycatalog.server.security.JwtTokenType;
Expand All @@ -20,6 +21,8 @@
import java.security.spec.InvalidKeySpecException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -88,6 +91,27 @@ public void testAuthLoginExchangeWithCorrectIssuerAndWrongAudience() {
.isInstanceOf(RuntimeException.class);
}

// bin/uc auth login without --identity_token reads the client secret for its OAuth flow.
@Test
public void testAuthLoginReadsTheClientSecretFromTheEnvironmentBeforeTheFile() {
Properties file = new Properties();
file.setProperty("server.client-secret", "file-secret");

// A line break at the end, as in a Secret made from a file, is dropped.
assertThat(
Oauth2CliExchange.clientSecret(
Map.of("UC_SERVER_CLIENT_SECRET", "env-secret\r\n"), file))
.isEqualTo("env-secret");
Comment thread
shba24 marked this conversation as resolved.
Resolved
// An absent, empty or line-break-only variable falls back to the file.
for (Map<String, String> env :
List.of(
Map.<String, String>of(),
Map.of("UC_SERVER_CLIENT_SECRET", ""),
Map.of("UC_SERVER_CLIENT_SECRET", "\n"))) {
assertThat(Oauth2CliExchange.clientSecret(env, file)).isEqualTo("file-secret");
}
}

@Test
public void testAuthLoginExchangeWithWrongIssuerAndCorrectAudience()
throws NoSuchAlgorithmException {
Expand Down
19 changes: 16 additions & 3 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ not set
</td>
<td>OAuth client secret name

Client secret must contain the following keys:
Client secret must contain the following key:
- `clientId`: OAuth client ID
- `clientSecret`: OAuth client secret

The server doesn't read the OAuth client secret. A `clientSecret` key is passed only to a
`server.config.override` or `extraProperties` template that uses `${OAUTH_CLIENT_SECRET}`.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -356,6 +358,8 @@ extraProperties:
my-config.property1: my-value1
my-config.property2: my-value2
```

Do not put secrets here: a secret in `server.properties` is deprecated.
</td>
</tr>
<tr>
Expand All @@ -373,6 +377,11 @@ server.env=prod
server.port=8080
...other config properties...
```

Do not put secrets here: the chart passes the S3 and ADLS secrets to the server as environment
variables, and a secret in `server.properties` is deprecated. A template that uses `${OAUTH_CLIENT_SECRET}`,
`${S3_SECRET_KEY_<n>}` or `${ADLS_CLIENT_SECRET_<n>}` still gets them, but that is deprecated
too: the server reads `UC_S3_SECRETKEY_<n>` and `UC_ADLS_CLIENTSECRET_<n>` from its environment.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -827,7 +836,11 @@ not set
{{ .Chart.AppVersion }}
</pre>
</td>
<td>Tag for the server image</td>
<td>Tag for the server image

Use the server image from the same release as the chart. The chart passes secrets to
the server as environment variables that older server images don't read.
</td>
</tr>
<tr>
<td>server.deployment.imagePullSecrets</td>
Expand Down
Loading
Loading