Summary
Budibase exposed Snowflake datasource private keys in plaintext because its secret-masking logic only handled password-typed fields and skipped fields typed as SENSITIVE_LONGFORM.
An authenticated BASIC user with any app role could call the datasource retrieval endpoint and receive the full Snowflake PEM private key, risking unauthorized database access and broader environment compromise.
Affected context
This vulnerability appears in Budibase server deployments using the Snowflake integration where datasource configurations are retrievable via the /api/datasources/:datasourceId endpoint.
It specifically affects environments where:
- Snowflake datasources are configured with a
privateKeyfield typed asSENSITIVE_LONGFORM - The same Budibase instance grants BASIC users any application role
- Datasource metadata is accessible through authorized routes protected by
PermissionType.TABLEwithPermissionLevel.READ
In such setups, the masking layer applies only to fields typed as DatasourceFieldType.PASSWORD, leaving the Snowflake PEM private key unmasked.
Exploit preconditions
- Attack surface: HTTP API endpoint
GET /api/datasources/:datasourceIdon the Budibase server. - Required access:
- Valid authenticated Budibase account classified as BASIC user (non-admin),
- Any app role that satisfies TABLE read permissions for the targeted datasource.
- Trigger point: Calling the datasource retrieval endpoint for a Snowflake datasource whose configuration includes a
privateKeydefined asSENSITIVE_LONGFORM. - Why exploitation is possible:
- The
removeSecretshelper filters out only fields typed asDatasourceFieldType.PASSWORD. - The Snowflake
privateKeyfield is typed asSENSITIVE_LONGFORM, so it is not recognized as a secret and passes through unmasked. - The authorized route design assumes masking occurs at the server layer, so it returns the raw configuration, including the PEM private key.
Why this happens
The underlying issue is an incomplete and type-coupled secret-scrubbing implementation in the Budibase server.
The removeSecrets function in packages/server/src/sdk/workspace/datasources/datasources.ts is designed to strip sensitive values from datasource configurations before they are returned to clients.
However, it relies on a narrow type check, masking only fields whose schema type is DatasourceFieldType.PASSWORD.
The Snowflake integration models its privateKey as SENSITIVE_LONGFORM, which is semantically sensitive but not included in the masking logic.
This mismatch between data classification and masking rules leads to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because the server returns unredacted secret material to users with broader access than intended.
Potential impact
- Attackers with BASIC accounts could obtain Snowflake PEM private keys and use them to authenticate directly against Snowflake, depending on external controls.
- Unauthorized reading or modification of data stored in the Snowflake warehouse connected to the Budibase app.
- Lateral movement into other systems if the same or similar keys are reused or if Snowflake access yields additional secrets.
- Breach of data confidentiality and potential regulatory or compliance violations due to exposure of production data.
- Increased risk of long-lived compromise if private keys are not rotated promptly after leak.
General mitigation guidance
Effective mitigation focuses on robust, schema-independent secret handling and least-privilege data exposure patterns:
- Treat all fields explicitly marked as sensitive (e.g., SENSITIVE_LONGFORM, secret, token, key) as secrets, not just password-typed fields.
- Centralize secret classification so that any new secret-like field type is automatically included in masking/redaction routines.
- Apply a deny-by-default approach: redact all non-essential configuration fields from API responses, whitelisting only metadata required by the client.
- Separate storage of secrets from general configuration, ideally using dedicated secret stores or encrypted fields that are never returned via general-purpose read endpoints.
- Enforce least privilege on application roles: only components that strictly require secrets for connection management should access them, and clients should rely on server-side connection management rather than handling raw keys.
- Encourage operational practices such as key rotation and distinct keys per environment to reduce blast radius if a secret is exposed.
How teams detect issues like this
Detection and prevention can be supported by layered review and policy mechanisms:
- Static analysis and linters: Define rules that flag API responses returning fields whose names or types suggest secrets (e.g.,
key,token,secret,privateKey, or custom sensitive enums). - Schema-driven checks: Implement tests that iterate over datasource schemas and verify that all fields marked as sensitive are covered by masking logic.
- Security-focused code review: During review of integration adapters and datasource schemas, explicitly verify that any new secret-like field types are integrated into the redaction pipeline.
- Runtime logging and monitoring: Monitor access logs for patterns of non-admin users calling configuration endpoints, and alert on anomalous or high-volume reads of datasource definitions.
- Automated API contract tests: Create regression tests that call configuration endpoints and assert that sensitive values are redacted, using representative datasources like Snowflake as fixtures.

