Skip to content

Retire MD5 and SHA-1 for new field hashes; use SHA-256 for script cache keys - #203

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-weak-hash-algorithms
Open

vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-weak-hash-algorithms

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

Closes the two remaining java/potentially-weak-cryptographic-algorithm CodeQL alerts (#24, #25); #23 was dismissed as a false positive (the algorithm name comes from the header of the shipped .checksums.csv).

#25 — MD5 / SHA-1 field storage schemes become verify-only

SaltedMD5FieldStorageScheme and SaltedSHA1FieldStorageScheme were selectable for secureHash (default is SHA-256). Rather than removing them — which would break verification of already-stored hashes — they are retired for new hashes only:

  • CryptoServiceImpl.hash() rejects MD5 and SHA-1 with a JsonCryptoException (…no longer supported for creating new hashes (existing hashes remain verifiable); use SHA-256 or stronger).
  • CryptoServiceImpl.matches() is unchanged, so values hashed by earlier releases keep matching. No data migration needed.
  • Admin UI secureHash selector (EditManagedView.js) and the CLI secureHash docs no longer offer MD5/SHA-1.

Anyone with secureHash.algorithm: "MD5"|"SHA-1" in managed.json will get the error above on the next write of that property and needs to switch to SHA-256+; reads/logins keep working.

#24 — script cache key

ScriptRegistryService.takeScript() derived the cache name of inline scripts from SHA-1(source + type). Switched to SHA-256. The name is a transient in-memory cache key, never persisted, so there is no compatibility impact.

Test plan

  • CryptoServiceImplTest: hash() throws for MD5/SHA-1 (failed before the change); matches() still verifies hashes produced by the legacy schemes; SHA-256 round-trips — 11/11
  • ScriptRegistryServiceTest: inline script name equals SHA-256(source + type) hex (failed before the change) — 9/9 in module
  • Reactor build through openidm-crypto and openidm-script — no failures
  • CodeQL on this PR closes [#21] Upgrade grunt-contrib-qunit #24 and ADD Docker build images, test, release #25

…he keys

CryptoService.hash() now rejects MD5 and SHA-1 with a clear error; existing
values hashed with those algorithms are still verified by matches(), so no
data migration is needed. The admin UI secureHash selector and the CLI
documentation no longer offer them.

ScriptRegistryService used SHA-1 to derive the cache name of inline scripts;
switched to SHA-256 (the name is a transient cache key, not persisted).

Resolves CodeQL alerts OpenIdentityPlatform#24 and OpenIdentityPlatform#25 (java/potentially-weak-cryptographic-algorithm).
@vharseko vharseko added security Security fix / CVE remediation java Pull requests that update Java code test Tests and test infrastructure (unit, e2e, smoke) documentation Documentation, javadoc, adoc, README, wiki javascript Pull requests that update Javascript code labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation, javadoc, adoc, README, wiki java Pull requests that update Java code javascript Pull requests that update Javascript code security Security fix / CVE remediation test Tests and test infrastructure (unit, e2e, smoke)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant