Skip to content

Potential fix for code scanning alert no. 2: Use of a broken or weak cryptographic hashing algorithm on sensitive data - #8

Merged
Artixcore merged 1 commit into
masterfrom
alert-autofix-2
Jul 29, 2026
Merged

Potential fix for code scanning alert no. 2: Use of a broken or weak cryptographic hashing algorithm on sensitive data#8
Artixcore merged 1 commit into
masterfrom
alert-autofix-2

Conversation

@Artixcore

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/Artixcore/artixcore-contentPilot/security/code-scanning/2

Use a password-hashing/KDF function for API-key verifier storage and verification, instead of fast HMAC-SHA256. The best low-impact fix here is to replace _hash with hashlib.pbkdf2_hmac (SHA-256, high iteration count) and keep the existing return type/flow (hex string) so DB schema and call sites remain unchanged.

What to change (core/workspace_api_keys.py):

  • In _hash (around lines 59–60), replace hmac.new(..., hashlib.sha256).hexdigest() with PBKDF2-HMAC-SHA256.
  • Keep _pepper() as the secret salt/pepper input.
  • Add a module constant for iteration count (e.g., PBKDF2_ITERATIONS = 310_000) near other constants.

This preserves behavior (deterministic hash for create/verify), requires no call-site changes, and addresses both alert variants.

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

…cryptographic hashing algorithm on sensitive data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Artixcore
Artixcore marked this pull request as ready for review July 29, 2026 19:17
@Artixcore
Artixcore merged commit a455f73 into master Jul 29, 2026
1 check passed
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