feat: restrict an api key to tagged servers from the create dialog

This commit is contained in:
2026-09-08 14:12:10 +00:00
parent ac9cc57e7e
commit 2d6b5bd8a3
5 changed files with 179 additions and 5 deletions
+10 -1
View File
@@ -303,6 +303,9 @@ export type ApiToken = {
last_used_at?: string | null;
user_id: string;
user_email?: string;
/** Restricts the token to servers carrying every pair. Absent or empty is
* the whole fleet — the asymmetry is deliberate, see services.MatchesSelector. */
tag_selector?: Record<string, string> | null;
};
export interface SecretGroupSummary {
@@ -880,7 +883,13 @@ export const api = {
return request<{ scopes: string[] }>("/tokens/scopes");
},
createApiToken(body: { name: string; role: Role; scopes: string[]; expires_in_days?: number | null }): Promise<{ token: string; record: ApiToken }> {
createApiToken(body: {
name: string;
role: Role;
scopes: string[];
tag_selector?: Record<string, string>;
expires_in_days?: number | null;
}): Promise<{ token: string; record: ApiToken }> {
return request<{ token: string; record: ApiToken }>("/tokens", {
method: "POST",
body: JSON.stringify(body),