Skip to content

Commit 13583d0

Browse files
authored
Merge pull request #104 from telemetryflow/alert-autofix-39
Potential fix for code scanning alert no. 39: Use of password hash with insufficient computational effort
2 parents 8ac1a86 + 9f37c52 commit 13583d0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

backend/src/modules/api-keys/infrastructure/persistence/seeds/01-DefaultApiKeysSeed.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ export class DefaultApiKeysSeed extends BaseSeed {
319319
continue;
320320
}
321321

322-
const apiKeySecret = crypto.createHash("sha256").update(key.api_key_secret_raw).digest("hex");
322+
const secretSalt = crypto.randomBytes(16).toString("hex");
323+
const secretHash = crypto.scryptSync(key.api_key_secret_raw, secretSalt, 64).toString("hex");
324+
const apiKeySecret = `scrypt$${secretSalt}$${secretHash}`;
323325
const keyHint = key.api_key_secret_raw.slice(-4);
324326

325327
// Encrypt the per-key encryption key with platform ENCRYPTION_KEY

0 commit comments

Comments
 (0)