Skip to content

Commit 61e1a9f

Browse files
authored
Merge pull request #149 from phasehq/feat--add-cross-app-secret-ref-syntax
feat: add cross app secret ref syntax
2 parents b507afd + 884623d commit 61e1a9f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/pages/cli/commands.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ This command checks for updates and installs the latest version of the Phase CLI
719719

720720
---
721721

722-
## Secret referencing
722+
## 🔗 Secret referencing
723723

724724
You can set a value of a secret to a value of another by simply pointing to it via the following syntax.
725725

@@ -731,6 +731,7 @@ You can set a value of a secret to a value of another by simply pointing to it v
731731
| `${staging.DEBUG}` | `staging` | `/` (root of staging environment) | DEBUG | Cross-environment reference to a secret at the root (/). |
732732
| `${production./frontend/SECRET_KEY}` | `production` | `/frontend/` | SECRET_KEY | Cross-environment reference to a secret in a specific path. |
733733
| `${/backend/payments/STRIPE_KEY}` | same environment | `/backend/payments/` | STRIPE_KEY | Local reference with a specified path within the same environment. |
734+
| `${backend_api::production./frontend/SECRET_KEY}` | `production` (in `backend_api` app) | `/frontend/` | SECRET_KEY | Cross-application reference to a secret in a specific path within another application. |
734735

735736
For more information see: [Phase Console Secrets](/console/secrets)
736737

src/pages/console/secrets.mdx

+11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ DATABASE_URL=postgresql://j_mclaren:6c37810ec6e74ec3228416d2844564fceb99ebd94b29
5858
| `${staging.DEBUG}` | `staging` | `/` (root of staging environment) | DEBUG | Cross-environment reference to a secret at the root (/). |
5959
| `${production./frontend/SECRET_KEY}` | `production` | `/frontend/` | SECRET_KEY | Cross-environment reference to a secret in a specific path. |
6060
| `${/backend/payments/STRIPE_KEY}` | same environment | `/backend/payments/` | STRIPE_KEY | Local reference with a specified path within the same environment. |
61+
| `${backend_api::production./frontend/SECRET_KEY}` | `production` (in `backend_api` app) | `/frontend/` | SECRET_KEY | Cross-application reference to a secret in a specific path within another application. |
62+
63+
#### Please note the following when using secret referencing:
64+
65+
- **Authentication requirements**: Your authentication token must have access to all referenced secrets across apps, environments, and paths. If access is insufficient, the reference won't be resolved and will be returned with the original syntax. For example, if you have access to the `production` environment in `backend_api` but not in `frontend`, the value `${backend_api::production./frontend/SECRET_KEY}` will remain unresolved.
66+
67+
- **Third-party sync integration behavior**: When syncing to third-party services, Phase requires all secret references to be resolvable. The sync will fail if any referenced secret doesn't exist in its specified location (locally, in a path, or in an app). This design ensures third-party platforms never receive broken references, as many support their own native referencing syntax.
68+
69+
- **Name collision handling**: If two or more applications in your organization share the same name (case insensitive), any secret reference to these applications will be deemed ambiguous and will be returned unresolved when accessed via the REST API. Additionally, any sync operation involving these ambiguous references will fail with an error message.
70+
71+
- **Server-side Encryption (SSE)**: For references to resolve over the Public API or native integrations, all referenced apps must have SSE enabled. If a secret is being referenced in an app without SSE, the reference will not resolve and will be returned as-is over the API, and sync jobs will fail. Note: SSE is not required for references to resolve when using E2E enabled clients such as the CLI or SDKs.
6172

6273
## Override a Secret (Personal Secrets)
6374

0 commit comments

Comments
 (0)