Open
Conversation
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.
Security Fix: Remove Weak Cryptographic Algorithms (MD5/SHA1)
Problem Statement
Security vulnerability scanner (secsync) flagged usage of weak cryptographic algorithms (MD5/SHA1) in the go-getter codebase. These algorithms are cryptographically broken and should not be used for security-critical operations.
Solution
Completely removed MD5 and SHA1 support from production code, replacing with SHA256/SHA512. Users attempting to use MD5/SHA1 checksums receive clear error messages with migration instructions.
Changes Made
1. Cryptographic Algorithm Updates
crypto/md5import fromchecksum.go,folder_storage.go,decompress_testing.gocrypto/sha1import fromchecksum.gofolder_storage.go(line 66:sha256.Sum256())decompress_testing.go(line 157:sha256.New())2. Test Updates
Updated
get_test.go:TestGetFile_checksum- Removed MD5/SHA1 cases, kept only SHA256/SHA512TestGetFile_archiveChecksum- Updated to SHA256 checksumTestGetFile_checksumURL- Updated to SHA256 hashTestGetFile_checksumSkip- Updated to SHA256 hashUpdated decompressor tests with SHA256 hashes:
decompress_tgz_test.go- Single file hash:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944cdecompress_gzip_test.godecompress_bzip2_test.godecompress_xz_test.godecompress_zstd_test.godecompress_tbz2_test.godecompress_txz_test.godecompress_zip_test.go3. Binary Security Hardening
cmd/go-getter/main.goto HTTPS-only protocol4. Code Quality
opts,defaultProgressBar)fmt,net/url,getter)Tests Performed
Build Tests
go build ./...- ✓ All packages compile successfullygo build ./cmd/go-getter- ✓ Binary compiles without errorsgo vet ./...- ✓ No warnings or issuesUnit Tests
TestGetFile_checksum- ✓ PASS (SHA256/SHA512 checksums verified)TestGetFile_archiveChecksum- ✓ PASS (Archive checksum verification works)TestGetFile_checksum_from_file- ✓ PASS (Remote checksum files work)TestGetFile_checksumURL- ✓ PASS (Checksum parameter parsing works)TestGetFile_checksumSkip- ✓ PASS (Already-verified files skip re-download)TestTarGzipDecompressor- ✓ PASS (TAR.GZ decompression verified)TestTarBzip2Decompressor- ✓ PASSTestGzipDecompressor- ✓ PASSTestXzDecompressor- ✓ PASSTestZstdDecompressor- ✓ PASSTestZipDecompressor- ✓ PASSIntegration Tests
Error Messages for Users
When attempting MD5:
MD5 checksums are no longer supported due to cryptographic weakness.
Please use SHA256 instead. To compute: shasum -a 256
When attempting SHA1:
SHA1 checksums are no longer supported due to cryptographic weakness.
Please use SHA256 instead. To compute: shasum -a 256
Migration Guide for Users
For existing MD5 checksums:
Old (no longer works)
New (works)
SECVUL workflow run
https://github.com/hashicorp/security-scanning/actions/runs/22666272303/job/65698692605
All the md5 and sha1 vulnerabilities are resolved in the above run