Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add federated option

adilson7b8962a1e3ac
diff --git a/backend/src/ee/services/dynamic-secret/providers/models.ts b/backend/src/ee/services/dynamic-secret/providers/models.ts
index 9e91e36d5b..7456694457 100644
--- a/backend/src/ee/services/dynamic-secret/providers/models.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/models.ts
@@ -809,7 +809,8 @@ export const DynamicSecretIbmApiConnectSchema = z.object({
export enum TailscaleKeyAuthType {
AuthKeys = "auth_keys",
- OAuthKeys = "oauth_keys"
+ OAuthKeys = "oauth_keys",
+ FederatedKeys = "federated_keys"
}
export enum TailscaleAuthMethod {
@@ -863,6 +864,37 @@ export const DynamicSecretTailscaleSchema = z.discriminatedUnion("authType", [
.default([])
.describe("ACL tags to attach (e.g. tag:ci). Required if scopes include devices:core or auth_keys."),
scopes: z.array(z.string().trim().min(1)).min(1).describe("OAuth scopes granted to the client.")
+ }),
+ z.object({
+ authType: z.literal(TailscaleKeyAuthType.FederatedKeys),
+ auth: DynamicSecretTailscaleAuthSchema,
+ tailnet: z
+ .string()
+ .trim()
+ .min(1)
+ .default("-")
+ .describe("Tailnet identifier. Use '-' for the token owner's default tailnet."),
+ description: z
+ .string()
+ .trim()
+ .max(50)
+ .optional()
+ .describe("Description applied to the created federated identity."),
+ tags: z
+ .array(z.string().trim().min(1))
+ .default([])
+ .describe("ACL tags to attach (e.g. tag:ci). Required if scopes include devices:core or auth_keys."),
+ scopes: z
+ .array(z.string().trim().min(1))
+ .min(1)
+ .describe("OAuth scopes granted to tokens issued via this federated identity."),
+ issuer: z.string().trim().min(1).describe("HTTPS URL of the OIDC issuer trusted for token exchange."),
+ subject: z.string().trim().min(1).describe("Pattern matched against the sub claim of the OIDC identity token."),
+ audience: z
+ .string()
+ .trim()
+ .optional()
+ .describe("Audience for the OIDC token exchange. Tailscale auto-generates one if omitted.")
})
]);
diff --git a/backend/src/ee/services/dynamic-secret/providers/tailscale.ts b/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
index 2ef18fd2a5..8d3c851f03 100644
--- a/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
@@ -14,7 +14,10 @@ type TTailscaleAuth = TTailscaleProviderInputs["auth"];
type TTailscaleKeyResponse = {
id: string;
- key: string;
+ // auth keys and OAuth clients return a secret in `key`; federated identities do not.
+ key?: string;
+ // federated identities return the audience.
+ audience?: string;
};
type TTailscaleOAuthTokenResponse = {
@@ -32,8 +35,7 @@ export const TailscaleProvider = (): TDynamicProviderFns => {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json"
},
- timeout: 30000,
- maxRedirects: 0
+ timeout: 30000
});
// Secrets to redact from any surfaced error message.
@@ -56,8 +58,7 @@ export const TailscaleProvider = (): TDynamicProviderFns => {
}).toString(),
{
headers: { "Content-Type": "application/x-www-form-urlencoded" },
- timeout: 30000,
- maxRedirects: 0
+ timeout: 30000
}
);
@@ -90,43 +91,67 @@ export const TailscaleProvider = (): TDynamicProviderFns => {
const url = `${TAILSCALE_API_BASE_URL}/tailnet/${encodeURIComponent(providerInputs.tailnet)}/keys`;
let body: Record<string, unknown>;
- if (providerInputs.authType === TailscaleKeyAuthType.AuthKeys) {
- // Tailscale expires auth keys after expirySeconds; align it with the lease TTL as defense-in-depth.
- const expirySeconds = Math.max(Math.floor(expireAt / 1000) - Math.floor(Date.now() / 1000), 0);
- body = {
- keyType: "auth",
- description: providerInputs.description,
- expirySeconds,
- capabilities: {
- devices: {
- create: {
- reusable: providerInputs.reusable,
- ephemeral: false,
- preauthorized: providerInputs.preauthorized,
- tags: providerInputs.tags
+ switch (providerInputs.authType) {
+ case TailscaleKeyAuthType.AuthKeys: {
+ // Tailscale expires auth keys after expirySeconds; align it with the lease TTL as defense-in-depth.
+ const expirySeconds = Math.max(Math.floor(expireAt / 1000) - Math.floor(Date.now() / 1000), 0);
+ body = {
+ keyType: "auth",
+ description: providerInputs.description,
+ expirySeconds,
+ capabilities: {
+ devices: {
+ create: {
+ reusable: providerInputs.reusable,
+ ephemeral: false,
+ preauthorized: providerInputs.preauthorized,
+ tags: providerInputs.tags
+ }
}
}
- }
- };
- } else {
- body = {
- keyType: "client",
- description: providerInputs.description,
- scopes: providerInputs.scopes,
- tags: providerInputs.tags
- };
+ };
+ break;
+ }
+ case TailscaleKeyAuthType.OAuthKeys:
+ body = {
+ keyType: "client",
+ description: providerInputs.description,
+ scopes: providerInputs.scopes,
+ tags: providerInputs.tags
+ };
+ break;
+ case TailscaleKeyAuthType.FederatedKeys:
+ // Federated identities carry no secret and never expire on their own; the lease revoke deletes them.
+ body = {
+ keyType: "federated",
+ description: providerInputs.description,
+ scopes: providerInputs.scopes,
+ tags: providerInputs.tags,
+ issuer: providerInputs.issuer,
+ subject: providerInputs.subject,
+ ...(providerInputs.audience ? { audience: providerInputs.audience } : {})
+ };
+ break;
+ default: {
+ const exhaustiveCheck: never = providerInputs;
+ throw new Error(`Unhandled Tailscale auth type: ${JSON.stringify(exhaustiveCheck)}`);
+ }
}
try {
const token = await $getBearerToken(providerInputs.auth);
const response = await safeRequest.post<TTailscaleKeyResponse>(url, body, $requestConfig(token));
- const { id, key } = response.data;
+ const { id, key, audience } = response.data;
if (providerInputs.authType === TailscaleKeyAuthType.AuthKeys) {
return { entityId: id, data: { AUTH_KEY: key, KEY_ID: id } };
}
- return { entityId: id, data: { CLIENT_ID: id, CLIENT_SECRET: key } };
+ if (providerInputs.authType === TailscaleKeyAuthType.OAuthKeys) {
+ return { entityId: id, data: { CLIENT_ID: id, CLIENT_SECRET: key } };
+ }
+
+ return { entityId: id, data: { FEDERATED_CREDENTIAL_ID: id, AUDIENCE: audience ?? "" } };
} catch (err) {
logger.error(err as Error);
const sanitizedErrorMessage = sanitizeString({
diff --git a/docs/documentation/platform/dynamic-secrets/tailscale.mdx b/docs/documentation/platform/dynamic-secrets/tailscale.mdx
index d47f9d20e7..9fb69b9f6d 100644
--- a/docs/documentation/platform/dynamic-secrets/tailscale.mdx
+++ b/docs/documentation/platform/dynamic-secrets/tailscale.mdx
@@ -1,9 +1,9 @@
---
title: "Tailscale"
-description: "Learn how to dynamically generate Tailscale auth keys and OAuth clients."
+description: "Learn how to dynamically generate Tailscale auth keys, OAuth clients, and federated identities."
---
-The Infisical Tailscale dynamic secret allows you to generate short-lived Tailscale auth keys and OAuth clients on demand. Each lease creates a new credential in your tailnet, and Infisical automatically revokes it when the lease expires.
+The Infisical Tailscale dynamic secret allows you to generate short-lived Tailscale auth keys, OAuth clients, and federated identities on demand. Each lease creates a new credential in your tailnet, and Infisical automatically revokes it when the lease expires.
## Prerequisites
@@ -86,7 +86,7 @@ Infisical needs a credential that is allowed to create and revoke keys in your t
</ParamField>
<ParamField path="Key Type" type="string" required>
- The type of credential to mint on each lease. Choose **Auth Key** to generate a device auth key, or **OAuth Client** to generate a tailnet OAuth client.
+ The type of credential to mint on each lease. Choose **Auth Key** to generate a device auth key, **OAuth Client** to generate a tailnet OAuth client, or **Federated Identity** to create a workload identity federation trust. A federated identity returns an identifier and audience rather than a secret.
</ParamField>
<ParamField path="Tailnet" type="string" required default="-">
@@ -102,7 +102,19 @@ Infisical needs a credential that is allowed to create and revoke keys in your t
</ParamField>
<ParamField path="Scopes" type="string" required>
- Comma-separated OAuth scopes granted to the client (e.g. `devices:core, auth_keys`). Shown and required only when the key type is **OAuth Client**.
+ Comma-separated OAuth scopes granted to the credential (e.g. `devices:core, auth_keys`). Shown and required when the key type is **OAuth Client** or **Federated Identity**.
+ </ParamField>
+
+ <ParamField path="Issuer" type="string" required>
+ HTTPS URL of the OIDC issuer trusted for token exchange (e.g. `https://token.actions.githubusercontent.com`). Shown and required only when the key type is **Federated Identity**.
+ </ParamField>
+
+ <ParamField path="Subject" type="string" required>
+ Pattern matched against the `sub` claim of the OIDC identity token; supports wildcards (e.g. `repo:my-org/my-repo:*`). Shown and required only when the key type is **Federated Identity**.
+ </ParamField>
+
+ <ParamField path="Audience" type="string">
+ Audience for the OIDC token exchange. Leave blank to let Tailscale auto-generate one, which is then returned in the lease output. Shown only when the key type is **Federated Identity**.
</ParamField>
<ParamField path="Reusable" type="boolean" default="false">
@@ -128,15 +140,16 @@ Infisical needs a credential that is allowed to create and revoke keys in your t
![Provision Lease](/images/platform/dynamic-secrets/provision-lease.png)
- Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. The values returned depend on the key type:
+ Once you click the `Submit` button, a new lease will be generated and its values will be shown to you. The values returned depend on the key type:
- - **Auth Key** — an `AUTH_KEY` (the Tailscale auth key) and its `KEY_ID`.
- - **OAuth Client** — a `CLIENT_ID` and `CLIENT_SECRET`.
+ - **Auth Key**: an `AUTH_KEY` (the Tailscale auth key) and its `KEY_ID`.
+ - **OAuth Client**: a `CLIENT_ID` and `CLIENT_SECRET`.
+ - **Federated Identity**: a `FEDERATED_CREDENTIAL_ID` and an `AUDIENCE`. No secret is issued; the workload authenticates by exchanging its own OIDC token for a short-lived Tailscale token.
![Dynamic Secret Lease](/images/platform/dynamic-secrets/tailscale/lease.png)
<Warning>
- Copy these credentials right away. For security reasons, the secret value is only shown once at creation time and cannot be retrieved again afterwards.
+ Copy these values right away. For security reasons, secret values (auth keys and client secrets) are only shown once at creation time and cannot be retrieved again afterwards.
</Warning>
</Step>
</Steps>
@@ -145,12 +158,12 @@ Infisical needs a credential that is allowed to create and revoke keys in your t
Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard.
-This will allow you to see the expiration time of the lease or delete a lease before its set time to live. Revoking a lease deletes the corresponding key in your tailnet.
+This will allow you to see the expiration time of the lease or delete a lease before its set time to live. Revoking a lease deletes the corresponding credential in your tailnet.
![Lease Data](/images/platform/dynamic-secrets/lease-data.png)
## Renew Leases
<Note>
- Tailscale keys are immutable once created and cannot be renewed. To obtain a fresh credential, generate a new lease instead.
+ Tailscale credentials are immutable once created and cannot be renewed. To obtain a fresh credential, generate a new lease instead.
</Note>
diff --git a/frontend/src/hooks/api/dynamicSecret/types.ts b/frontend/src/hooks/api/dynamicSecret/types.ts
index e0b35eb8c9..3fa34400a8 100644
--- a/frontend/src/hooks/api/dynamicSecret/types.ts
+++ b/frontend/src/hooks/api/dynamicSecret/types.ts
@@ -50,7 +50,8 @@ export enum DynamicSecretProviders {
export enum TailscaleKeyAuthType {
AuthKeys = "auth_keys",
- OAuthKeys = "oauth_keys"
+ OAuthKeys = "oauth_keys",
+ FederatedKeys = "federated_keys"
}
export enum TailscaleAuthMethod {
@@ -558,6 +559,19 @@ export type TDynamicSecretProvider =
description?: string;
tags: string[];
scopes: string[];
+ }
+ | {
+ authType: TailscaleKeyAuthType.FederatedKeys;
+ auth:
+ | { method: TailscaleAuthMethod.ApiKey; apiKey: string }
+ | { method: TailscaleAuthMethod.OAuth; clientId: string; clientSecret: string };
+ tailnet: string;
+ description?: string;
+ tags: string[];
+ scopes: string[];
+ issuer: string;
+ subject: string;
+ audience?: string;
};
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TailscaleInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TailscaleInputForm.tsx
index 83b2f95b72..3f93303f6c 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TailscaleInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TailscaleInputForm.tsx
@@ -67,6 +67,21 @@ const formSchema = z
description: z.string().trim().max(50).optional(),
tags: z.string().trim().optional(),
scopes: z.string().trim().min(1, "At least one scope is required")
+ }),
+ z.object({
+ authType: z.literal(TailscaleKeyAuthType.FederatedKeys),
+ auth: tailscaleAuthSchema,
+ tailnet: z.string().trim().min(1, "Tailnet is required"),
+ description: z.string().trim().max(50).optional(),
+ tags: z.string().trim().optional(),
+ scopes: z.string().trim().min(1, "At least one scope is required"),
+ issuer: z
+ .string()
+ .trim()
+ .min(1, "Issuer is required")
+ .url("Issuer must be a valid https URL"),
+ subject: z.string().trim().min(1, "Subject is required"),
+ audience: z.string().trim().optional()
})
]),
defaultTTL: z.string().superRefine(validateTTL),
@@ -104,6 +119,10 @@ const splitCsv = (val?: string) =>
.filter(Boolean)
: [];
+const assertNever = (value: never): never => {
+ throw new Error(`Unhandled Tailscale auth type: ${String(value)}`);
+};
+
const buildAuth = (auth: TForm["provider"]["auth"]): TailscaleInputs["auth"] =>
auth.method === TailscaleAuthMethod.ApiKey
? { method: TailscaleAuthMethod.ApiKey, apiKey: auth.apiKey }
@@ -113,6 +132,45 @@ const buildAuth = (auth: TForm["provider"]["auth"]): TailscaleInputs["auth"] =>
clientSecret: auth.clientSecret
};
+const buildInputs = (
+ provider: TForm["provider"],
+ auth: TailscaleInputs["auth"]
+): TailscaleInputs => {
+ const base = {
+ auth,
+ tailnet: provider.tailnet,
+ description: provider.description || undefined,
+ tags: splitCsv(provider.tags)
+ };
+
+ switch (provider.authType) {
+ case TailscaleKeyAuthType.AuthKeys:
+ return {
+ ...base,
+ authType: provider.authType,
+ reusable: provider.reusable,
+ preauthorized: provider.preauthorized
+ };
+ case TailscaleKeyAuthType.OAuthKeys:
+ return {
+ ...base,
+ authType: provider.authType,
+ scopes: splitCsv(provider.scopes)
+ };
+ case TailscaleKeyAuthType.FederatedKeys:
+ return {
+ ...base,
+ authType: provider.authType,
+ scopes: splitCsv(provider.scopes),
+ issuer: provider.issuer,
+ subject: provider.subject,
+ audience: provider.audience || undefined
+ };
+ default:
+ return assertNever(provider.authType);
+ }
+};
+
type Props = {
onCompleted: () => void;
onCancel: () => void;
@@ -165,26 +223,7 @@ export const TailscaleInputForm = ({
if (createDynamicSecret.isPending) return;
const auth = buildAuth(provider.auth);
-
- const inputs: TailscaleInputs =
- provider.authType === TailscaleKeyAuthType.AuthKeys
- ? {
- authType: TailscaleKeyAuthType.AuthKeys,
- auth,
- tailnet: provider.tailnet,
- description: provider.description || undefined,
- tags: splitCsv(provider.tags),
- reusable: provider.reusable,
- preauthorized: provider.preauthorized
- }
- : {
- authType: TailscaleKeyAuthType.OAuthKeys,
- auth,
- tailnet: provider.tailnet,
- description: provider.description || undefined,
- tags: splitCsv(provider.tags),
- scopes: splitCsv(provider.scopes)
- };
+ const inputs = buildInputs(provider, auth);
await createDynamicSecret.mutateAsync({
provider: { type: DynamicSecretProviders.Tailscale, inputs },
@@ -362,6 +401,9 @@ export const TailscaleInputForm = ({
>
<SelectItem value={TailscaleKeyAuthType.AuthKeys}>Auth Key</SelectItem>
<SelectItem value={TailscaleKeyAuthType.OAuthKeys}>OAuth Client</SelectItem>
+ <SelectItem value={TailscaleKeyAuthType.FederatedKeys}>
+ Federated Identity
+ </SelectItem>
</Select>
</FormControl>
)}
@@ -421,7 +463,8 @@ export const TailscaleInputForm = ({
)}
/>
- {authType === TailscaleKeyAuthType.OAuthKeys && (
+ {(authType === TailscaleKeyAuthType.OAuthKeys ||
+ authType === TailscaleKeyAuthType.FederatedKeys) && (
<Controller
control={control}
name="provider.scopes"
@@ -441,6 +484,65 @@ export const TailscaleInputForm = ({
/>
)}
+ {authType === TailscaleKeyAuthType.FederatedKeys && (
+ <>
+ <Controller
+ control={control}
+ name="provider.issuer"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Issuer"
+ className="grow"
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ isRequired
+ helperText="HTTPS URL of the OIDC issuer trusted for token exchange."
+ >
+ <Input
+ {...field}
+ placeholder="https://token.actions.githubusercontent.com"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="provider.subject"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Subject"
+ className="grow"
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ isRequired
+ helperText="Pattern matched against the sub claim of the OIDC token (supports wildcards)."
+ >
+ <Input {...field} placeholder="repo:my-org/my-repo:*" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="provider.audience"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Audience"
+ className="grow"
+ isOptional
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ helperText="Leave blank to let Tailscale auto-generate one."
+ >
+ <Input {...field} />
+ </FormControl>
+ )}
+ />
+ </>
+ )}
+
{authType === TailscaleKeyAuthType.AuthKeys && (
<div className="flex flex-col gap-3 pt-1 pb-2">
<Controller
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
index 949caf4612..907bee6c18 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/CreateDynamicSecretLease.tsx
@@ -432,10 +432,12 @@ const renderOutputForm = (
}
if (provider === DynamicSecretProviders.Tailscale) {
- const { AUTH_KEY, CLIENT_ID, CLIENT_SECRET } = data as {
+ const { AUTH_KEY, CLIENT_ID, CLIENT_SECRET, FEDERATED_CREDENTIAL_ID, AUDIENCE } = data as {
AUTH_KEY?: string;
CLIENT_ID?: string;
CLIENT_SECRET?: string;
+ FEDERATED_CREDENTIAL_ID?: string;
+ AUDIENCE?: string;
};
if (AUTH_KEY) {
@@ -450,6 +452,21 @@ const renderOutputForm = (
);
}
+ if (FEDERATED_CREDENTIAL_ID) {
+ return (
+ <div>
+ <OutputDisplay label="Federated Credential ID" value={FEDERATED_CREDENTIAL_ID} />
+ {AUDIENCE && (
+ <OutputDisplay
+ label="Audience"
+ value={AUDIENCE}
+ helperText="Use this audience value when configuring your workload's OIDC token exchange."
+ />
+ )}
+ </div>
+ );
+ }
+
return (
<div>
<OutputDisplay label="Client ID" value={CLIENT_ID ?? ""} />
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTailscaleForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTailscaleForm.tsx
index 02d3b7b1a9..62cdfcbbd2 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTailscaleForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTailscaleForm.tsx
@@ -68,6 +68,21 @@ const formSchema = z
description: z.string().trim().max(50).optional(),
tags: z.string().trim().optional(),
scopes: z.string().trim().min(1, "At least one scope is required")
+ }),
+ z.object({
+ authType: z.literal(TailscaleKeyAuthType.FederatedKeys),
+ auth: tailscaleAuthSchema,
+ tailnet: z.string().trim().min(1, "Tailnet is required"),
+ description: z.string().trim().max(50).optional(),
+ tags: z.string().trim().optional(),
+ scopes: z.string().trim().min(1, "At least one scope is required"),
+ issuer: z
+ .string()
+ .trim()
+ .min(1, "Issuer is required")
+ .url("Issuer must be a valid https URL"),
+ subject: z.string().trim().min(1, "Subject is required"),
+ audience: z.string().trim().optional()
})
]),
defaultTTL: z.string().superRefine(validateTTL),
@@ -126,13 +141,26 @@ const hydrateInputs = (rawInputs: TailscaleInputs): TForm["inputs"] => {
preauthorized: rawInputs.preauthorized
};
}
+ if (rawInputs.authType === TailscaleKeyAuthType.OAuthKeys) {
+ return {
+ authType: TailscaleKeyAuthType.OAuthKeys,
+ auth: rawInputs.auth,
+ tailnet: rawInputs.tailnet,
+ description: rawInputs.description,
+ tags: (rawInputs.tags ?? []).join(", "),
+ scopes: (rawInputs.scopes ?? []).join(", ")
+ };
+ }
return {
- authType: TailscaleKeyAuthType.OAuthKeys,
+ authType: TailscaleKeyAuthType.FederatedKeys,
auth: rawInputs.auth,
tailnet: rawInputs.tailnet,
description: rawInputs.description,
tags: (rawInputs.tags ?? []).join(", "),
- scopes: (rawInputs.scopes ?? []).join(", ")
+ scopes: (rawInputs.scopes ?? []).join(", "),
+ issuer: rawInputs.issuer,
+ subject: rawInputs.subject,
+ audience: rawInputs.audience
};
};
@@ -177,25 +205,39 @@ export const EditDynamicSecretTailscaleForm = ({
const auth = buildAuth(inputs.auth);
- const builtInputs: TailscaleInputs =
- inputs.authType === TailscaleKeyAuthType.AuthKeys
- ? {
- authType: TailscaleKeyAuthType.AuthKeys,
- auth,
- tailnet: inputs.tailnet,
- description: inputs.description || undefined,
- tags: splitCsv(inputs.tags),
- reusable: inputs.reusable,
- preauthorized: inputs.preauthorized
- }
- : {
- authType: TailscaleKeyAuthType.OAuthKeys,
- auth,
- tailnet: inputs.tailnet,
- description: inputs.description || undefined,
- tags: splitCsv(inputs.tags),
- scopes: splitCsv(inputs.scopes)
- };
+ let builtInputs: TailscaleInputs;
+ if (inputs.authType === TailscaleKeyAuthType.AuthKeys) {
+ builtInputs = {
+ authType: TailscaleKeyAuthType.AuthKeys,
+ auth,
+ tailnet: inputs.tailnet,
+ description: inputs.description || undefined,
+ tags: splitCsv(inputs.tags),
+ reusable: inputs.reusable,
+ preauthorized: inputs.preauthorized
+ };
+ } else if (inputs.authType === TailscaleKeyAuthType.OAuthKeys) {
+ builtInputs = {
+ authType: TailscaleKeyAuthType.OAuthKeys,
+ auth,
+ tailnet: inputs.tailnet,
+ description: inputs.description || undefined,
+ tags: splitCsv(inputs.tags),
+ scopes: splitCsv(inputs.scopes)
+ };
+ } else {
+ builtInputs = {
+ authType: TailscaleKeyAuthType.FederatedKeys,
+ auth,
+ tailnet: inputs.tailnet,
+ description: inputs.description || undefined,
+ tags: splitCsv(inputs.tags),
+ scopes: splitCsv(inputs.scopes),
+ issuer: inputs.issuer,
+ subject: inputs.subject,
+ audience: inputs.audience || undefined
+ };
+ }
await updateDynamicSecret.mutateAsync({
name: dynamicSecret.name,
@@ -373,6 +415,9 @@ export const EditDynamicSecretTailscaleForm = ({
>
<SelectItem value={TailscaleKeyAuthType.AuthKeys}>Auth Key</SelectItem>
<SelectItem value={TailscaleKeyAuthType.OAuthKeys}>OAuth Client</SelectItem>
+ <SelectItem value={TailscaleKeyAuthType.FederatedKeys}>
+ Federated Identity
+ </SelectItem>
</Select>
</FormControl>
)}
@@ -432,7 +477,8 @@ export const EditDynamicSecretTailscaleForm = ({
)}
/>
- {authType === TailscaleKeyAuthType.OAuthKeys && (
+ {(authType === TailscaleKeyAuthType.OAuthKeys ||
+ authType === TailscaleKeyAuthType.FederatedKeys) && (
<Controller
control={control}
name="inputs.scopes"
@@ -452,6 +498,62 @@ export const EditDynamicSecretTailscaleForm = ({
/>
)}
+ {authType === TailscaleKeyAuthType.FederatedKeys && (
+ <>
+ <Controller
+ control={control}
+ name="inputs.issuer"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Issuer"
+ className="grow"
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ isRequired
+ helperText="HTTPS URL of the OIDC issuer trusted for token exchange."
+ >
+ <Input {...field} placeholder="https://token.actions.githubusercontent.com" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="inputs.subject"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Subject"
+ className="grow"
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ isRequired
+ helperText="Pattern matched against the sub claim of the OIDC token (supports wildcards)."
+ >
+ <Input {...field} placeholder="repo:my-org/my-repo:*" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="inputs.audience"
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Audience"
+ className="grow"
+ isOptional
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ helperText="Leave blank to let Tailscale auto-generate one."
+ >
+ <Input {...field} />
+ </FormControl>
+ )}
+ />
+ </>
+ )}
+
{authType === TailscaleKeyAuthType.AuthKeys && (
<div className="flex flex-col gap-3 pt-1 pb-2">
<Controller