Skip to main content

Upgrade to Endatix 0.9.2

Release notes: Endatix API v0.9.2 and Endatix Hub v0.9.2.

This page covers an upgrade from 0.9.1. Every Hub needs a strong AUTH_SECRET, and every API outside Development needs its two signing keys, before it starts. The other sections apply only to hosts that enable Keycloak sign-in, send Google or custom-provider tokens to the API, reference TenantMiddleware in code, assign roles from code, send webhooks to receivers on their own network, call the public data-list routes directly, or call POST /api/slacktoken.

Before you start​

The Hub needs a strong AUTH_SECRET​

What changed: Hub 0.9.2 refuses to start, in every environment, when AUTH_SECRET is missing, shorter than 32 bytes, or a value copied from an example file. That includes the value the Endatix docker-compose.yaml shipped before 0.9.2. SESSION_SECRET is no longer read. The startup error names the rule that failed, for example AUTH_SECRET must be at least 32 bytes.

Who is affected: every Hub deployment. Hosts that started from the Endatix Compose file, .env.example, or a docs snippet must replace that value.

What to do:

  • Generate a new secret with openssl rand -base64 32 and set it as AUTH_SECRET before you start Hub 0.9.2. A new value signs every user out once.
  • If you set NEXTAUTH_SECRET, rename it to AUTH_SECRET.
  • Delete SESSION_SECRET from your env and secret store. The Helm chart still accepts its session-secret key for this release.
  • Compose users: the Endatix docker-compose.yaml now requires AUTH_SECRET from .env or the shell, and docker/setup.sh and docker/setup.bat generate one, or keep the one already in .env when it is 32 bytes or more.

See Sessions and sign-in for the rule and the startup errors.

Signing keys are required outside Development​

What changed: API 0.9.2 checks its two signing keys at startup and refuses to start when either is missing, shorter than 32 UTF-8 bytes, or a value published in the Endatix docs or samples:

SettingEnvironment variable
Endatix:Auth:Providers:EndatixJwt:SigningKey (signs sign-in tokens)Endatix__Auth__Providers__EndatixJwt__SigningKey
Endatix:Submissions:AccessTokenSigningKey (signs submission access tokens)Endatix__Submissions__AccessTokenSigningKey

The startup error names the setting and the rule that failed, never the value, for example Endatix:Submissions:AccessTokenSigningKey is not set. The legacy Endatix:Jwt:SigningKey still fills the sign-in key when that one is empty.

  • In Development, a key that is not set at all gets a random value for that run, and the API logs a warning. Tokens signed with it stop working on restart, and each replica gets its own key. A short or published key fails in Development too.
  • The API host's appsettings.json ships no keys. Before 0.9.2 it shipped a submission key, which the API now refuses.
  • The Endatix Compose files read ENDATIX_JWT_SIGNING_KEY and ENDATIX_SUBMISSION_SIGNING_KEY, and docker/setup.sh and docker/setup.bat generate them, or keep the ones already in .env.
  • The Helm chart reads both keys from the auth.secretName secret: the sign-in key from signing-key and the submission key from submission-signing-key (auth.secretKey, auth.submissionSecretKey).
  • The Azure deployment template requires both keys as parameters.

Who is affected: every API that runs outside Development. Hosts that never set a submission key and relied on the one in appsettings.json, and hosts that kept a key from the Compose quick start, the Azure sample parameters, the NuGet setup guide or the API template, must set new values.

What to do:

  • Generate one value for each key with openssl rand -base64 48, use a different value for each, and set both before you start API 0.9.2. Keep them in your secret store, not in appsettings.json.
  • A new sign-in key signs every user out once. A new submission key ends the submission access tokens issued with the old one.
  • Compose users: run docker/setup.sh or docker/setup.bat again, or add both variables to .env.
  • Helm users with an existing secret: add a submission-signing-key entry to it.
  • Azure template users: pass both keys as parameters.

See the Endatix API environment variables.

Copied choices export empty cells​

What changed: an export no longer writes 0 for a choice the respondent may not have seen. A checkbox or tag box that copies its choices from another question writes 1 for a picked choice, 0 for a choice the respondent was shown and did not pick, and an empty cell otherwise. A checkbox or tag box in a loop item the respondent did not have, an unanswered ranking, and a choice left unranked in a ranking that copies its choices, are empty instead of 0. The Crunch codebook is unchanged; Crunch imports an empty cell as No Data. See Empty Cells.

Who is affected: forms with copied choices (choicesFromQuestion or carry forward), loops, or rankings, and any analysis that reads those 0s.

