mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 16:26:37 +00:00
improvement: used fix length mask for secrets when unfocused to prevent inference attacks
This commit is contained in:
@@ -6,20 +6,12 @@ import { useToggle } from "@app/hooks";
|
|||||||
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
|
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
|
||||||
|
|
||||||
const REGEX = /(\${([a-zA-Z0-9-_.]+)})/g;
|
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) => {
|
const syntaxHighlight = (content?: string | null, isVisible?: boolean, isImport?: boolean) => {
|
||||||
if (isImport && !content) return "IMPORTED";
|
if (isImport && !content) return "IMPORTED";
|
||||||
if (content === "") return "EMPTY";
|
if (content === "") return "EMPTY";
|
||||||
if (!content) return "EMPTY";
|
if (!content) return "EMPTY";
|
||||||
if (!isVisible) return replaceContentWithDot(content);
|
if (!isVisible) return HIDDEN_SECRET_VALUE;
|
||||||
|
|
||||||
let skipNext = false;
|
let skipNext = false;
|
||||||
const formattedContent = content.split(REGEX).flatMap((el, i) => {
|
const formattedContent = content.split(REGEX).flatMap((el, i) => {
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ import {
|
|||||||
import { CollapsibleSecretImports } from "./CollapsibleSecretImports";
|
import { CollapsibleSecretImports } from "./CollapsibleSecretImports";
|
||||||
import { useBatchModeActions } from "../../SecretMainPage.store";
|
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>";
|
export const HIDDEN_SECRET_VALUE_API_MASK = "<hidden-by-infisical>";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
Reference in New Issue
Block a user