Skip to content

Potential fix for code scanning alert no. 39: Use of password hash with insufficient computational effort#104

Merged
zeroc0d3 merged 1 commit into
mainfrom
alert-autofix-39
May 25, 2026
Merged

Potential fix for code scanning alert no. 39: Use of password hash with insufficient computational effort#104
zeroc0d3 merged 1 commit into
mainfrom
alert-autofix-39

Conversation

@zeroc0d3

Copy link
Copy Markdown
Member

Potential fix for https://github.com/telemetryflow/telemetryflow-core/security/code-scanning/39

Use a slow password hashing scheme (best here: Node’s built-in crypto.scryptSync) instead of raw SHA-256 when deriving api_key_secret for storage.

Best single fix in this file:

  • Keep existing functionality (store a derived secret string), but change line 322 logic to:
    • Generate a random salt per key.
    • Derive with scryptSync(secret, salt, 64).
    • Store in a self-contained format like scrypt$<saltHex>$<hashHex> so verification code can parse it later.
  • This avoids adding external dependencies and satisfies CodeQL by replacing fast hash with computationally expensive KDF.

Edits are only in:

  • backend/src/modules/api-keys/infrastructure/persistence/seeds/01-DefaultApiKeysSeed.ts
  • Specifically around the current SHA-256 assignment for apiKeySecret.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…th insufficient computational effort

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@zeroc0d3 zeroc0d3 marked this pull request as ready for review May 25, 2026 05:46
@zeroc0d3 zeroc0d3 merged commit 13583d0 into main May 25, 2026
4 of 5 checks passed
@zeroc0d3 zeroc0d3 deleted the alert-autofix-39 branch May 25, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant