Skip to content

Defense-in-depth: Use HMAC with SHA-256 to hash API key - #100

Open
S3DFX-CYBER wants to merge 2 commits into
accuknox:mainfrom
S3DFX-CYBER:main
Open

S3DFX-CYBER wants to merge 2 commits into
accuknox:mainfrom
S3DFX-CYBER:main

Conversation

@S3DFX-CYBER

Copy link
Copy Markdown

Fixes #98
This PR Switches to HMAC-SHA-256 with a server-side pepper stored outside the DB (config/K8s secret), keeps the existing text column and lookup query unchanged, so it's a drop-in replacement.

Replace SHA-256 hashing with HMAC for API key.
@S3DFX-CYBER

Copy link
Copy Markdown
Author

@Aryan-sharma11 @murtaza-u would appreciate a review over this

@murtaza-u

Copy link
Copy Markdown
Collaborator

There are two VERY obvious issues with this PR:

  1. The pepperKey is defined no where. The gateway will refuse to compile
  2. This PR doesn't touch the nextjs web app. The web app still stores plain SHA-256 hashes. Switching only the gateway lookup to HMAC means existing and newly created api keys will not match.

Please do not file untested PRs.

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.

Defense-in-depth: API keys hashed with unsalted SHA-256 (weak crypto)

2 participants