Skip to content

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

fix: lint issues

IgorHorta2a539b516323
diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.ts
index e94f89113d..b39b2b42f7 100644
--- a/backend/src/ee/services/license/license-fns.ts
+++ b/backend/src/ee/services/license/license-fns.ts
@@ -88,8 +88,8 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
status: null,
trial_end: null,
has_used_trial: true,
- secretApproval: false,
- secretRotation: false,
+ secretApproval: true,
+ secretRotation: true,
caCrl: false,
instanceUserManagement: false,
externalKms: false,
@@ -106,9 +106,9 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
gateway: false,
sshHostGroups: false,
secretScanning: false,
- enterpriseSecretSyncs: false,
- enterpriseCertificateSyncs: false,
- enterpriseAppConnections: false,
+ enterpriseSecretSyncs: true,
+ enterpriseCertificateSyncs: true,
+ enterpriseAppConnections: true,
fips: false,
eventSubscriptions: false,
machineIdentityAuthTemplates: false,
diff --git a/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx b/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx
index eb262d7825..e56254eb06 100644
--- a/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx
+++ b/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx
@@ -62,8 +62,9 @@ const normalizeSecretValue = (value: string | null | undefined): string => {
// Normalize a JSON value for comparison - specifically handles secretValue strings
const normalizeValueForComparison = (value: JsonValue, key?: string, path?: string): JsonValue => {
// Check if this is a secretValue field - either by key name or path
- const isSecretValue = key === "secretValue" || path?.endsWith(".secretValue") || path === "secretValue";
-
+ const isSecretValue =
+ key === "secretValue" || path?.endsWith(".secretValue") || path === "secretValue";
+
// Only normalize secretValue strings
if (isSecretValue && typeof value === "string") {
return normalizeSecretValue(value);
@@ -72,24 +73,25 @@ const normalizeValueForComparison = (value: JsonValue, key?: string, path?: stri
};
const deepEqual = (a: JsonValue, b: JsonValue, key?: string, path?: string): boolean => {
- // Normalize values before comparison if they're secretValue strings
const normalizedA = normalizeValueForComparison(a, key, path);
const normalizedB = normalizeValueForComparison(b, key, path);
-
+
if (normalizedA === normalizedB) return true;
if (normalizedA == null || normalizedB == null) return false;
if (typeof normalizedA !== typeof normalizedB) return false;
if (isArray(normalizedA) && isArray(normalizedB)) {
if (normalizedA.length !== normalizedB.length) return false;
- return normalizedA.every((item: JsonValue, index: number) => deepEqual(item, normalizedB[index], undefined, path));
+ return normalizedA.every((item: JsonValue, index: number) =>
+ deepEqual(item, normalizedB[index], undefined, path)
+ );
}
if (isObject(normalizedA) && isObject(normalizedB)) {
const keysA = Object.keys(normalizedA);
const keysB = Object.keys(normalizedB);
if (keysA.length !== keysB.length) return false;
- const currentPath = path ? `${path}.${key || ""}` : (key || "");
+ const currentPath = path ? `${path}.${key || ""}` : key || "";
return keysA.every((k) => {
const nestedPath = currentPath ? `${currentPath}.${k}` : k;
return keysB.includes(k) && deepEqual(normalizedA[k], normalizedB[k], k, nestedPath);
@@ -101,12 +103,8 @@ const deepEqual = (a: JsonValue, b: JsonValue, key?: string, path?: string): boo
const getDiffPaths = (oldObj: JsonValue, newObj: JsonValue, path: string = ""): Set<string> => {
const diffPaths = new Set<string>();
-
- // Extract the key name from the path for normalization
const pathParts = path.split(".");
const currentKey = pathParts[pathParts.length - 1] || "";
-
- // Normalize values before comparison if they're secretValue strings
const normalizedOld = normalizeValueForComparison(oldObj, currentKey, path);
const normalizedNew = normalizeValueForComparison(newObj, currentKey, path);
@@ -136,7 +134,11 @@ const getDiffPaths = (oldObj: JsonValue, newObj: JsonValue, path: string = ""):
return;
}
- if (!(key in normalizedOld) || !(key in normalizedNew) || !deepEqual(normalizedOld[key], normalizedNew[key], key, currentPath)) {
+ if (
+ !(key in normalizedOld) ||
+ !(key in normalizedNew) ||
+ !deepEqual(normalizedOld[key], normalizedNew[key], key, currentPath)
+ ) {
diffPaths.add(currentPath);
if (
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
index f4a2c62d30..1a08dd4846 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
@@ -39,7 +39,10 @@ const normalizeSecretValue = (value: string | null | undefined): string => {
};
// Compare normalized values to determine if they're actually different
-const areValuesEqual = (oldValue: string | null | undefined, newValue: string | null | undefined): boolean => {
+const areValuesEqual = (
+ oldValue: string | null | undefined,
+ newValue: string | null | undefined
+): boolean => {
const normalizedOld = normalizeSecretValue(oldValue);
const normalizedNew = normalizeSecretValue(newValue);
return normalizedOld === normalizedNew;
@@ -67,7 +70,7 @@ const computeLineDiff = (oldText: string, newText: string): DiffLine[] => {
// Normalize the texts before splitting
const normalizedOld = normalizeSecretValue(oldText);
const normalizedNew = normalizeSecretValue(newText);
-
+
const oldLines = normalizedOld.split("\n");
const newLines = normalizedNew.split("\n");
const result: DiffLine[] = [];
@@ -88,81 +91,75 @@ const computeLineDiff = (oldText: string, newText: string): DiffLine[] => {
oldLine: oldLines[oldIndex]
});
oldIndex += 1;
+ } else {
+ // Trim trailing whitespace from lines for comparison (but preserve leading whitespace)
+ const oldLineTrimmed = oldLines[oldIndex].replace(/\s+$/, "");
+ const newLineTrimmed = newLines[newIndex].replace(/\s+$/, "");
+
+ if (oldLineTrimmed === "" && newLineTrimmed !== "") {
+ result.push({
+ type: DIFF_TYPE.ADDED,
+ newLine: newLines[newIndex]
+ });
+ newIndex += 1;
+ } else if (newLineTrimmed === "" && oldLineTrimmed !== "") {
+ result.push({
+ type: DIFF_TYPE.DELETED,
+ oldLine: oldLines[oldIndex]
+ });
+ oldIndex += 1;
+ } else if (oldLineTrimmed === newLineTrimmed) {
+ result.push({
+ type: DIFF_TYPE.UNCHANGED,
+ oldLine: oldLines[oldIndex],
+ newLine: newLines[newIndex]
+ });
+ oldIndex += 1;
+ newIndex += 1;
} else {
- // Trim trailing whitespace from lines for comparison (but preserve leading whitespace)
- const oldLineTrimmed = oldLines[oldIndex].replace(/\s+$/, "");
- const newLineTrimmed = newLines[newIndex].replace(/\s+$/, "");
-
- // If old line is empty/whitespace and new line has content, treat as ADDED
- if (oldLineTrimmed === "" && newLineTrimmed !== "") {
- result.push({
- type: DIFF_TYPE.ADDED,
- newLine: newLines[newIndex]
- });
- newIndex += 1;
- // Don't increment oldIndex, keep it to check if there are more old lines
- continue;
- }
-
- // If new line is empty/whitespace and old line has content, treat as DELETED
- if (newLineTrimmed === "" && oldLineTrimmed !== "") {
- result.push({
- type: DIFF_TYPE.DELETED,
- oldLine: oldLines[oldIndex]
- });
- oldIndex += 1;
- // Don't increment newIndex, keep it to check if there are more new lines
- continue;
- }
-
- if (oldLineTrimmed === newLineTrimmed) {
+ const currentOldIndex = oldIndex;
+ const currentNewIndex = newIndex;
+ const currentOldLine = oldLines[currentOldIndex];
+ const currentNewLine = newLines[currentNewIndex];
+
+ const nextOldMatch = newLines.findIndex(
+ (line, idx) =>
+ idx >= currentNewIndex &&
+ line.replace(/\s+$/, "") === currentOldLine.replace(/\s+$/, "")
+ );
+ const nextNewMatch = oldLines.findIndex(
+ (line, idx) =>
+ idx >= currentOldIndex &&
+ line.replace(/\s+$/, "") === currentNewLine.replace(/\s+$/, "")
+ );
+
+ if (nextOldMatch === -1 && nextNewMatch === -1) {
result.push({
- type: DIFF_TYPE.UNCHANGED,
- oldLine: oldLines[oldIndex],
- newLine: newLines[newIndex]
+ type: DIFF_TYPE.MODIFIED,
+ oldLine: currentOldLine,
+ newLine: currentNewLine
});
oldIndex += 1;
newIndex += 1;
+ } else if (nextOldMatch !== -1 && (nextNewMatch === -1 || nextOldMatch < nextNewMatch)) {
+ while (newIndex < nextOldMatch) {
+ result.push({
+ type: DIFF_TYPE.ADDED,
+ newLine: newLines[newIndex]
+ });
+ newIndex += 1;
+ }
} else {
- const currentOldIndex = oldIndex;
- const currentNewIndex = newIndex;
- const currentOldLine = oldLines[currentOldIndex];
- const currentNewLine = newLines[currentNewIndex];
-
- const nextOldMatch = newLines.findIndex(
- (line, idx) => idx >= currentNewIndex && line.replace(/\s+$/, "") === currentOldLine.replace(/\s+$/, "")
- );
- const nextNewMatch = oldLines.findIndex(
- (line, idx) => idx >= currentOldIndex && line.replace(/\s+$/, "") === currentNewLine.replace(/\s+$/, "")
- );
-
- if (nextOldMatch === -1 && nextNewMatch === -1) {
+ while (oldIndex < nextNewMatch) {
result.push({
- type: DIFF_TYPE.MODIFIED,
- oldLine: currentOldLine,
- newLine: currentNewLine
+ type: DIFF_TYPE.DELETED,
+ oldLine: oldLines[oldIndex]
});
oldIndex += 1;
- newIndex += 1;
- } else if (nextOldMatch !== -1 && (nextNewMatch === -1 || nextOldMatch < nextNewMatch)) {
- while (newIndex < nextOldMatch) {
- result.push({
- type: DIFF_TYPE.ADDED,
- newLine: newLines[newIndex]
- });
- newIndex += 1;
- }
- } else {
- while (oldIndex < nextNewMatch) {
- result.push({
- type: DIFF_TYPE.DELETED,
- oldLine: oldLines[oldIndex]
- });
- oldIndex += 1;
- }
}
}
}
+ }
}
return result;
@@ -175,15 +172,15 @@ const computeWordDiff = (oldText: string, newText: string): WordDiff[] | null =>
// Normalize the texts before computing word diff
const normalizedOld = normalizeSecretValue(oldText);
const normalizedNew = normalizeSecretValue(newText);
-
+
const wordRegex = /(\s+|[^\s\w]+|\w+)/g;
const oldWords = normalizedOld.match(wordRegex) || [];
const newWords = normalizedNew.match(wordRegex) || [];
// Check if there are any common words (excluding whitespace and punctuation)
- const oldWordSet = new Set(oldWords.filter(w => /\w/.test(w)));
- const newWordSet = new Set(newWords.filter(w => /\w/.test(w)));
- const hasCommonWords = [...oldWordSet].some(word => newWordSet.has(word));
+ const oldWordSet = new Set(oldWords.filter((w) => /\w/.test(w)));
+ const newWordSet = new Set(newWords.filter((w) => /\w/.test(w)));
+ const hasCommonWords = [...oldWordSet].some((word) => newWordSet.has(word));
// If no common words, return null to indicate entire line should be highlighted
if (!hasCommonWords && oldWords.length > 0 && newWords.length > 0) {
@@ -247,21 +244,17 @@ const renderSingleLineDiffForApproval = (
): JSX.Element => {
const normalizedOld = normalizeSecretValue(oldText);
const normalizedNew = normalizeSecretValue(newText);
-
+
// If completely new or deleted, or no common words, show as single block
const wordDiffs = computeWordDiff(oldText, newText);
- const shouldShowAsBlock =
- (normalizedOld === "" && normalizedNew !== "") ||
+ const shouldShowAsBlock =
+ (normalizedOld === "" && normalizedNew !== "") ||
(normalizedOld !== "" && normalizedNew === "") ||
wordDiffs === null;
-
+
if (shouldShowAsBlock) {
const value = isOldVersion ? normalizedOld : normalizedNew;
- return (
- <div className="font-mono text-sm break-words">
- {value}
- </div>
- );
+ return <div className="font-mono text-sm break-words">{value}</div>;
}
// Show word-by-word diff when there are common words
@@ -333,9 +326,7 @@ const renderMultilineDiffForApproval = (
data-first-change={isFirstChanged ? "true" : undefined}
>
<div className="w-4 shrink-0">-</div>
- <div className="min-w-0 flex-1 break-words">
- {diffLine.oldLine}
- </div>
+ <div className="min-w-0 flex-1 break-words">{diffLine.oldLine}</div>
</div>
);
}
@@ -410,9 +401,7 @@ const renderMultilineDiffForApproval = (
data-first-change={isFirstChanged ? "true" : undefined}
>
<div className="w-4 shrink-0">+</div>
- <div className="min-w-0 flex-1 break-words">
- {diffLine.newLine}
- </div>
+ <div className="min-w-0 flex-1 break-words">{diffLine.newLine}</div>
</div>
);
}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
index 84a421d0f9..3ca41cdecc 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
@@ -32,7 +32,10 @@ const normalizeSecretValue = (value: string | null | undefined): string => {
};
// Compare normalized values to determine if they're actually different
-const areValuesEqual = (oldValue: string | null | undefined, newValue: string | null | undefined): boolean => {
+const areValuesEqual = (
+ oldValue: string | null | undefined,
+ newValue: string | null | undefined
+): boolean => {
const normalizedOld = normalizeSecretValue(oldValue);
const normalizedNew = normalizeSecretValue(newValue);
return normalizedOld === normalizedNew;
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
index b9e75948d5..3976c84e2f 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
@@ -279,14 +279,12 @@ export const SecretListView = ({
(newId) => !orgSecret.secretReminderRecipients?.find((oldId) => newId === oldId.user.id)
) && reminderRecipients?.length === orgSecret.secretReminderRecipients?.length;
- // Normalize secret value to match backend behavior for comparison
- const normalizeSecretValue = (value: string | null | undefined): string => {
- if (!value || typeof value !== "string") return "";
- // If value ends with \n, preserve it after trimming
- if (value.at(-1) === "\n") {
- return `${value.trim()}\n`;
+ const normalizeSecretValue = (val: string | null | undefined): string => {
+ if (!val || typeof val !== "string") return "";
+ if (val.at(-1) === "\n") {
+ return `${val.trim()}\n`;
}
- return value.trim();
+ return val.trim();
};
const isSharedSecUnchanged =