Description#

The HmacSha256 class contained two functions:

A downstream caller who read the class name and used HmacSha256.hash as a message authentication code without noticing it takes no key would get no authentication. There is no internal misuse in http4k itself: both production usages of HmacSha256.hash (AWS SigV4 canonical-request hashing and x-amz-content-sha256) are spec-correct uses of plain SHA-256, and every keyed call passes a real key.

The fix introduces Sha256.hash(input) (unkeyed digest) and Sha256.hmac(key, input) (keyed HMAC-SHA256). HmacSha256 is deprecated; existing callers continue to work via deprecation shims.

Affected http4k modules & versions#

Mitigation#

Upgrade to the fixed version and migrate to Sha256.hash or Sha256.hmac according to intent.

VersionFixed VersionAvailability
< 6.49.0.06.49.0.0Community & Enterprise Support

If you cannot upgrade and need a real HMAC-SHA256, use javax.crypto.Mac.getInstance("HmacSHA256") with a SecretKeySpec, or the existing hmacSHA256(key, data), which was always correctly implemented.

Resolution timeline#

Date/time (UTC)Notes
28/05/2026 01:05Discovered during the Claude-assisted security review pass; HmacSha256 deprecated (commit 1aa7e587d1)
30/05/2026 12:50Fix released in http4k CE v6.49.0.0
01/06/2026 16:15Advisory GHSA-m4w9-hjfw-vwj4 opened on GitHub
16/06/2026 14:06Public disclosure

References