Migrate file upload digest algorithm from MD5 to SHA-384 (FIPS 140-3 + NCS) - #1884
Migrate file upload digest algorithm from MD5 to SHA-384 (FIPS 140-3 + NCS)#1884vkalapov wants to merge 1 commit into
Conversation
…+ NCS) LMCROSSITXSADEPLOY-3224
|
| private static final String DIGEST_METHOD = "MD5"; | ||
| private static final String PIC_MD5_DIGEST = "b39a167875c3771c384c9aa5601fc2d6"; | ||
| private static final String DIGEST_METHOD = "SHA-384"; | ||
| private static final String PIC_SHA256_DIGEST = "b43c60daa2a0f2e4eeadd057da75976d26d21e79ca784970c62da10edb6928692f0ab9bf5e82ca55a2905c0307e9b2b3"; |
There was a problem hiding this comment.
Why sha256 digest was used instead of sha-384?
| public static final String VARIABLE_NAME_SERVICE_ID = "__SERVICE_ID"; | ||
|
|
||
| public static final String DIGEST_ALGORITHM = "MD5"; | ||
| public static final String DIGEST_ALGORITHM = "SHA-384"; |
There was a problem hiding this comment.
Shouldn't we use SHA3 alrogirthm instead of SHA2? Also recommended length isn't it 512 instead of 384?
Another important thing is what will happen when this change is applied during blue-green update and there are running mta operations or files upload?
What will happen if files were uploaded and persisted with md5 digest and then read/retrieved from updated instance of deploy service and try to parse stored md5 checksums as SHA-384? I think we have to implement some backwards compatible logic in order to avoid breaking running mta operations/running file uploads.



What
Change
Constants.DIGEST_ALGORITHMfrom"MD5"to"SHA-384"and update all test fixtures accordingly.Why
SHA-384 satisfies both FIPS 140-3 (FIPS 180-4) and NCS MODERATE requirements. MD5 and SHA-256 are not approved at NCS MODERATE level.
Compatibility
Backward compatible — no breaking change.
The server always computes and stores its own digest on upload (
DatabaseFileService→SqlFileQueryProvider). No client-sent digest is ever read or verified on the server side.isFileAlreadyUploadedwill hit"Unsupported digest algorithm"for the SHA-384 entries returned byGET /files, re-upload on every retry instead of skipping — deploys complete successfully.UploadAppStepdetects mismatch between freshly computed SHA-384 and the MD5 value stored in the CF app environment → one-time forced re-upload of every app binary. Self-heals on the second deploy.LMCROSSITXSADEPLOY-3224