Skip to content

feat(golang): detect native Go FIPS 140 mode in binaries - #5155

Merged
wagoodman merged 1 commit into
anchore:mainfrom
gunnypatel:golang-native-fips140
Aug 7, 2026
Merged

feat(golang): detect native Go FIPS 140 mode in binaries#5155
wagoodman merged 1 commit into
anchore:mainfrom
gunnypatel:golang-native-fips140

Conversation

@gunnypatel

@gunnypatel gunnypatel commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

Go 1.24 introduced a native FIPS 140-3 mode, selected at build time via the GOFIPS140 build flag and at run time via the fips140 GODEBUG setting. Both are recorded in the binary's build info (GOFIPS140 and the fips140= entry within DefaultGODEBUG).

Syft's existing Go crypto detection only recognized the older BoringCrypto / crypto/tls/fipsonly markers, so binaries built with the new native FIPS mode were reported with no FIPS-related crypto settings at all.

This adds a getNativeFIPSSettings helper that reads those two build settings and appends them to the existing goCryptoSettings metadata field, e.g.:

goCryptoSettings:
  - GOFIPS140=v1.0.0
  - GODEBUG=fips140=on

No new metadata field or JSON schema version is needed — the values populate the existing goCryptoSettings list.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Signed-off-by: Gunny Patel <zip159@gmail.com>
@wagoodman
wagoodman enabled auto-merge (squash) August 7, 2026 14:17
@wagoodman
wagoodman merged commit 07fb234 into anchore:main Aug 7, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants