mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 19:28:09 +00:00
updated texts and comments
This commit is contained in:
@@ -396,13 +396,34 @@ export const decryptSecretRaw = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAllNestedSecretReferences = (value: string) => {
|
/**
|
||||||
const references = Array.from(value.matchAll(INTERPOLATION_SYNTAX_REG), (m) => m[1]);
|
* Grabs and processes nested secret references from a string
|
||||||
|
*
|
||||||
|
* This function looks for patterns that match the interpolation syntax in the input string.
|
||||||
|
* It filters out references that include nested paths, splits them into environment and
|
||||||
|
* secret path parts, and then returns an array of objects with the environment and the
|
||||||
|
* joined secret path.
|
||||||
|
*
|
||||||
|
* @param {string} maybeSecretReference - The string that has the potential secret references.
|
||||||
|
* @returns {Array<{ environment: string, secretPath: string }>} - An array of objects
|
||||||
|
* with the environment and joined secret path.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const value = "Hello ${dev.someFolder.OtherFolder.SECRET_NAME} and ${prod.anotherFolder.SECRET_NAME}";
|
||||||
|
* const result = getAllNestedSecretReferences(value);
|
||||||
|
* // result will be:
|
||||||
|
* // [
|
||||||
|
* // { environment: 'dev', secretPath: '/someFolder/OtherFolder' },
|
||||||
|
* // { environment: 'prod', secretPath: '/anotherFolder' }
|
||||||
|
* // ]
|
||||||
|
*/
|
||||||
|
export const getAllNestedSecretReferences = (maybeSecretReference: string) => {
|
||||||
|
const references = Array.from(maybeSecretReference.matchAll(INTERPOLATION_SYNTAX_REG), (m) => m[1]);
|
||||||
return references
|
return references
|
||||||
.filter((el) => el.includes("."))
|
.filter((el) => el.includes("."))
|
||||||
.map((el) => {
|
.map((el) => {
|
||||||
const [environment, ...secretPath] = el.split(".");
|
const [environment, ...secretPathList] = el.split(".");
|
||||||
return { environment, secretPath: path.join("/", ...secretPath.slice(0, -1)) };
|
return { environment, secretPath: path.join("/", ...secretPathList.slice(0, -1)) };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1562,10 +1562,12 @@ export const secretServiceFactory = ({
|
|||||||
actorOrgId
|
actorOrgId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!hasRole(ProjectMembershipRole.Admin)) throw new BadRequestError({ message: "Only admins are allowed" });
|
if (!hasRole(ProjectMembershipRole.Admin))
|
||||||
|
throw new BadRequestError({ message: "Only admins are allowed to take this action" });
|
||||||
|
|
||||||
const botKey = await projectBotService.getBotKey(projectId);
|
const botKey = await projectBotService.getBotKey(projectId);
|
||||||
if (!botKey) throw new BadRequestError({ message: "Kindly upgrade your project", name: "bot_not_found_error" });
|
if (!botKey)
|
||||||
|
throw new BadRequestError({ message: "Please upgrade your project first", name: "bot_not_found_error" });
|
||||||
|
|
||||||
await secretDAL.transaction(async (tx) => {
|
await secretDAL.transaction(async (tx) => {
|
||||||
const secrets = await secretDAL.findAllProjectSecretValues(projectId, tx);
|
const secrets = await secretDAL.findAllProjectSecretValues(projectId, tx);
|
||||||
@@ -1584,7 +1586,7 @@ export const secretServiceFactory = ({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return { message: "Successfully backfilled secret references." };
|
return { message: "Successfully backfilled secret references" };
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
+2
-3
@@ -25,11 +25,10 @@ export const BackfillSecretReferenceSecretion = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||||
<div className="flex w-full items-center justify-between">
|
<div className="flex w-full items-center justify-between">
|
||||||
<p className="text-xl font-semibold">Resync Secret References</p>
|
<p className="text-xl font-semibold">Sync Secret References</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">
|
<p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">
|
||||||
Trigger this to reindex all your inline secret references to map integration
|
This will index all secret references, enabling integrations to be triggered when their values change going forward.
|
||||||
synchronization.
|
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
|
|||||||
Reference in New Issue
Block a user