What to do:

  • Exports read the rows stored when each submission was saved, so existing rows keep their 0s until they are loaded again. A backfill with force=true (POST forms/{formId}/submissions/backfill) rewrites them. Without a recompile first, copied choices then export 1 or an empty cell, never a wrong 0.
  • To get exact 0s for the choices a respondent saw, compile the form's schema with replace=true (POST forms/{formId}/reporting/compile-schema; Hub: Rebuild reporting data…, Full recompile), then backfill its submissions with force=true (POST forms/{formId}/submissions/backfill).
  • A question that stopped copying its choices keeps exporting 1 or an empty cell after a merge compile, also for new submissions, until a compile with replace=true. A question that started copying turns the 0s of its earlier submissions into empty cells on the next backfill.
  • A form whose copied questions changed their mode, their source questions' choices, or whether they copy at all across form versions: a full recompile judges old submissions by the current form. Compile it without replace (merge mode once the form has real submissions), which leaves those cells empty, then backfill with force=true.

Keycloak needs DefaultTenantId​

What changed: Endatix:Auth:Providers:Keycloak:DefaultTenantId is required. When Keycloak is enabled and the setting is missing or 0, the API refuses to start, and the startup error names the setting.

Who is affected: hosts that call AddKeycloakAuthProvider() with Enabled set to true.

What to do: set DefaultTenantId to the id of the tenant your Keycloak users belong to, before you start API 0.9.2. See Keycloak Setup.

Signed-in requests need a tenant​

What changed: a signed-in request that resolves no tenant gets 403 before it reaches an endpoint, on every route, public routes included. Anonymous requests work as before. A token the API issued always carries its tenant, so local sign-ins and form access tokens are unaffected. A Keycloak sign-in runs at DefaultTenantId.

Who is affected:

  • Clients that send a Google or custom-provider token to the API. The API has no authorization strategy for those tokens, so every such request gets 403. See Google OAuth Setup.
  • Keycloak sign-ins whose authorization data could not be loaded, for example while token introspection is down.

What to do: send the Endatix JWT the API issues, or sign in through Keycloak with DefaultTenantId set.

Keycloak users stored at another tenant​

Most installations need no action.

What changed: a Keycloak sign-in finds or creates the user at DefaultTenantId only. A user already stored at another tenant, tenant 0 included, gets 403 with "Your account is not approved for this tenant. Contact your administrator to be approved." A locked-out user gets the same message. Sign-in never moves a user to another tenant, and nothing about the user changes. The API log names the user, the user's tenant and the configured DefaultTenantId, or says the user is locked out.

Who is affected: hosts that ran Keycloak sign-in without DefaultTenantId. Two kinds of users sit at tenant 0:

  • Users that Keycloak sign-ins created before DefaultTenantId was required. Most hosts have none.
  • Users whose access an administrator removed. Removing access moves a user to tenant 0, and they must stay there.

What to do:

  • Unlock a locked-out user.
  • An administrator approves a user at tenant 0 by inviting them to the tenant again. A user stored at another tenant cannot be invited while they belong there, since their email is already registered: remove their access at that tenant first, then invite them.
  • For legacy tenant-0 users only, run the one-time step below.
One-time step: move legacy tenant-0 Keycloak users to your tenant

Run step 1 first. It lists the Keycloak users at tenant 0 and changes nothing. Check every row: a user whose access was removed is in the same list. The email and the last sign-in help you recognise each user before you choose. Copy only the ids of legacy users into step 2. Step 2 moves only those ids, only while they are still Keycloak users at tenant 0, and only to a tenant that exists. It prints each user it moved and the tenant it moved to. A user whose email is already used at that tenant stops the move, and nothing is changed; resolve that user first.

PostgreSQL (psql):

-- Step 1, dry run: lists Keycloak users at tenant 0 and moves nothing.
SELECT "Id", "AuthProvider", "ExternalSubjectId", "TenantId", "Email", "LastLoginAt"
FROM identity."Users"
WHERE "TenantId" = 0 AND "AuthProvider" = 'Keycloak'
ORDER BY "Id";

-- Step 2: moves the listed users. Save these lines as move-keycloak-users.sql and run it with
-- psql -v tenant_id=<DefaultTenantId> -v user_ids='<id>,<id>' -f move-keycloak-users.sql
BEGIN;
UPDATE identity."Users" AS u
SET "TenantId" = :tenant_id, "ConcurrencyStamp" = gen_random_uuid()::text
WHERE u."Id" IN (:user_ids)
AND u."TenantId" = 0
AND u."AuthProvider" = 'Keycloak'
AND EXISTS (SELECT 1 FROM public."Tenants" t WHERE t."Id" = :tenant_id AND NOT t."IsDeleted")
RETURNING u."Id", u."AuthProvider", u."ExternalSubjectId", u."TenantId";
COMMIT;

SQL Server:

-- Step 1, dry run: lists Keycloak users at tenant 0 and moves nothing.
SET QUOTED_IDENTIFIER ON;

SELECT [Id], [AuthProvider], [ExternalSubjectId], [TenantId], [Email], [LastLoginAt]
FROM [identity].[Users]
WHERE [TenantId] = 0 AND [AuthProvider] = N'Keycloak'
ORDER BY [Id];

-- Step 2: set the tenant and the ids from step 1, then run.
DECLARE @TenantId bigint = <DefaultTenantId>;
DECLARE @UserIds TABLE ([Id] bigint PRIMARY KEY);
INSERT INTO @UserIds ([Id]) VALUES (<id>), (<id>);

