Skip to content

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

improvement: used fix length mask for secrets when unfocused to prevent inference attacks

Scott Wilson43dd45de296c
diff --git a/frontend/src/components/v2/SecretInput/SecretInput.tsx b/frontend/src/components/v2/SecretInput/SecretInput.tsx
index 6f3f4283a2..747af73d52 100644
--- a/frontend/src/components/v2/SecretInput/SecretInput.tsx
+++ b/frontend/src/components/v2/SecretInput/SecretInput.tsx
@@ -6,20 +6,12 @@ import { useToggle } from "@app/hooks";
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
const REGEX = /(\${([a-zA-Z0-9-_.]+)})/g;
-const replaceContentWithDot = (str: string) => {
- let finalStr = "";
- for (let i = 0; i < str.length; i += 1) {
- const char = str.at(i);
- finalStr += char === "\n" ? "\n" : "*";
- }
- return finalStr;
-};
const syntaxHighlight = (content?: string | null, isVisible?: boolean, isImport?: boolean) => {
if (isImport && !content) return "IMPORTED";
if (content === "") return "EMPTY";
if (!content) return "EMPTY";
- if (!isVisible) return replaceContentWithDot(content);
+ if (!isVisible) return HIDDEN_SECRET_VALUE;
let skipNext = false;
const formattedContent = content.split(REGEX).flatMap((el, i) => {
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
index 77bec882cc..2a4f54c82a 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
@@ -56,7 +56,7 @@ import {
import { CollapsibleSecretImports } from "./CollapsibleSecretImports";
import { useBatchModeActions } from "../../SecretMainPage.store";
-export const HIDDEN_SECRET_VALUE = "******";
+export const HIDDEN_SECRET_VALUE = "*****************************";
export const HIDDEN_SECRET_VALUE_API_MASK = "<hidden-by-infisical>";
type Props = {