mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 05:28:23 +00:00
Merge branch 'main' into ENG-2827
This commit is contained in:
@@ -47,7 +47,7 @@ export const registerLicenseRouter = async (server: FastifyZodProvider) => {
|
|||||||
200: z.object({ plan: z.any() })
|
200: z.object({ plan: z.any() })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
const plan = await server.services.license.getOrgPlan({
|
const plan = await server.services.license.getOrgPlan({
|
||||||
actorId: req.permission.id,
|
actorId: req.permission.id,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import {
|
|||||||
TOidcLoginDTO,
|
TOidcLoginDTO,
|
||||||
TUpdateOidcCfgDTO
|
TUpdateOidcCfgDTO
|
||||||
} from "./oidc-config-types";
|
} from "./oidc-config-types";
|
||||||
|
import { logger } from "@app/lib/logger";
|
||||||
|
|
||||||
type TOidcConfigServiceFactoryDep = {
|
type TOidcConfigServiceFactoryDep = {
|
||||||
userDAL: Pick<
|
userDAL: Pick<
|
||||||
@@ -699,6 +700,7 @@ export const oidcConfigServiceFactory = ({
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
(_req: any, tokenSet: TokenSet, cb: any) => {
|
(_req: any, tokenSet: TokenSet, cb: any) => {
|
||||||
const claims = tokenSet.claims();
|
const claims = tokenSet.claims();
|
||||||
|
logger.info(`User OIDC claims received for [orgId=${org.id}] [claims=${JSON.stringify(claims)}]`);
|
||||||
if (!claims.email || !claims.given_name) {
|
if (!claims.email || !claims.given_name) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
message: "Invalid request. Missing email or first name"
|
message: "Invalid request. Missing email or first name"
|
||||||
|
|||||||
+9
-7
@@ -57,7 +57,7 @@ const sleep = async () =>
|
|||||||
setTimeout(resolve, 1000);
|
setTimeout(resolve, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
const getSecretsRecord = async (client: SecretsManagerClient): Promise<TAwsSecretsRecord> => {
|
const getSecretsRecord = async (client: SecretsManagerClient, keySchema?: string): Promise<TAwsSecretsRecord> => {
|
||||||
const awsSecretsRecord: TAwsSecretsRecord = {};
|
const awsSecretsRecord: TAwsSecretsRecord = {};
|
||||||
let hasNext = true;
|
let hasNext = true;
|
||||||
let nextToken: string | undefined;
|
let nextToken: string | undefined;
|
||||||
@@ -72,7 +72,7 @@ const getSecretsRecord = async (client: SecretsManagerClient): Promise<TAwsSecre
|
|||||||
|
|
||||||
if (output.SecretList) {
|
if (output.SecretList) {
|
||||||
output.SecretList.forEach((secretEntry) => {
|
output.SecretList.forEach((secretEntry) => {
|
||||||
if (secretEntry.Name) {
|
if (secretEntry.Name && matchesSchema(secretEntry.Name, keySchema)) {
|
||||||
awsSecretsRecord[secretEntry.Name] = secretEntry;
|
awsSecretsRecord[secretEntry.Name] = secretEntry;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -311,7 +311,7 @@ export const AwsSecretsManagerSyncFns = {
|
|||||||
|
|
||||||
const client = await getSecretsManagerClient(secretSync);
|
const client = await getSecretsManagerClient(secretSync);
|
||||||
|
|
||||||
const awsSecretsRecord = await getSecretsRecord(client);
|
const awsSecretsRecord = await getSecretsRecord(client, syncOptions.keySchema);
|
||||||
|
|
||||||
const awsValuesRecord = await getSecretValuesRecord(client, awsSecretsRecord);
|
const awsValuesRecord = await getSecretValuesRecord(client, awsSecretsRecord);
|
||||||
|
|
||||||
@@ -468,14 +468,16 @@ export const AwsSecretsManagerSyncFns = {
|
|||||||
getSecrets: async (secretSync: TAwsSecretsManagerSyncWithCredentials): Promise<TSecretMap> => {
|
getSecrets: async (secretSync: TAwsSecretsManagerSyncWithCredentials): Promise<TSecretMap> => {
|
||||||
const client = await getSecretsManagerClient(secretSync);
|
const client = await getSecretsManagerClient(secretSync);
|
||||||
|
|
||||||
const awsSecretsRecord = await getSecretsRecord(client);
|
const awsSecretsRecord = await getSecretsRecord(client, secretSync.syncOptions.keySchema);
|
||||||
const awsValuesRecord = await getSecretValuesRecord(client, awsSecretsRecord);
|
const awsValuesRecord = await getSecretValuesRecord(client, awsSecretsRecord);
|
||||||
|
|
||||||
const { destinationConfig } = secretSync;
|
const { destinationConfig } = secretSync;
|
||||||
|
|
||||||
if (destinationConfig.mappingBehavior === AwsSecretsManagerSyncMappingBehavior.OneToOne) {
|
if (destinationConfig.mappingBehavior === AwsSecretsManagerSyncMappingBehavior.OneToOne) {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
Object.keys(awsSecretsRecord).map((key) => [key, { value: awsValuesRecord[key].SecretString ?? "" }])
|
Object.keys(awsSecretsRecord)
|
||||||
|
.filter((key) => Object.hasOwn(awsValuesRecord, key))
|
||||||
|
.map((key) => [key, { value: awsValuesRecord[key]?.SecretString ?? "" }])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,11 +503,11 @@ export const AwsSecretsManagerSyncFns = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeSecrets: async (secretSync: TAwsSecretsManagerSyncWithCredentials, secretMap: TSecretMap) => {
|
removeSecrets: async (secretSync: TAwsSecretsManagerSyncWithCredentials, secretMap: TSecretMap) => {
|
||||||
const { destinationConfig } = secretSync;
|
const { destinationConfig, syncOptions } = secretSync;
|
||||||
|
|
||||||
const client = await getSecretsManagerClient(secretSync);
|
const client = await getSecretsManagerClient(secretSync);
|
||||||
|
|
||||||
const awsSecretsRecord = await getSecretsRecord(client);
|
const awsSecretsRecord = await getSecretsRecord(client, syncOptions.keySchema);
|
||||||
|
|
||||||
if (destinationConfig.mappingBehavior === AwsSecretsManagerSyncMappingBehavior.OneToOne) {
|
if (destinationConfig.mappingBehavior === AwsSecretsManagerSyncMappingBehavior.OneToOne) {
|
||||||
for await (const secretKey of Object.keys(awsSecretsRecord)) {
|
for await (const secretKey of Object.keys(awsSecretsRecord)) {
|
||||||
|
|||||||
+21
-12
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
import { createNotification } from "@app/components/notifications";
|
||||||
import { Button, Checkbox, Modal, ModalContent } from "@app/components/v2";
|
import { Button, Checkbox, Modal, ModalContent, Tooltip } from "@app/components/v2";
|
||||||
import { useOrgPermission } from "@app/context";
|
import { useOrgPermission } from "@app/context";
|
||||||
import { useUpgradePrivilegeSystem } from "@app/hooks/api";
|
import { useUpgradePrivilegeSystem } from "@app/hooks/api";
|
||||||
|
|
||||||
@@ -262,7 +262,6 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}>
|
<form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}>
|
||||||
<div className="mt-6 flex items-center justify-end gap-4">
|
<div className="mt-6 flex items-center justify-end gap-4">
|
||||||
<button
|
<button
|
||||||
@@ -272,17 +271,27 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
|
|||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<Button
|
<Tooltip
|
||||||
type="submit"
|
content={
|
||||||
variant="solid"
|
!isAdmin
|
||||||
colorSchema="primary"
|
? `You cannot perform this upgrade because you are not an organization admin. (Your current role: ${membership?.role ?? "Unknown"})`
|
||||||
size="md"
|
: undefined
|
||||||
className="w-[120px] bg-primary hover:bg-primary-600"
|
}
|
||||||
isDisabled={!isAllChecksCompleted || !isAdmin}
|
|
||||||
isLoading={isSubmitting}
|
|
||||||
>
|
>
|
||||||
Upgrade
|
<div>
|
||||||
</Button>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="solid"
|
||||||
|
colorSchema="primary"
|
||||||
|
size="md"
|
||||||
|
className="w-[120px] bg-primary hover:bg-primary-600"
|
||||||
|
isDisabled={!isAllChecksCompleted || !isAdmin}
|
||||||
|
isLoading={isSubmitting}
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user