Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the two remaining
java/potentially-weak-cryptographic-algorithmCodeQL 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
SaltedMD5FieldStorageSchemeandSaltedSHA1FieldStorageSchemewere selectable forsecureHash(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()rejectsMD5andSHA-1with aJsonCryptoException(…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.secureHashselector (EditManagedView.js) and the CLIsecureHashdocs no longer offer MD5/SHA-1.Anyone with
secureHash.algorithm: "MD5"|"SHA-1"inmanaged.jsonwill 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 fromSHA-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/11ScriptRegistryServiceTest: inline script name equalsSHA-256(source + type)hex (failed before the change) — 9/9 in moduleopenidm-cryptoandopenidm-script— no failures