Merge pull request #4427 from Infisical/fix-inference-attack

improvement(frontend): Use fixed length mask for secrets when unfocused to prevent inference attacks
This commit is contained in:
Scott Wilson
2025-08-29 10:47:26 -07:00
committed by GitHub
2 changed files with 2 additions and 10 deletions

View File

@@ -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) => {

View File

@@ -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 = {