BEGIN TRANSACTION;
UPDATE u
SET u.[TenantId] = @TenantId, u.[ConcurrencyStamp] = CONVERT(nvarchar(36), NEWID())
OUTPUT inserted.[Id], inserted.[AuthProvider], inserted.[ExternalSubjectId], inserted.[TenantId]
FROM [identity].[Users] AS u
JOIN @UserIds AS ids ON ids.[Id] = u.[Id]
WHERE u.[TenantId] = 0
AND u.[AuthProvider] = N'Keycloak'
AND EXISTS (SELECT 1 FROM [dbo].[Tenants] AS t WHERE t.[Id] = @TenantId AND t.[IsDeleted] = 0);
COMMIT TRANSACTION;

A moved user signs in with the roles the Keycloak role mappings give them at the tenant. Roles they held at tenant 0 no longer apply, unless they are system roles.

TenantMiddleware moved​

What changed: TenantMiddleware moved from Endatix.Infrastructure.Multitenancy to Endatix.Api.Infrastructure, and its InvokeAsync now takes IOptions<EndatixJwtOptions> as a third parameter. Its log category is now Endatix.Api.Infrastructure.TenantMiddleware.

Who is affected: hosts that register the middleware by type, or filter logs by its category. Hosts that call UseMultitenancy() or UseEndatix() are unaffected.

What to do: change the using to Endatix.Api.Infrastructure and update any log filter. To resolve a tenant outside the middleware, call Endatix.Infrastructure.Multitenancy.TenantContextInitializer.TryInitialize.

Role changes from code​

What changed: IRoleManagementService refuses a role change with no signed-in user, or for a user outside the current tenant.

Who is affected: code that assigns roles outside a user's request, such as background jobs, provisioning or seeding, and code that implements IRoleManagementService, which gained EnsureCurrentUserCanGrantRolesAsync.

What to do: assign roles from system code with ISystemRoleAssignment.AssignRoleAsSystemAsync, and implement the new member.

Webhooks go only to public addresses​

What changed:

  • Saving a form whose webhook endpoint URL names a private or local IP address or a reserved name (localhost, *.localhost, *.internal, *.local) returns 400.
  • Saving a form whose webhook endpoint URL is not an absolute http or https URL returns 400. Endpoints already stored are not changed.
  • Endpoints already stored with such a URL, at the form, the tenant or in server configuration (Endatix:WebHooks:Tenants), get no request. The API logs the refusal with the endpoint key and the form id and does not retry it. A job-queue delivery ends as failed with "The webhook endpoint address is not allowed."
  • An endpoint whose host name resolves to a private address is refused the same way when the webhook is sent.
  • Redirects are not followed: a 3xx answer is a failed delivery.
  • Webhooks use no proxy, even when HTTP_PROXY or HTTPS_PROXY is set.

Who is affected: hosts whose webhook receivers run on their own network (a cluster-internal service, localhost during development), and hosts that send webhooks through a proxy or rely on redirects.

What to do: for receivers on your own network, set Endatix:WebHooks:ServerSettings:AllowPrivateNetworkTargets to true (environment variable Endatix__WebHooks__ServerSettings__AllowPrivateNetworkTargets=true). See Endpoint addresses. Point endpoints that redirect at their final URL. Proxy support is not available in 0.9.2.

Public form data lists​

What changed:

  • GET public/forms/{formId}/data-lists/{dataListId}/search answers only for a data list the form's active definition uses. Any other list returns 404, the same as a list that does not exist.
  • GET public/forms/{formId}/data-lists/{dataListId}/display-values answers for a list that any definition of the form uses (the active one, a draft or an older one), so older submissions keep their labels. Any other list returns 404.
  • A form access token follows the form's current state. A token issued for a public form gets 403 once the form is no longer public. A token for a form that is disabled or deleted gets 404.
  • Each client may make 60 requests a minute to POST public/forms/{formId}/access-tokens, and 300 a minute to each data-list route. Above that the API returns 429.

Who is affected: embedders and integrations that call these routes directly.

What to do:

  • Search only the lists the form's active definition uses.
  • Treat 403 or 404 from a data-list route as a form that is no longer available to that token.
  • Cache form access tokens until they expire instead of requesting one per call, and retry a 429 after a pause.
  • Behind a reverse proxy, forward the client address in X-Forwarded-For. Without it, every client counts as one.

See Public search and display-values.

POST /api/slacktoken is removed​

What changed: the undocumented POST /api/slacktoken route is removed and returns 404. SlackToken, SlackTokenRequest and EndatixEventIds.Api.SlackTokenReceived (event id 6202) are removed from the packages.

Who is affected: clients that call the route, code that references those types, and log filters on event id 6202.

What to do: stop calling the route and remove the references. Slack notifications are unchanged; they keep using the tenant's Slack settings.

Limitations​

  • An upgrade that skips 0.9.1 is not covered here. Read the upgrade guide and release notes of every version in between (see Upgrading Endatix).

See also​