# Environment variables and secrets

Source: https://cubibase.com/docs/functions/secrets

Also available: [Markdown version](https://cubibase.com/docs/functions/secrets.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

Per-function configuration in two classes: plain environment variables for non-sensitive values, and encrypted secrets for credentials. Both reach your code as ctx.env at invocation time.

## Variables vs secrets

|  | Environment variables | Secrets |
| --- | --- | --- |
| Visible in the Console | Yes, to project members | Names and timestamps only — never values |
| Storage | Function metadata | Encrypted at rest in the platform secrets store |
| Use for | Model names, sender addresses, feature flags | API keys, webhook signing secrets, tokens |
| In code | ctx.env.NAME | ctx.env.NAME (identical) |

- Names use uppercase letters, digits and underscores; a name cannot be both a variable and a secret.
- Platform-reserved prefixes (CUBIBASE_, AWS_) are rejected for your own values.
- Saving a secret again under the same name rotates it. Deleting one destroys the encrypted value.
- Values are snapshotted into each deployment. After changing configuration, redeploy so the active version picks it up — the Console tells you when this is needed.

## What never happens

- Secret values are never returned by read APIs, never included in deployment logs, and never sent to the browser after the initial save.
- Execution logs are redacted: authorization headers, bearer tokens, API keys and common credential patterns are masked before storage.
- One function cannot read another function’s secrets, and no function can read another project’s anything.
- The HMAC signing secret is separate from your named secrets, shown once at creation/rotation, with the previous secret kept valid during rollover.

> **warning**: Do not paste credentials into source code. Source is readable by every project member and is stored as the editable working copy. Use the Secrets tab.

## Additional resources

- [Signed payloads](https://cubibase.com/docs/functions/signatures) Managing the HMAC signing secret.
- [Templates](https://cubibase.com/docs/functions/templates) Each template lists its required secrets.
