Skip to content

Use crypto/sha256 instead of crypto/md5 for FIPS compliance. - #1056

Merged
jeevatkm merged 3 commits into
go-resty:v3from
BillBuilt:fips-compliance
Nov 18, 2025
Merged

Use crypto/sha256 instead of crypto/md5 for FIPS compliance.#1056
jeevatkm merged 3 commits into
go-resty:v3from
BillBuilt:fips-compliance

Conversation

@BillBuilt

Copy link
Copy Markdown
Contributor

Use crypto/sha256 instead of crypto/md5 for FIPS compliance.

Update deps

@smithcoin

Copy link
Copy Markdown

Not only for fips, many linters now suggest avoiding md5 for any reason.

@moorereason

Copy link
Copy Markdown
Contributor

The comment in line 374 should be updated to not reference md5.

What are the implications of this change? From what I can see, the machine ID is only used here:

resty/util.go

Line 375 in 66256ef

b[4], b[5], b[6] = machineID[0], machineID[1], machineID[2]

Which is only called from here:

resty/request.go

Line 1385 in 66256ef

r.RetryTraceID = newGUID()

@BillBuilt

BillBuilt commented Sep 29, 2025

Copy link
Copy Markdown
Contributor Author

When running go code using GOFIPS140=v1.0.0 GODEBUG=fips140=only, if any package is not compliant (MD5), it will fail to build regardless of how it is used.

https://go.dev/doc/security/fips140

I will update the comment. Thanks!

@BillBuilt BillBuilt mentioned this pull request Sep 29, 2025
@jeevatkm jeevatkm added enhancement v3 For resty v3 labels Nov 8, 2025
@jeevatkm jeevatkm added this to the v3.0.0 Milestone milestone Nov 8, 2025
@codecov

codecov Bot commented Nov 8, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.85%. Comparing base (66256ef) to head (ba9898e).
⚠️ Report is 7 commits behind head on v3.

Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #1056      +/-   ##
==========================================
+ Coverage   99.82%   99.85%   +0.03%     
==========================================
  Files          18       18              
  Lines        3919     3371     -548     
==========================================
- Hits         3912     3366     -546     
+ Misses          5        3       -2     
  Partials        2        2              
Flag Coverage Δ
unittests 99.85% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeevatkm jeevatkm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillBuilt Thanks for the PR. I'm sorry for the delayed response, I was occupied with my personal stuff.

Can you please revert the go.{mod, sum} file changes?

@BillBuilt

Copy link
Copy Markdown
Contributor Author

@BillBuilt Thanks for the PR. I'm sorry for the delayed response, I was occupied with my personal stuff.

Can you please revert the go.{mod, sum} file changes?

No worries. I reverted the version changes. I did get this warning so maybe consider updating any dependencies when you get a chance.

Warning:(5, 9) Dependency go:golang.org/x/net:v0.33.0 is vulnerable CVE-2025-22870 4.4

Thanks again!

@jeevatkm jeevatkm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillBuilt Thanks for updating the PR.

@jeevatkm

Copy link
Copy Markdown
Member

@BillBuilt Sure, I usually update the go.mod during the release.

@jeevatkm
jeevatkm merged commit 4209efb into go-resty:v3 Nov 18, 2025
4 checks passed
jeevatkm added a commit that referenced this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants