Description
getApplicationVariable() returns the at-rest encrypted envelope (enc:v2:...) instead of the plaintext value when called from an application front component.
This affects every application variable declared with isSecret: false. These variables are explicitly intended to be exposed to front components, so this makes the feature unusable for browser-safe configuration such as public Mapbox access tokens.
Reproduction
Define a non-secret application variable:
MAPBOX_PUBLIC_ACCESS_TOKEN: {
universalIdentifier: getIdentifier(
'applicationVariables',
'mapboxPublicAccessToken',
),
description: 'Client-side Mapbox access token used to render Mapbox Maps.',
type: FieldType.TEXT,
isSecret: false,
},
Set its value in the application settings, then use it from a front component:
import { getApplicationVariable } from 'twenty-sdk/front-component'
const token = getApplicationVariable('MAPBOX_PUBLIC_ACCESS_TOKEN')
console.log(token)
Actual behavior
token is an encrypted envelope, e.g.:
Expected behavior
token should be the plaintext configured value, e.g.:
Secret variables must continue to be omitted entirely from front-component context.
Root cause
The front-component resolver correctly filters out variables where isSecret === true, but it forwards the encrypted database/cache value without decrypting it:
[strip-secret-from-application-variables.ts](https://github.com/twentyhq/twenty/blob/dea1f899045b6e6690724f999eb879faae977248/packages/twenty-server/src/engine/metadata-modules/front-component/utils/strip-secret-from-application-variables.ts)
acc[flatApplicationVariable.key] = String(
flatApplicationVariable.value ?? '',
);
flatApplicationVariable.value is the persisted encrypted value. The resolver needs to decrypt non-secret application variables before serializing them into the front-component environment.
Regression
This behavior shipped with the front-component application-variable feature in twenty/v2.10.0 and remains present in v2.25.0. Strictly speaking, it is not a regression from an earlier working version of this API—the feature itself was introduced already broken.
Technical inputs
Twenty version: v2.25.0
Introduced in: twenty/v2.10.0
Introducing commit: [dea1f899045b6e6690724f999eb879faae977248](https://github.com/twentyhq/twenty/commit/dea1f899045b6e6690724f999eb879faae977248) — Inject none secret env variables into front components (#20511)
Description
getApplicationVariable()returns the at-rest encrypted envelope (enc:v2:...) instead of the plaintext value when called from an application front component.This affects every application variable declared with
isSecret: false. These variables are explicitly intended to be exposed to front components, so this makes the feature unusable for browser-safe configuration such as public Mapbox access tokens.Reproduction
Define a non-secret application variable:
Set its value in the application settings, then use it from a front component:
Actual behavior
tokenis an encrypted envelope, e.g.:Expected behavior
tokenshould be the plaintext configured value, e.g.:Secret variables must continue to be omitted entirely from front-component context.
Root cause
The front-component resolver correctly filters out variables where
isSecret === true, but it forwards the encrypted database/cache value without decrypting it:[strip-secret-from-application-variables.ts](https://github.com/twentyhq/twenty/blob/dea1f899045b6e6690724f999eb879faae977248/packages/twenty-server/src/engine/metadata-modules/front-component/utils/strip-secret-from-application-variables.ts)flatApplicationVariable.valueis the persisted encrypted value. The resolver needs to decrypt non-secret application variables before serializing them into the front-component environment.Regression
This behavior shipped with the front-component application-variable feature in
twenty/v2.10.0and remains present inv2.25.0. Strictly speaking, it is not a regression from an earlier working version of this API—the feature itself was introduced already broken.Technical inputs
Twenty version:
v2.25.0Introduced in:
twenty/v2.10.0Introducing commit:
[dea1f899045b6e6690724f999eb879faae977248](https://github.com/twentyhq/twenty/commit/dea1f899045b6e6690724f999eb879faae977248)—Inject none secret env variables into front components (#20511)