Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix duplicates
Thiago Araujo da Silva4234df81e2ef
diff --git a/backend/src/server/plugins/auth/inject-identity.ts b/backend/src/server/plugins/auth/inject-identity.tsindex d2ff5af88e..8b45be2fcb 100644--- a/backend/src/server/plugins/auth/inject-identity.ts+++ b/backend/src/server/plugins/auth/inject-identity.ts@@ -320,6 +320,7 @@ export const injectIdentity = fp(parentOrgId,authMethod: token.authMethod,isMfaVerified: token.isMfaVerified,+ mfaMethod: token.mfaMethod,oauthClientId: token.oauthClientId,token};diff --git a/backend/src/services/oauth-client/oauth-client-service.ts b/backend/src/services/oauth-client/oauth-client-service.tsindex 66123f1a25..a23ceb7b64 100644--- a/backend/src/services/oauth-client/oauth-client-service.ts+++ b/backend/src/services/oauth-client/oauth-client-service.ts@@ -268,6 +268,10 @@ export const oauthClientServiceFactory = ({throw new BadRequestError({ message: `Unsupported OAuth scope(s): ${invalidScopes.join(", ")}` });}+ // Called only for its side effects: it throws if the consenting user is not a member of the+ // client's org or fails org SSO enforcement. This blocks issuing a delegation code to a user+ // who has no standing in the org the client belongs to. The returned ability is intentionally+ // unused here; scope narrowing happens later when the delegated token builds its permission.await permissionService.getOrgPermission({actor: ActorType.USER,actorId: dto.userId,diff --git a/backend/src/services/oauth-client/oauth-client-types.ts b/backend/src/services/oauth-client/oauth-client-types.tsindex d99d850a30..7cff5c6dc5 100644--- a/backend/src/services/oauth-client/oauth-client-types.ts+++ b/backend/src/services/oauth-client/oauth-client-types.ts@@ -69,8 +69,6 @@ export const OauthAuthorizationCodePayloadSchema = z.object({scopes: z.array(z.string()).optional()});-export type TOauthAuthorizationCodePayload = z.infer<typeof OauthAuthorizationCodePayloadSchema>;-export type TOauthRefreshJwtTokenPayload = AuthModeRefreshJwtTokenPayload & {oauthClientId?: string;};diff --git a/frontend/src/components/v3/generic/CopyButton/CopyButton.tsx b/frontend/src/components/v3/generic/CopyButton/CopyButton.tsxnew file mode 100644index 0000000000..7058e819bb--- /dev/null+++ b/frontend/src/components/v3/generic/CopyButton/CopyButton.tsx@@ -0,0 +1,38 @@+import { ComponentProps } from "react";+import { Check, Copy } from "lucide-react";++import { useTimedReset } from "@app/hooks";++import { IconButton } from "../IconButton";++type CopyButtonProps = {+ value: string;+ ariaLabel: string;+} & Pick<ComponentProps<typeof IconButton>, "variant" | "size" | "className">;++export const CopyButton = ({+ value,+ ariaLabel,+ variant = "ghost",+ size = "xs",+ className+}: CopyButtonProps) => {+ const [, isCopying, setCopyText] = useTimedReset<string>({+ initialState: "Copy to clipboard"+ });++ return (+ <IconButton+ variant={variant}+ size={size}+ className={className}+ aria-label={ariaLabel}+ onClick={() => {+ navigator.clipboard.writeText(value);+ setCopyText("Copied");+ }}+ >+ {isCopying ? <Check /> : <Copy />}+ </IconButton>+ );+};diff --git a/frontend/src/components/v3/generic/CopyButton/index.ts b/frontend/src/components/v3/generic/CopyButton/index.tsnew file mode 100644index 0000000000..cca879074a--- /dev/null+++ b/frontend/src/components/v3/generic/CopyButton/index.ts@@ -0,0 +1 @@+export * from "./CopyButton";diff --git a/frontend/src/components/v3/generic/index.ts b/frontend/src/components/v3/generic/index.tsindex cb3b2fc752..b41de02428 100644--- a/frontend/src/components/v3/generic/index.ts+++ b/frontend/src/components/v3/generic/index.ts@@ -10,6 +10,7 @@ export * from "./Card";export * from "./Checkbox";export * from "./ColorPicker";export * from "./Command";+export * from "./CopyButton";export * from "./DataGrid";export * from "./Detail";export * from "./Dialog";diff --git a/frontend/src/hooks/api/oauthClients/queries.tsx b/frontend/src/hooks/api/oauthClients/queries.tsxindex f5da1c4381..07b268b839 100644--- a/frontend/src/hooks/api/oauthClients/queries.tsx+++ b/frontend/src/hooks/api/oauthClients/queries.tsx@@ -7,8 +7,7 @@ import { TOauthAuthorizeInfo, TOauthClient } from "./types";export const oauthClientKeys = {list: (orgId: string) => [{ orgId }, "oauth-clients"] as const,authorizeInfo: (clientId: string, redirectUri: string, scope?: string) =>- ["oauth-authorize-info", clientId, redirectUri, scope ?? ""] as const,- all: ["oauth-clients"] as const+ ["oauth-authorize-info", clientId, redirectUri, scope ?? ""] as const};export const useGetOauthClients = (orgId: string) => {diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsxindex 8aacad7b66..92fda2b5b7 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx@@ -159,7 +159,7 @@ export const OauthClientModal = ({open={popUp?.clientForm?.isOpen}onOpenChange={(isOpen) => {handlePopUpToggle("clientForm", isOpen);- reset();+ if (!isOpen) reset();}}><DialogContent className="sm:max-w-lg">@@ -168,8 +168,8 @@ export const OauthClientModal = ({{isEditing ? "Edit OAuth application" : "Add OAuth application"}</DialogTitle><DialogDescription>- External platforms can use this application to sign users in with their Infisical- identity via OAuth 2.0.+ External platforms use this application to request delegated access to Infisical on a+ user's behalf via OAuth 2.0, limited to that user's permissions.</DialogDescription></DialogHeader><form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-6">diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientSecretModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientSecretModal.tsxindex 441f73ff8b..c4ac8d3e29 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientSecretModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientSecretModal.tsx@@ -1,18 +1,15 @@-import { Check, Copy } from "lucide-react";-import {Alert,AlertDescription,Button,+ CopyButton,Dialog,DialogContent,DialogDescription,DialogFooter,DialogHeader,- DialogTitle,- IconButton+ DialogTitle} from "@app/components/v3";-import { useTimedReset } from "@app/hooks";import { UsePopUpState } from "@app/hooks/usePopUp";export type TOauthClientSecretData = {@@ -27,31 +24,15 @@ type Props = {handlePopUpToggle: (popUpName: keyof UsePopUpState<["clientSecret"]>, state?: boolean) => void;};-const CopyableValue = ({ label, value }: { label: string; value: string }) => {- const [, isCopying, setCopyText] = useTimedReset<string>({- initialState: "Copy to clipboard"- });-- return (- <div className="flex flex-col gap-1">- <span className="text-xs text-accent">{label}</span>- <div className="flex items-center gap-2 rounded-md border border-border bg-container p-2">- <p className="grow font-mono text-sm break-all text-foreground">{value}</p>- <IconButton- variant="ghost"- size="xs"- aria-label={`Copy ${label}`}- onClick={() => {- navigator.clipboard.writeText(value);- setCopyText("Copied");- }}- >- {isCopying ? <Check /> : <Copy />}- </IconButton>- </div>+const CopyableValue = ({ label, value }: { label: string; value: string }) => (+ <div className="flex flex-col gap-1">+ <span className="text-xs text-accent">{label}</span>+ <div className="flex items-center gap-2 rounded-md border border-border bg-container p-2">+ <p className="grow font-mono text-sm break-all text-foreground">{value}</p>+ <CopyButton value={value} ariaLabel={`Copy ${label}`} /></div>- );-};+ </div>+);export const OauthClientSecretModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {const data = popUp?.clientSecret?.data as TOauthClientSecretData | undefined;diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsxindex b474ca5ff7..181df292cc 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx@@ -1,16 +1,6 @@import { useState } from "react";import { format } from "date-fns";-import {- Check,- Copy,- KeyRound,- MoreHorizontal,- Pencil,- Plus,- RefreshCw,- Search,- Trash2-} from "lucide-react";+import { KeyRound, MoreHorizontal, Pencil, Plus, RefreshCw, Search, Trash2 } from "lucide-react";import { createNotification } from "@app/components/notifications";import { OrgPermissionCan, PermissionDeniedBanner } from "@app/components/permissions";@@ -32,6 +22,7 @@ import {CardDescription,CardHeader,CardTitle,+ CopyButton,DropdownMenu,DropdownMenuContent,DropdownMenuItem,@@ -58,7 +49,7 @@ import {useOrganization,useOrgPermission} from "@app/context";-import { usePopUp, useTimedReset } from "@app/hooks";+import { usePopUp } from "@app/hooks";import {TOauthClient,useDeleteOauthClient,@@ -69,29 +60,6 @@ import {import { OauthClientModal } from "./OauthClientModal";import { OauthClientSecretModal } from "./OauthClientSecretModal";-const ClientIdCell = ({ clientId }: { clientId: string }) => {- const [, isCopying, setCopyText] = useTimedReset<string>({- initialState: "Copy to clipboard"- });-- return (- <div className="flex items-center gap-1">- <span className="font-mono text-xs">{clientId}</span>- <IconButton- variant="ghost"- size="xs"- aria-label="Copy client ID"- onClick={() => {- navigator.clipboard.writeText(clientId);- setCopyText("Copied");- }}- >- {isCopying ? <Check /> : <Copy />}- </IconButton>- </div>- );-};-export const OrgOauthClientsTab = () => {const { currentOrg } = useOrganization();const { permission } = useOrgPermission();@@ -168,8 +136,8 @@ export const OrgOauthClientsTab = () => {OAuth Applications</CardTitle><CardDescription>- Register external platforms that sign users in with their Infisical identity via OAuth- 2.0.+ Register external platforms to request delegated access to Infisical on a user's+ behalf via OAuth 2.0, limited to that user's permissions.</CardDescription><CardAction><OrgPermissionCan@@ -209,8 +177,8 @@ export const OrgOauthClientsTab = () => {<EmptyHeader><EmptyTitle>No OAuth applications found</EmptyTitle><EmptyDescription>- Add an application to let an external platform authenticate users via- Infisical.+ Add an application to let an external platform access Infisical on a+ user's behalf via OAuth 2.0.</EmptyDescription></EmptyHeader></Empty>@@ -240,7 +208,10 @@ export const OrgOauthClientsTab = () => {<TableRow key={client.id}><TableCell className="font-medium text-foreground">{client.name}</TableCell><TableCell>- <ClientIdCell clientId={client.clientId} />+ <div className="flex items-center gap-1">+ <span className="font-mono text-xs">{client.clientId}</span>+ <CopyButton value={client.clientId} ariaLabel="Copy client ID" />+ </div></TableCell><TableCell><div className="flex flex-col gap-0.5">@@ -356,8 +327,8 @@ export const OrgOauthClientsTab = () => {Delete "{(popUp?.deleteClient?.data as TOauthClient | undefined)?.name}"?</AlertDialogTitle><AlertDialogDescription>- External platforms using this application will no longer be able to authenticate users- or refresh tokens.+ External platforms using this application will no longer be able to access Infisical+ on a user's behalf, and existing tokens will be revoked.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>