Skip to content

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

fix: reverting the commit change fix, will be fixed in another task

IgorHortaf35f933da136
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 1d6da021f8..274b7c0577 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -64,6 +64,7 @@
"clsx": "^2.1.1",
"cva": "npm:class-variance-authority@^0.7.1",
"date-fns": "^4.1.0",
+ "diff": "^8.0.3",
"dompurify": "^3.2.4",
"file-saver": "^2.0.5",
"framer-motion": "^11.14.1",
@@ -153,8 +154,7 @@
"resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.4.tgz",
"integrity": "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/@alloc/quick-lru": {
"version": "5.2.0",
@@ -199,6 +199,7 @@
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.3",
@@ -491,6 +492,7 @@
"resolved": "https://registry.npmjs.org/@casl/ability/-/ability-6.7.2.tgz",
"integrity": "sha512-KjKXlcjKbUz8dKw7PY56F7qlfOFgxTU6tnlJ8YrbDyWkJMIlHa6VRWzCD8RU20zbJUC1hExhOFggZjm6tf1mUw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@ucast/mongo2js": "^1.3.0"
},
@@ -549,6 +551,7 @@
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@dnd-kit/accessibility": "^3.1.1",
"@dnd-kit/utilities": "^3.2.2",
@@ -1326,6 +1329,7 @@
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.7.1.tgz",
"integrity": "sha512-8dBIHbfsKlCk2jHQ9PoRBg2Z+4TwyE3vZICSnoDlnsHA6SiMlTwfmW6yX0lHsRmWJugkeb92sA0hZdkXJhuz+g==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@fortawesome/fontawesome-common-types": "6.7.1"
},
@@ -2016,6 +2020,7 @@
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.2.tgz",
"integrity": "sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@octokit/auth-token": "^5.0.0",
"@octokit/graphql": "^8.0.0",
@@ -4496,6 +4501,7 @@
"integrity": "sha512-RnO1SaiCFHn666wNz2QfZEFxvmiNRqhzaMXHXxXXKt+MEP7aajlPxUSMIQpKAaJfverpovEYqjBOXDq6dDcaOQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@typescript-eslint/utils": "^8.13.0",
"eslint-visitor-keys": "^4.2.0",
@@ -5121,6 +5127,7 @@
"resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.95.1.tgz",
"integrity": "sha512-P5x4yNhcdkYsCEoYeGZP8Q9Jlxf0WXJa4G/xvbmM905seZc9FqJqvCSRvX3dWTPOXRABhl4g+8DHqfft0c/AvQ==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@tanstack/history": "1.95.0",
"@tanstack/react-store": "^0.7.0",
@@ -5332,7 +5339,6 @@
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@@ -5353,7 +5359,6 @@
"integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"dependencies": {
"dequal": "^2.0.3"
}
@@ -5364,7 +5369,6 @@
"integrity": "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@adobe/css-tools": "^4.4.0",
"aria-query": "^5.0.0",
@@ -5384,8 +5388,7 @@
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz",
"integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/@testing-library/user-event": {
"version": "14.6.1",
@@ -5393,7 +5396,6 @@
"integrity": "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=12",
"npm": ">=6"
@@ -5414,8 +5416,7 @@
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/@types/babel__core": {
"version": "7.20.5",
@@ -5468,7 +5469,6 @@
"integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@types/deep-eql": "*",
"assertion-error": "^2.0.1"
@@ -5542,8 +5542,7 @@
"resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
"integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/@types/doctrine": {
"version": "0.0.9",
@@ -5679,6 +5678,7 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.16.tgz",
"integrity": "sha512-oh8AMIC4Y2ciKufU8hnKgs+ufgbA/dhPTACaZPM86AbwX9QwnFtSoPWEeRUj8fge+v6kFt78BXcDhAU1SrrAsw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.0.2"
@@ -5690,6 +5690,7 @@
"integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==",
"devOptional": true,
"license": "MIT",
+ "peer": true,
"peerDependencies": {
"@types/react": "^18.0.0"
}
@@ -5737,6 +5738,7 @@
"integrity": "sha512-QXwAlHlbcAwNlEEMKQS2RCgJsgXrTJdjXT08xEgbPFa2yYQgVjBymxP5DrfrE7X7iodSzd9qBUHUycdyVJTW1w==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.34.0",
@@ -5777,6 +5779,7 @@
"integrity": "sha512-vxXJV1hVFx3IXz/oy2sICsJukaBrtDEQSBiV48/YIV5KWjX1dO+bcIr/kCPrW6weKXvsaGKFNlwH0v2eYdRRbA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.34.0",
"@typescript-eslint/types": "8.34.0",
@@ -6048,7 +6051,6 @@
"integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/spy": "3.2.4",
@@ -6066,7 +6068,6 @@
"integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@vitest/spy": "3.2.4",
"estree-walker": "^3.0.3",
@@ -6094,7 +6095,6 @@
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@types/estree": "^1.0.0"
}
@@ -6105,7 +6105,6 @@
"integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"tinyrainbow": "^2.0.0"
},
@@ -6119,7 +6118,6 @@
"integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"tinyspy": "^4.0.3"
},
@@ -6133,7 +6131,6 @@
"integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@vitest/pretty-format": "3.2.4",
"loupe": "^3.1.4",
@@ -6207,6 +6204,7 @@
"integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -6323,7 +6321,6 @@
"integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"engines": {
"node": ">= 0.4"
}
@@ -6372,7 +6369,6 @@
"integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -6453,7 +6449,6 @@
"integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -6541,7 +6536,6 @@
"integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=12"
}
@@ -6552,7 +6546,6 @@
"integrity": "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"tslib": "^2.0.1"
},
@@ -6565,8 +6558,7 @@
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz",
"integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/asynckit": {
"version": "0.4.0",
@@ -6616,7 +6608,6 @@
"integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"engines": {
"node": ">= 0.4"
}
@@ -6718,7 +6709,6 @@
"integrity": "sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"open": "^8.0.4"
},
@@ -6955,6 +6945,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.9",
"caniuse-lite": "^1.0.30001746",
@@ -7136,7 +7127,6 @@
"integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"assertion-error": "^2.0.1",
"check-error": "^2.1.1",
@@ -7207,7 +7197,6 @@
"integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">= 16"
}
@@ -7593,8 +7582,7 @@
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
"integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/cssesc": {
"version": "3.0.0",
@@ -7613,7 +7601,8 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/cva": {
"name": "class-variance-authority",
@@ -7685,6 +7674,7 @@
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
"license": "ISC",
+ "peer": true,
"engines": {
"node": ">=12"
}
@@ -7738,8 +7728,7 @@
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz",
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
"dev": true,
- "license": "BSD-2-Clause",
- "peer": true
+ "license": "BSD-2-Clause"
},
"node_modules/data-view-buffer": {
"version": "1.0.1",
@@ -7849,7 +7838,6 @@
"integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=6"
}
@@ -7884,7 +7872,6 @@
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=8"
}
@@ -7963,6 +7950,15 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/diff": {
+ "version": "8.0.3",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz",
+ "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
"node_modules/diffie-hellman": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
@@ -8006,8 +8002,7 @@
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/dom-helpers": {
"version": "5.2.1",
@@ -8217,7 +8212,6 @@
"integrity": "sha512-tpxqxncxnpw3c93u8n3VOzACmRFoVmWJqbWXvX/JfKbkhBw1oslgPrUfeSt2psuqyEJFD6N/9lg5i7bsKpoq+Q==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -8301,6 +8295,7 @@
"dev": true,
"hasInstallScript": true,
"license": "MIT",
+ "peer": true,
"bin": {
"esbuild": "bin/esbuild"
},
@@ -8342,7 +8337,6 @@
"integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"debug": "^4.3.4"
},
@@ -8379,6 +8373,7 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -8435,6 +8430,7 @@
"integrity": "sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"eslint-config-airbnb-base": "^15.0.0",
"object.assign": "^4.1.2",
@@ -8457,6 +8453,7 @@
"integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"confusing-browser-globals": "^1.0.10",
"object.assign": "^4.1.2",
@@ -8487,6 +8484,7 @@
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -8586,6 +8584,7 @@
"integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.8",
@@ -8715,7 +8714,6 @@
"integrity": "sha512-EsTAnj9fLVr/GZleBLFbj/sSuXeWmp1eXIN60ceYnZveqEaUCyW4X+Vh4WTdUhCkW4xutXYqTXCUSyqD4rB75w==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"array-includes": "^3.1.8",
"array.prototype.findlast": "^1.2.5",
@@ -8749,6 +8747,7 @@
"integrity": "sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=10"
},
@@ -8772,7 +8771,6 @@
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"dependencies": {
"esutils": "^2.0.2"
},
@@ -8786,7 +8784,6 @@
"integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"is-core-module": "^2.13.0",
"path-parse": "^1.0.7",
@@ -8805,7 +8802,6 @@
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true,
"license": "ISC",
- "peer": true,
"bin": {
"semver": "bin/semver.js"
}
@@ -8967,7 +8963,6 @@
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true,
"license": "BSD-2-Clause",
- "peer": true,
"bin": {
"esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js"
@@ -9998,6 +9993,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.2"
},
@@ -10091,7 +10087,6 @@
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=8"
}
@@ -10368,7 +10363,6 @@
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"bin": {
"is-docker": "cli.js"
},
@@ -10690,7 +10684,6 @@
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"is-docker": "^2.0.0"
},
@@ -10726,7 +10719,6 @@
"resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz",
"integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==",
"license": "MIT",
- "peer": true,
"funding": {
"type": "GitHub Sponsors ❤",
"url": "https://github.com/sponsors/dmonad"
@@ -10738,7 +10730,6 @@
"integrity": "sha512-x4WH0BWmrMmg4oHHl+duwubhrvczGlyuGAZu3nvrf0UXOfPu8IhZObFEr7DE/iv01YgVZrsOiRcqw2srkKEDIA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"define-data-property": "^1.1.4",
"es-object-atoms": "^1.0.0",
@@ -10888,7 +10879,6 @@
"integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"array-includes": "^3.1.6",
"array.prototype.flat": "^1.3.1",
@@ -10923,8 +10913,7 @@
"resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz",
"integrity": "sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==",
"dev": true,
- "license": "CC0-1.0",
- "peer": true
+ "license": "CC0-1.0"
},
"node_modules/language-tags": {
"version": "1.0.9",
@@ -10932,7 +10921,6 @@
"integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"language-subtag-registry": "^0.3.20"
},
@@ -10965,7 +10953,6 @@
"resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.102.tgz",
"integrity": "sha512-g70kydI0I1sZU0ChO8mBbhw0oUW/8U0GHzygpvEIx8k+jgOpqnTSb/E+70toYVqHxBhrERD21TwD5QcZJQ40ZQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"isomorphic.js": "^0.2.4"
},
@@ -11290,8 +11277,7 @@
"resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz",
"integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/lru-cache": {
"version": "5.1.1",
@@ -11318,7 +11304,6 @@
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"bin": {
"lz-string": "bin/bin.js"
}
@@ -12010,7 +11995,6 @@
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=4"
}
@@ -12359,7 +12343,6 @@
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"define-lazy-prop": "^2.0.0",
"is-docker": "^2.1.1",
@@ -12629,7 +12612,6 @@
"integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">= 14.16"
}
@@ -12781,6 +12763,7 @@
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -12897,7 +12880,6 @@
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
@@ -12913,7 +12895,6 @@
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=10"
},
@@ -12926,8 +12907,7 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true,
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/prismjs": {
"version": "1.30.0",
@@ -13128,6 +13108,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -13155,6 +13136,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz",
"integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
@@ -13246,6 +13228,7 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.2"
@@ -13296,6 +13279,7 @@
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.3.tgz",
"integrity": "sha512-IK18V6GVbab4TAo1/cz3kqajxbDPGofdF0w7VHdCo0Nt8PrPlOZcuuDq9YYIV1BtjcX78x0XsldbQRQnQXWXmw==",
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -13546,7 +13530,6 @@
"integrity": "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"ast-types": "^0.16.1",
"esprima": "~4.0.0",
@@ -13564,7 +13547,6 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"license": "BSD-3-Clause",
- "peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -13581,7 +13563,6 @@
"integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"indent-string": "^4.0.0",
"strip-indent": "^3.0.0"
@@ -13596,7 +13577,6 @@
"integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"min-indent": "^1.0.0"
},
@@ -13811,6 +13791,7 @@
"integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/estree": "1.0.8"
},
@@ -14321,7 +14302,6 @@
"integrity": "sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -14337,7 +14317,6 @@
"integrity": "sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -14365,7 +14344,6 @@
"integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.5"
@@ -14586,7 +14564,8 @@
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.14.tgz",
"integrity": "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/tapable": {
"version": "2.2.1",
@@ -14690,7 +14669,6 @@
"integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=14.0.0"
}
@@ -14701,7 +14679,6 @@
"integrity": "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=14.0.0"
}
@@ -14996,6 +14973,7 @@
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
"devOptional": true,
"license": "Apache-2.0",
+ "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -15381,6 +15359,7 @@
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
@@ -15798,7 +15777,6 @@
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=10.0.0"
},
@@ -15843,6 +15821,7 @@
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz",
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==",
"license": "ISC",
+ "peer": true,
"bin": {
"yaml": "bin.mjs"
},
@@ -15993,6 +15972,7 @@
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz",
"integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==",
"license": "MIT",
+ "peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
diff --git a/frontend/package.json b/frontend/package.json
index 6e68061451..49853709b0 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -73,6 +73,7 @@
"clsx": "^2.1.1",
"cva": "npm:class-variance-authority@^0.7.1",
"date-fns": "^4.1.0",
+ "diff": "^8.0.3",
"dompurify": "^3.2.4",
"file-saver": "^2.0.5",
"framer-motion": "^11.14.1",
diff --git a/frontend/src/hooks/useRenderNewVersionDiffLine.tsx b/frontend/src/hooks/useRenderNewVersionDiffLine.tsx
index d73f0fbd53..05c456dff2 100644
--- a/frontend/src/hooks/useRenderNewVersionDiffLine.tsx
+++ b/frontend/src/hooks/useRenderNewVersionDiffLine.tsx
@@ -1,63 +1,33 @@
import { useCallback } from "react";
-
-const DIFF_TYPE = {
- ADDED: "added",
- DELETED: "deleted",
- UNCHANGED: "unchanged",
- MODIFIED: "modified"
-} as const;
-
-type DiffLine = {
- type: (typeof DIFF_TYPE)[keyof typeof DIFF_TYPE];
- oldLine?: string;
- newLine?: string;
-};
-
-type WordDiff = {
- type: typeof DIFF_TYPE.ADDED | typeof DIFF_TYPE.DELETED | typeof DIFF_TYPE.UNCHANGED;
- text: string;
-};
+import { type Change } from "diff";
type UseRenderNewVersionDiffLineParams = {
- diffLine: DiffLine;
+ change: Change;
+ nextChange: Change | undefined;
lineKey: string;
isFirstChanged: boolean;
lineClass: string;
- computeWordDiff: (oldText: string, newText: string) => WordDiff[] | null;
+ computeWordDiff: (oldText: string, newText: string) => Change[] | null;
};
export const useRenderNewVersionDiffLine = () => {
const renderNewVersionDiffLine = useCallback(
- ({ diffLine, lineKey, isFirstChanged, lineClass, computeWordDiff }: UseRenderNewVersionDiffLineParams): JSX.Element | null => {
- // ADDED lines should always be shown as a single block (no word-by-word highlighting)
- if (diffLine.type === DIFF_TYPE.ADDED && diffLine.newLine) {
- return (
- <div
- key={lineKey}
- className={lineClass}
- 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>
- );
+ ({ change, lineKey, isFirstChanged, lineClass }: UseRenderNewVersionDiffLineParams): JSX.Element | null => {
+ // Skip removed lines (they're handled in old version)
+ if (change.removed) {
+ return null;
+ }
+
+ // Get the line from the change value
+ const lines = change.value.split("\n");
+ if (!change.value.endsWith("\n") && lines.length > 0 && lines[lines.length - 1] === "") {
+ lines.pop();
}
+ const line = lines[0] ?? "";
- if (diffLine.type === DIFF_TYPE.MODIFIED && diffLine.newLine) {
- const wordDiffs = computeWordDiff(diffLine.oldLine || "", diffLine.newLine);
- // If no common words, just show the line with line-level background (no extra inner highlight)
- if (wordDiffs === null) {
- return (
- <div
- key={lineKey}
- className={lineClass}
- 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>
- );
- }
+ // ADDED lines should always be shown as a single block (no word-by-word highlighting)
+ // Modifications are handled in the parent component
+ if (change.added) {
return (
<div
key={lineKey}
@@ -65,23 +35,12 @@ export const useRenderNewVersionDiffLine = () => {
data-first-change={isFirstChanged ? "true" : undefined}
>
<div className="w-4 shrink-0">+</div>
- <div className="min-w-0 flex-1 break-words">
- {wordDiffs.map((wordDiff, wordIdx) => {
- if (wordDiff.type === DIFF_TYPE.DELETED) return null;
- const wordKey = `${lineKey}-word-${wordIdx}`;
- const wordClass =
- wordDiff.type === DIFF_TYPE.ADDED ? "bg-green-600/70 rounded px-0.5" : "";
- return (
- <span key={wordKey} className={wordClass}>
- {wordDiff.text}
- </span>
- );
- })}
- </div>
+ <div className="min-w-0 flex-1 break-words">{line}</div>
</div>
);
}
+ // Unchanged lines - return null to use default rendering
return null;
},
[]
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 e56254eb06..b6fc4ffa4d 100644
--- a/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx
+++ b/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx
@@ -46,56 +46,21 @@ const isArray = (obj: JsonValue): obj is JsonArray => {
return Array.isArray(obj);
};
-// Normalize secret value to match backend behavior:
-// - Trim whitespace
-// - If value ends with \n, preserve it (but trim everything else)
-// This matches the backend transform: (val.at(-1) === "\n" ? `${val.trim()}\n` : val.trim())
-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 deepEqual = (a: JsonValue, b: JsonValue): boolean => {
+ if (a === b) return true;
+ if (a == null || b == null) return false;
+ if (typeof a !== typeof b) return false;
+
+ if (isArray(a) && isArray(b)) {
+ if (a.length !== b.length) return false;
+ return a.every((item: JsonValue, index: number) => deepEqual(item, b[index]));
}
- return value.trim();
-};
-
-// 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";
-
- // Only normalize secretValue strings
- if (isSecretValue && typeof value === "string") {
- return normalizeSecretValue(value);
- }
- return value;
-};
-
-const deepEqual = (a: JsonValue, b: JsonValue, key?: string, path?: string): boolean => {
- 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)
- );
- }
-
- if (isObject(normalizedA) && isObject(normalizedB)) {
- const keysA = Object.keys(normalizedA);
- const keysB = Object.keys(normalizedB);
+ if (isObject(a) && isObject(b)) {
+ const keysA = Object.keys(a);
+ const keysB = Object.keys(b);
if (keysA.length !== keysB.length) return false;
- 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);
- });
+ return keysA.every((key) => keysB.includes(key) && deepEqual(a[key], b[key]));
}
return false;
@@ -103,29 +68,25 @@ 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>();
- const pathParts = path.split(".");
- const currentKey = pathParts[pathParts.length - 1] || "";
- const normalizedOld = normalizeValueForComparison(oldObj, currentKey, path);
- const normalizedNew = normalizeValueForComparison(newObj, currentKey, path);
- if (normalizedOld === normalizedNew) return diffPaths;
+ if (oldObj === newObj) return diffPaths;
- if (normalizedOld == null || normalizedNew == null) {
+ if (oldObj == null || newObj == null) {
diffPaths.add(path || "root");
return diffPaths;
}
- if (typeof normalizedOld !== typeof normalizedNew) {
+ if (typeof oldObj !== typeof newObj) {
diffPaths.add(path || "root");
return diffPaths;
}
- if (isArray(normalizedOld) && isArray(normalizedNew)) {
+ if (isArray(oldObj) && isArray(newObj)) {
return diffPaths;
}
- if (isObject(normalizedOld) && isObject(normalizedNew)) {
- const allKeys = new Set([...Object.keys(normalizedOld), ...Object.keys(normalizedNew)]);
+ if (isObject(oldObj) && isObject(newObj)) {
+ const allKeys = new Set([...Object.keys(oldObj), ...Object.keys(newObj)]);
allKeys.forEach((key) => {
const currentPath = path ? `${path}.${key}` : key;
@@ -134,20 +95,16 @@ 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 oldObj) || !(key in newObj) || !deepEqual(oldObj[key], newObj[key])) {
diffPaths.add(currentPath);
if (
- key in normalizedOld &&
- key in normalizedNew &&
- (isObject(normalizedOld[key]) || isArray(normalizedOld[key])) &&
- (isObject(normalizedNew[key]) || isArray(normalizedNew[key]))
+ key in oldObj &&
+ key in newObj &&
+ (isObject(oldObj[key]) || isArray(oldObj[key])) &&
+ (isObject(newObj[key]) || isArray(newObj[key]))
) {
- const nestedDiffs = getDiffPaths(normalizedOld[key], normalizedNew[key], currentPath);
+ const nestedDiffs = getDiffPaths(oldObj[key], newObj[key], currentPath);
nestedDiffs.forEach((p) => diffPaths.add(p));
}
}
@@ -155,8 +112,7 @@ const getDiffPaths = (oldObj: JsonValue, newObj: JsonValue, path: string = ""):
return diffPaths;
}
- // For primitive values (strings, numbers, booleans), compare normalized values
- if (normalizedOld !== normalizedNew) {
+ if (oldObj !== newObj) {
diffPaths.add(path || "root");
}
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 d3961fa31d..82141f91d2 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
@@ -14,17 +14,14 @@ import {
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
+import { diffLines, diffWords } from "diff";
+import type { Change } from "diff";
+
import { SecretInput, Tag, Tooltip } from "@app/components/v2";
import { CommitType, SecretV3Raw, TSecretApprovalSecChange, WsTag } from "@app/hooks/api/types";
import { useRenderNewVersionDiffLine } from "@app/hooks/useRenderNewVersionDiffLine";
// ===== MULTILINE DIFF FUNCTIONS =====
-const DIFF_TYPE = {
- ADDED: "added",
- DELETED: "deleted",
- UNCHANGED: "unchanged",
- MODIFIED: "modified"
-} as const;
// Normalize secret value to match backend behavior:
// - Trim whitespace
@@ -54,187 +51,39 @@ const isSingleLine = (str: string | null | undefined): boolean => {
return !str.includes("\n");
};
-type DiffLine = {
- type: (typeof DIFF_TYPE)[keyof typeof DIFF_TYPE];
- oldLine?: string;
- newLine?: string;
-};
-
-type WordDiff = {
- type: typeof DIFF_TYPE.ADDED | typeof DIFF_TYPE.DELETED | typeof DIFF_TYPE.UNCHANGED;
- text: string;
-};
-
-// Simple line-by-line diff algorithm
-// Normalizes lines by trimming trailing whitespace before comparison
-const computeLineDiff = (oldText: string, newText: string): DiffLine[] => {
- // Normalize the texts before splitting
+// Use jsdiff for line-by-line diffing - returns Change[] directly
+const computeLineDiff = (oldText: string, newText: string): Change[] => {
+ // Normalize the texts before diffing
const normalizedOld = normalizeSecretValue(oldText);
const normalizedNew = normalizeSecretValue(newText);
- const oldLines = normalizedOld.split("\n");
- const newLines = normalizedNew.split("\n");
- const result: DiffLine[] = [];
-
- let oldIndex = 0;
- let newIndex = 0;
-
- while (oldIndex < oldLines.length || newIndex < newLines.length) {
- if (oldIndex >= oldLines.length) {
- result.push({
- type: DIFF_TYPE.ADDED,
- newLine: newLines[newIndex]
- });
- newIndex += 1;
- } else if (newIndex >= newLines.length) {
- result.push({
- type: DIFF_TYPE.DELETED,
- 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 {
- 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.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 {
- while (oldIndex < nextNewMatch) {
- result.push({
- type: DIFF_TYPE.DELETED,
- oldLine: oldLines[oldIndex]
- });
- oldIndex += 1;
- }
- }
- }
- }
- }
-
- return result;
+ // Use jsdiff's diffLines
+ return diffLines(normalizedOld, normalizedNew, {
+ ignoreWhitespace: false,
+ newlineIsToken: false
+ });
};
-// Word-level diff for modified lines
-// Normalizes texts before computing word diff to ignore whitespace-only changes
-// If there are no common words, returns null to indicate entire line should be highlighted
-const computeWordDiff = (oldText: string, newText: string): WordDiff[] | null => {
- // Normalize the texts before computing word diff
+// Use jsdiff for word-level diffing - returns Change[] directly or null
+const computeWordDiff = (oldText: string, newText: string): Change[] | null => {
+ // Normalize the texts before diffing
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) || [];
+ // Use jsdiff's diffWords
+ const changes = diffWords(normalizedOld, normalizedNew);
// 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 hasCommonWords = changes.some(
+ (change) => !change.added && !change.removed && /\w/.test(change.value)
+ );
// If no common words, return null to indicate entire line should be highlighted
- if (!hasCommonWords && oldWords.length > 0 && newWords.length > 0) {
+ if (!hasCommonWords && normalizedOld.trim() !== "" && normalizedNew.trim() !== "") {
return null;
}
- const result: WordDiff[] = [];
- let oldIdx = 0;
- let newIdx = 0;
-
- while (oldIdx < oldWords.length || newIdx < newWords.length) {
- if (oldIdx >= oldWords.length) {
- result.push({ type: DIFF_TYPE.ADDED, text: newWords[newIdx] });
- newIdx += 1;
- } else if (newIdx >= newWords.length) {
- result.push({ type: DIFF_TYPE.DELETED, text: oldWords[oldIdx] });
- oldIdx += 1;
- } else if (oldWords[oldIdx] === newWords[newIdx]) {
- result.push({ type: DIFF_TYPE.UNCHANGED, text: oldWords[oldIdx] });
- oldIdx += 1;
- newIdx += 1;
- } else {
- const currentOldIdx = oldIdx;
- const currentNewIdx = newIdx;
- const currentOldWord = oldWords[currentOldIdx];
- const currentNewWord = newWords[currentNewIdx];
-
- const nextOldMatch = newWords.findIndex(
- (word, idx) => idx >= currentNewIdx && word === currentOldWord
- );
- const nextNewMatch = oldWords.findIndex(
- (word, idx) => idx >= currentOldIdx && word === currentNewWord
- );
-
- if (nextOldMatch === -1 && nextNewMatch === -1) {
- result.push({ type: DIFF_TYPE.DELETED, text: currentOldWord });
- result.push({ type: DIFF_TYPE.ADDED, text: currentNewWord });
- oldIdx += 1;
- newIdx += 1;
- } else if (nextOldMatch !== -1 && (nextNewMatch === -1 || nextOldMatch < nextNewMatch)) {
- while (newIdx < nextOldMatch) {
- result.push({ type: DIFF_TYPE.ADDED, text: newWords[newIdx] });
- newIdx += 1;
- }
- } else {
- while (oldIdx < nextNewMatch) {
- result.push({ type: DIFF_TYPE.DELETED, text: oldWords[oldIdx] });
- oldIdx += 1;
- }
- }
- }
- }
- return result;
+ return changes;
};
// Render single-line diff (just word highlighting, no container/+/-)
@@ -261,21 +110,20 @@ const renderSingleLineDiffForApproval = (
// Show word-by-word diff when there are common words
return (
<div className="font-mono text-sm break-words">
- {wordDiffs.map((wordDiff, wordIdx) => {
- if (isOldVersion && wordDiff.type === DIFF_TYPE.ADDED) return null;
- if (!isOldVersion && wordDiff.type === DIFF_TYPE.DELETED) return null;
+ {wordDiffs.map((change, wordIdx) => {
+ if (isOldVersion && change.added) return null;
+ if (!isOldVersion && change.removed) return null;
const wordKey = `singleline-word-${wordIdx}`;
- const wordClass =
- wordDiff.type === DIFF_TYPE.DELETED
- ? "bg-red-600/70 rounded px-0.5"
- : wordDiff.type === DIFF_TYPE.ADDED
- ? "bg-green-600/70 rounded px-0.5"
- : "";
+ const wordClass = change.removed
+ ? "bg-red-600/70 rounded px-0.5"
+ : change.added
+ ? "bg-green-600/70 rounded px-0.5"
+ : "";
return (
<span key={wordKey} className={wordClass}>
- {wordDiff.text}
+ {change.value}
</span>
);
})}
@@ -289,43 +137,145 @@ const renderMultilineDiffForApproval = (
newText: string,
isOldVersion: boolean,
renderNewVersionDiffLine?: (params: {
- diffLine: DiffLine;
+ change: Change;
+ nextChange: Change | undefined;
lineKey: string;
isFirstChanged: boolean;
lineClass: string;
- computeWordDiff: (oldText: string, newText: string) => WordDiff[] | null;
+ computeWordDiff: (oldText: string, newText: string) => Change[] | null;
}) => JSX.Element | null
): JSX.Element => {
- const diffLines = computeLineDiff(oldText, newText);
+ const lineChanges = computeLineDiff(oldText, newText);
// Find the first changed line index
- const firstChangedIndex = diffLines.findIndex((line) =>
- isOldVersion
- ? line.type === DIFF_TYPE.DELETED || line.type === DIFF_TYPE.MODIFIED
- : line.type === DIFF_TYPE.ADDED || line.type === DIFF_TYPE.MODIFIED
- );
+ let firstChangedIndex = -1;
+ let lineIndex = 0;
+ for (let i = 0; i < lineChanges.length; i++) {
+ const change = lineChanges[i];
+ const lines = change.value.split("\n");
+ if (!change.value.endsWith("\n") && lines.length > 0 && lines[lines.length - 1] === "") {
+ lines.pop();
+ }
+
+ const isChanged = isOldVersion ? change.removed : change.added;
+ if (isChanged && firstChangedIndex === -1) {
+ firstChangedIndex = lineIndex;
+ break;
+ }
+ lineIndex += lines.length;
+ }
+
+ let currentLineIndex = 0;
+ let firstChangedFound = false;
return (
<div className="min-w-full font-mono text-sm break-words whitespace-pre-wrap">
- {diffLines.map((diffLine, lineIndex) => {
- const lineKey = `multiline-${lineIndex}-${diffLine.type}`;
- const isFirstChanged = lineIndex === firstChangedIndex;
-
- if (isOldVersion) {
- // Render old version
- if (diffLine.type === DIFF_TYPE.ADDED) {
- return null; // Skip added lines in old version
+ {lineChanges.map((change, changeIdx) => {
+ const nextChange = lineChanges[changeIdx + 1];
+ const lines = change.value.split("\n");
+ if (!change.value.endsWith("\n") && lines.length > 0 && lines[lines.length - 1] === "") {
+ lines.pop();
+ }
+
+ return lines.map((line, lineIdx) => {
+ const lineKey = `multiline-${changeIdx}-${lineIdx}`;
+ const isFirstChanged = !firstChangedFound && currentLineIndex === firstChangedIndex;
+ if (isFirstChanged) firstChangedFound = true;
+ currentLineIndex += 1;
+
+ if (isOldVersion) {
+ // Render old version
+ if (change.added) {
+ return null; // Skip added lines in old version
+ }
+
+ const isChanged = change.removed;
+ const lineClass = isChanged
+ ? "flex min-w-full bg-red-500/70 rounded-xs text-red-300"
+ : "flex min-w-full";
+
+ // If this is a removed line followed by an added line, it's a modification
+ if (change.removed && nextChange?.added) {
+ const nextLines = nextChange.value.split("\n");
+ if (!nextChange.value.endsWith("\n") && nextLines.length > 0 && nextLines[nextLines.length - 1] === "") {
+ nextLines.pop();
+ }
+ const newLine = nextLines[lineIdx] ?? "";
+ const wordDiffs = computeWordDiff(line, newLine);
+
+ // If no common words, just show the line with line-level background
+ if (wordDiffs === null) {
+ return (
+ <div
+ key={lineKey}
+ className={lineClass}
+ data-first-change={isFirstChanged ? "true" : undefined}
+ >
+ <div className="w-4 shrink-0">-</div>
+ <div className="min-w-0 flex-1 break-words">{line}</div>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ key={lineKey}
+ className={lineClass}
+ data-first-change={isFirstChanged ? "true" : undefined}
+ >
+ <div className="w-4 shrink-0">-</div>
+ <div className="min-w-0 flex-1 break-words">
+ {wordDiffs.map((wordChange, wordIdx) => {
+ if (wordChange.added) return null;
+ const wordKey = `${lineKey}-word-${wordIdx}`;
+ const wordClass = wordChange.removed ? "bg-red-600/70 rounded px-0.5" : "";
+ return (
+ <span key={wordKey} className={wordClass}>
+ {wordChange.value}
+ </span>
+ );
+ })}
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ key={lineKey}
+ className={lineClass}
+ data-first-change={isFirstChanged ? "true" : undefined}
+ >
+ <div className="w-4 shrink-0">{isChanged ? "-" : " "}</div>
+ <div className="min-w-0 flex-1 break-words">{line}</div>
+ </div>
+ );
}
- const isChanged =
- diffLine.type === DIFF_TYPE.DELETED || diffLine.type === DIFF_TYPE.MODIFIED;
+ // Render new version
+ if (change.removed) {
+ return null; // Skip deleted lines in new version
+ }
+
+ // Check if previous change was removed (modification case)
+ const prevChange = changeIdx > 0 ? lineChanges[changeIdx - 1] : undefined;
+ const isModification = prevChange?.removed && change.added;
+
+ const isChanged = change.added;
const lineClass = isChanged
- ? "flex min-w-full bg-red-500/70 rounded-xs text-red-300"
+ ? "flex min-w-full bg-green-500/70 rounded-xs text-green-300"
: "flex min-w-full";
- if (diffLine.type === DIFF_TYPE.MODIFIED && diffLine.oldLine) {
- const wordDiffs = computeWordDiff(diffLine.oldLine, diffLine.newLine || "");
- // If no common words, just show the line with line-level background (no extra inner highlight)
+ // If this is a modification, show word-level diff
+ if (isModification && prevChange) {
+ const prevLines = prevChange.value.split("\n");
+ if (!prevChange.value.endsWith("\n") && prevLines.length > 0 && prevLines[prevLines.length - 1] === "") {
+ prevLines.pop();
+ }
+ const oldLine = prevLines[lineIdx] ?? "";
+ const wordDiffs = computeWordDiff(oldLine, line);
+
+ // If no common words, just show the line with line-level background
if (wordDiffs === null) {
return (
<div
@@ -333,27 +283,42 @@ const renderMultilineDiffForApproval = (
className={lineClass}
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="w-4 shrink-0">+</div>
+ <div className="min-w-0 flex-1 break-words">{line}</div>
</div>
);
}
+
+ // Use the hook to render new version diff lines with word highlighting
+ if (renderNewVersionDiffLine) {
+ const rendered = renderNewVersionDiffLine({
+ change,
+ nextChange,
+ lineKey,
+ isFirstChanged,
+ lineClass,
+ computeWordDiff
+ });
+ if (rendered !== null) {
+ return rendered;
+ }
+ }
+
return (
<div
key={lineKey}
className={lineClass}
data-first-change={isFirstChanged ? "true" : undefined}
>
- <div className="w-4 shrink-0">-</div>
+ <div className="w-4 shrink-0">+</div>
<div className="min-w-0 flex-1 break-words">
- {wordDiffs.map((wordDiff, wordIdx) => {
- if (wordDiff.type === DIFF_TYPE.ADDED) return null;
+ {wordDiffs.map((wordChange, wordIdx) => {
+ if (wordChange.removed) return null;
const wordKey = `${lineKey}-word-${wordIdx}`;
- const wordClass =
- wordDiff.type === DIFF_TYPE.DELETED ? "bg-red-600/70 rounded px-0.5" : "";
+ const wordClass = wordChange.added ? "bg-green-600/70 rounded px-0.5" : "";
return (
<span key={wordKey} className={wordClass}>
- {wordDiff.text}
+ {wordChange.value}
</span>
);
})}
@@ -362,52 +327,32 @@ const renderMultilineDiffForApproval = (
);
}
+ // Use the hook to render new version diff lines
+ if (renderNewVersionDiffLine) {
+ const rendered = renderNewVersionDiffLine({
+ change,
+ nextChange,
+ lineKey,
+ isFirstChanged,
+ lineClass,
+ computeWordDiff
+ });
+ if (rendered !== null) {
+ return rendered;
+ }
+ }
+
return (
<div
key={lineKey}
className={lineClass}
data-first-change={isFirstChanged ? "true" : undefined}
>
- <div className="w-4 shrink-0">{isChanged ? "-" : " "}</div>
- <div className="min-w-0 flex-1 break-words">{diffLine.oldLine}</div>
+ <div className="w-4 shrink-0">{isChanged ? "+" : " "}</div>
+ <div className="min-w-0 flex-1 break-words">{line}</div>
</div>
);
- }
-
- // Render new version
- if (diffLine.type === DIFF_TYPE.DELETED) {
- return null; // Skip deleted lines in new version
- }
-
- const isChanged = diffLine.type === DIFF_TYPE.ADDED || diffLine.type === DIFF_TYPE.MODIFIED;
- const lineClass = isChanged
- ? "flex min-w-full bg-green-500/70 rounded-xs text-green-300"
- : "flex min-w-full";
-
- // Use the hook to render new version diff lines
- if (renderNewVersionDiffLine) {
- const rendered = renderNewVersionDiffLine({
- diffLine,
- lineKey,
- isFirstChanged,
- lineClass,
- computeWordDiff
- });
- if (rendered !== null) {
- return rendered;
- }
- }
-
- return (
- <div
- key={lineKey}
- className={lineClass}
- data-first-change={isFirstChanged ? "true" : undefined}
- >
- <div className="w-4 shrink-0">{isChanged ? "+" : " "}</div>
- <div className="min-w-0 flex-1 break-words">{diffLine.newLine}</div>
- </div>
- );
+ });
})}
</div>
);
@@ -471,11 +416,12 @@ const renderOldSecretValue = ({
newValue: string;
oldDiffContainerRef: React.RefObject<HTMLDivElement>;
renderNewVersionDiffLine: (params: {
- diffLine: DiffLine;
+ change: Change;
+ nextChange: Change | undefined;
lineKey: string;
isFirstChanged: boolean;
lineClass: string;
- computeWordDiff: (oldText: string, newText: string) => WordDiff[] | null;
+ computeWordDiff: (oldText: string, newText: string) => Change[] | null;
}) => JSX.Element | null;
}) => {
if (isRotatedSecret) {
@@ -576,11 +522,12 @@ const renderNewSecretValue = ({
newValue: string;
newDiffContainerRef: React.RefObject<HTMLDivElement>;
renderNewVersionDiffLine: (params: {
- diffLine: DiffLine;
+ change: Change;
+ nextChange: Change | undefined;
lineKey: string;
isFirstChanged: boolean;
lineClass: string;
- computeWordDiff: (oldText: string, newText: string) => WordDiff[] | null;
+ computeWordDiff: (oldText: string, newText: string) => Change[] | null;
}) => JSX.Element | null;
}) => {
if (isRotatedSecret) {
@@ -743,7 +690,7 @@ export const SecretApprovalRequestChangeItem = ({
<div>
<div className="flex flex-col space-y-4 space-x-0 xl:flex-row xl:space-y-0 xl:space-x-4">
{op === CommitType.UPDATE || op === CommitType.DELETE ? (
- <div className="flex w-full cursor-default flex-col rounded-md border border-red-600/60 bg-red-600/10 p-4 xl:w-1/2">
+ <div className="flex w-full cursor-default flex-col rounded-lg border border-red-600/60 bg-red-600/10 p-4 xl:w-1/2">
<div className="mb-4 flex flex-row justify-between">
<span className="text-md font-medium">Previous Secret</span>
<div className="rounded-full bg-red px-2 pt-[0.2rem] pb-[0.14rem] text-xs font-medium">
@@ -857,7 +804,7 @@ export const SecretApprovalRequestChangeItem = ({
</div>
)}
{op === CommitType.UPDATE || op === CommitType.CREATE ? (
- <div className="flex w-full cursor-default flex-col rounded-md border border-green-600/60 bg-green-600/10 p-4 xl:w-1/2">
+ <div className="flex w-full cursor-default flex-col rounded-lg border border-green-600/60 bg-green-600/10 p-4 xl:w-1/2">
<div className="mb-4 flex flex-row justify-between">
<span className="text-md font-medium">New Secret</span>
<div className="rounded-full bg-green-600 px-2 pt-[0.2rem] pb-[0.14rem] text-xs font-medium">
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
index 1e5af2c17c..d3172142ba 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
@@ -110,28 +110,7 @@ const normalizeValue = (value: any): string | boolean | undefined => {
return value;
};
-// Normalize secret value to match backend behavior:
-// - Trim whitespace
-// - If value ends with \n, preserve it (but trim everything else)
-// This matches the backend transform: (val.at(-1) === "\n" ? `${val.trim()}\n` : val.trim())
-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`;
- }
- return value.trim();
-};
-
-const areValuesEqual = (value1: any, value2: any, isSecretValue: boolean = false): boolean => {
- // For secret values, use the backend normalization
- if (isSecretValue) {
- const normalized1 = normalizeSecretValue(value1);
- const normalized2 = normalizeSecretValue(value2);
- return normalized1 === normalized2;
- }
-
- // For other values, use the original normalization
+const areValuesEqual = (value1: any, value2: any): boolean => {
const normalized1 = normalizeValue(value1);
const normalized2 = normalizeValue(value2);
@@ -160,7 +139,7 @@ const cleanupRevertedSecretFields = (update: PendingSecretUpdate): PendingSecret
if (
cleaned.secretValue !== undefined &&
- !areValuesEqual(cleaned.secretValue, cleaned.originalValue, true)
+ !areValuesEqual(cleaned.secretValue, cleaned.originalValue)
) {
hasChanges = true;
} else {
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 3ca41cdecc..20ad815acd 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
@@ -18,29 +18,6 @@ import {
useBatchModeActions
} from "../../SecretMainPage.store";
-// Normalize secret value to match backend behavior:
-// - Trim whitespace
-// - If value ends with \n, preserve it (but trim everything else)
-// This matches the backend transform: (val.at(-1) === "\n" ? `${val.trim()}\n` : val.trim())
-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`;
- }
- return value.trim();
-};
-
-// Compare normalized values to determine if they're actually different
-const areValuesEqual = (
- oldValue: string | null | undefined,
- newValue: string | null | undefined
-): boolean => {
- const normalizedOld = normalizeSecretValue(oldValue);
- const normalizedNew = normalizeSecretValue(newValue);
- return normalizedOld === normalizedNew;
-};
-
interface CommitFormProps {
onCommit: (changes: PendingChanges, commitMessage: string) => Promise<void>;
isCommitting?: boolean;
@@ -93,7 +70,7 @@ const RenderSecretChanges = ({ onDiscard, change }: RenderResourceProps) => {
const { existingSecret } = change;
const hasKeyChange = change.newSecretName && change.secretKey !== change.newSecretName;
- const hasValueChange = !areValuesEqual(change.secretValue, change.originalValue);
+ const hasValueChange = change.secretValue !== change.originalValue;
const hasCommentChange = change.secretComment !== change.originalComment;
const hasMultilineChange =
change.skipMultilineEncoding !== change.originalSkipMultilineEncoding;
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 3976c84e2f..dfcaecc226 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
@@ -279,23 +279,19 @@ export const SecretListView = ({
(newId) => !orgSecret.secretReminderRecipients?.find((oldId) => newId === oldId.user.id)
) && reminderRecipients?.length === orgSecret.secretReminderRecipients?.length;
- const normalizeSecretValue = (val: string | null | undefined): string => {
- if (!val || typeof val !== "string") return "";
- if (val.at(-1) === "\n") {
- return `${val.trim()}\n`;
- }
- return val.trim();
- };
-
const isSharedSecUnchanged =
- orgSecret.key === modSecret.key &&
- normalizeSecretValue(orgSecret.value) === normalizeSecretValue(modSecret.value) &&
- orgSecret.comment === modSecret.comment &&
- orgSecret.skipMultilineEncoding === modSecret.skipMultilineEncoding &&
- orgSecret.reminderRepeatDays === modSecret.reminderRepeatDays &&
- orgSecret.reminderNote === modSecret.reminderNote &&
- orgSecret.reminderRecipients === modSecret.reminderRecipients &&
- JSON.stringify(orgSecret.secretMetadata) === JSON.stringify(modSecret.secretMetadata) &&
+ (
+ [
+ "key",
+ "value",
+ "comment",
+ "skipMultilineEncoding",
+ "reminderRepeatDays",
+ "reminderNote",
+ "reminderRecipients",
+ "secretMetadata"
+ ] as const
+ ).every((el) => orgSecret[el] === modSecret[el]) &&
isSameTags &&
isSameRecipients;