Secret referencing
Infisical’s secret referencing functionality makes it possible to reference the value of a “base” secret when defining the value of another secret. This means that updating the value of a base secret propagates directly to other secrets whose values depend on the base secret.
Since secret referencing reconstructs values on the client side, any client (user, service token, or machine identity) fetching secrets must have proper permissions to access all base and dependent secrets. Without sufficient permissions, secret references won’t resolve to their appropriate values.
For example, if secret A references values from secrets B and C located in different scopes, the client must have read access to all three scopes containing secrets A, B, and C. If permission to any referenced secret is missing, the reference will remain unresolved, potentially causing application errors or unexpected behavior.
This is an important security consideration when planning your secret access strategy, especially when working with cross-environment or cross-folder references.
Syntax
When defining a secret reference, interpolation syntax is used to define references to secrets in other environments and folders. Suppose you have some secretMY_SECRET at the root of some environment and want to reference part of its value from another base secret BASE_SECRET located elsewhere.
Then consider the following scenarios:
- If
BASE_SECRETis in the same environment and folder asMY_SECRET, then you’d reference it using${BASE_SECRET}. - If
BASE_SECRETis at the root of another environment with the slugdev, then you’d reference it using${dev.MY_SECRET}.
A secret’s value can hold at most 100 references, counting each repeat. Creating or updating a secret past this limit fails with a
400 SecretReferenceLimitExceeded error. When you fetch secrets with references expanded, expanding one secret fails with a 400 SecretReferenceExpansionTooLarge error if its reference tree, including references inside referenced secrets, exceeds 1,000 references or 10,485,760 characters.Secret imports
Infisical’s Secret Imports functionality makes it possible to import the secrets from another environment or folder into the current folder context. This can be useful if you have common secrets that need to be available across multiple environments/folders. To add a secret import, select Add New, then select Import Secrets.
Each import appears above the secrets on the dashboard, labeled with the environment and path it pulls from. In the example below, /backend and /third-party are both imported into the current folder.
Hover over an import to reach its controls: select the trash icon on the right to delete it, or drag the handle on the left to reorder it.
Order matters. If two imports carry a secret with the same name, the value from the bottom-most import wins.
Imports and approval policies
If a change policy covers the destination folder, you choose how a new import treats that policy:- Ignore secret approval policies: the destination reads the source’s secrets directly, so a change in the source takes effect in the destination right away
- Respect secret approval policies: Infisical copies the source’s secrets into the destination, and each change in the source arrives there as a change request
Require approval for imported secrets
If a change policy has Require Approval for Imported Secrets turned on, every new import from the same project into a folder the policy covers must respect approval policies. Imports from another project aren’t affected and keep reading the source directly. In a covered folder:- You can’t create an import from the same project that ignores approval policies
- You can’t point an existing import that ignores approval policies at a different source folder
- If a folder holds an import from the same project that ignores approval policies, you can’t rename the folder to a path this policy covers unless the policy already covers the folder (this applies to machine identities that the policy lets bypass approvals too)
- A new import starts empty, and its first copy of the source’s secrets is a change request, so the destination reads nothing from that import until someone approves the request
- A change to a secret in the source folder (an addition, update, or removal) creates a change request for each destination
1
Create an import of the same source. Infisical sets the new import to respect approval policies.
2
Approve and merge the change request that copies the source’s secrets into the new import.
3
Delete the old import.
- Changes made by a machine identity that the policy lets bypass approvals, and changes Infisical makes itself, such as a secret rotation, are copied directly
- Changes made with a service token are copied directly
- Deleting or reordering the imports in a covered folder takes effect right away
- A reference to another folder inside a copied value resolves against that folder each time someone reads the secret, so editing the referenced secret changes the value without approval
Relative reference resolution in imported secrets
Only available on the V4 Secrets API (
/api/v4/secrets). v3 and below always resolve local references against the source environment.${KEY} that point to other secrets. Relative resolution changes how those local references are looked up:
Resolution order for
${KEY} inside an imported secret (e.g. staging imports from dev):
- Look in
staging(current environment) - If not found, look in
dev(source environment) - If still not found, expand to an empty string
Example
DB_URL via v4 → postgres://stg-db.internal/myapp
The ${DB_HOST} local reference resolves to staging’s value. Without relative resolution (v3), it would resolve to dev’s DB_HOST instead.
Behavior notes
- The current-env-first rule applies at every depth of recursive expansion, not just the top level. If an imported secret references another secret that references another, each
${KEY}at every level checks the current environment first. - Import-chain lookup: when looking for a key in an environment, Infisical also searches that environment’s one-level-deep imports. If prod imports from
/sharedand/sharedhasKEY, a${KEY}reference in a prod context will find it. - Permissions: read access is enforced at every step. If the calling identity lacks access to any secret in the chain, the request returns
403.
Cross-project secret sharing
Cross-project secret sharing is a paid feature.If you’re using Infisical Cloud, then it’s available under the Pro Tier. If you’re self-hosting Infisical,
then you should contact [email protected] to purchase an enterprise license to use it.
Enabling cross-project secret sharing
Cross-project sharing is controlled by an organization-level toggle. An organization admin must enable it before any cross-project references or imports can be created:- Go to the Secrets Management product page.
- Select Product Settings.
- Turn on Cross-project secret sharing.
Project grants
A Project Grant is the authorization mechanism that controls which projects can access secrets from a given source project. Grants are created from the source project (the project that owns the secrets) and specify:- Source environment and folder path: the specific location in the source project being shared.
- Target project: the project that is allowed to reference or import secrets from that location.
- Go to Project Settings in the source project.
- Select the Policies tab.
- Under Cross-Project Secret Sharing, select Share Secrets.
- Under Environments & folders, choose the environment to share from, then type a folder path and select Add. Under Share with projects, choose the project that should get access, then select Share.
Cross-project references
You can reference secrets from a different project using the@project-slug prefix. This allows you to compose secret values across projects without duplicating them.
Cross-project imports
You can also import secrets from a different project entirely. Cross-project imports work the same way as regular imports, but the source environment and folder belong to another project within the same organization. To create a cross-project import:- Select Add New, then select Import Secrets.
- Select Another Project.
- Choose the source Project, Environment, and Folder path, then select Create Import.
- The import appears at the top of the secrets dashboard, labeled with the project it pulls from.