Switch md5 to sha256

For FIPS compliance

Signed-off-by: Tomasz Szuba <tszuba@box.com>
This commit is contained in:
Tomasz Szuba
2023-12-18 13:50:10 +01:00
parent 12c629addb
commit b6b15b2a0a
6 changed files with 19 additions and 4 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/cli': patch
---
Use sha256 instead of md5 in build script cache key calculation
Makes it possible to build on FIPS nodejs.
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/backend-common': patch
---
Use sha256 instead of md5 for hash key calculation in caches
This can have a side effect of invalidating caches (when cache key was >250 characters)
This improves compliance with FIPS nodejs
+1 -1
View File
@@ -88,6 +88,6 @@ export class DefaultCacheClient implements CacheService {
return wellFormedKey;
}
return createHash('md5').update(candidateKey).digest('base64');
return createHash('sha256').update(candidateKey).digest('base64');
}
}
+1 -1
View File
@@ -219,7 +219,7 @@ async function getProjectConfig(targetPath, extraConfig) {
// If no explicit id was configured, generated one based on the configuration.
if (!config.id) {
const configHash = crypto
.createHash('md5')
.createHash('sha256')
.update(version)
.update(Buffer.alloc(1))
.update(JSON.stringify(config.transform))
+1 -1
View File
@@ -70,7 +70,7 @@ function createTransformer(config) {
};
const getCacheKey = sourceText => {
return createHash('md5')
return createHash('sha256')
.update(sourceText)
.update(Buffer.alloc(1))
.update(sucrasePkg.version)
+1 -1
View File
@@ -25,7 +25,7 @@ function createTransformer(config) {
const getCacheKey = sourceText => {
return crypto
.createHash('md5')
.createHash('sha256')
.update(sourceText)
.update(Buffer.alloc(1))
.update(JSON.stringify(config))