Skip to content

make the module-integrity self-test honest#63

Merged
pzverkov merged 1 commit into
mainfrom
harden/module-integrity-honesty
Jun 1, 2026
Merged

make the module-integrity self-test honest#63
pzverkov merged 1 commit into
mainfrom
harden/module-integrity-honesty

Conversation

@pzverkov

@pzverkov pzverkov commented Jun 1, 2026

Copy link
Copy Markdown
Member

What

crypto.CheckModuleIntegrity returned Verified: true unconditionally (// Simplified - always passes) against a placeholder expected hash - it claimed a self-test it never performed. Nothing calls it in production, but docs/FIPS.md:228 documents it as a FIPS feature, so the claim leaks into the FIPS story.

Change

  • Pin the real SHA-256 of the embedded KAT vectors (0aa6a0d6...c1ad1868) and set Verified = (actualHash == expectedHash) - the comparison now earns the true value.
  • Scope it honestly in the struct doc, the function doc, and docs/FIPS.md: it confirms the KAT vectors were not altered in the binary, NOT the .text section. The notes flag a real binary/.text HMAC (failing hard in FIPS mode) as future work.
  • TestCheckModuleIntegrity now asserts the comparison passes, so a future KAT-vector or pinned-hash drift fails loudly.

Verification

  • go test ./pkg/crypto/... and go test -tags fips ./pkg/crypto/... pass; full suite green. No production caller, so no live path changes behavior.

CheckModuleIntegrity hardcoded Verified: true with a "Simplified - always passes" comment and a placeholder expected hash, so it claimed a self-test it never ran. It is not called in production, but docs/FIPS.md presents it as a feature, which overclaims in FIPS mode.

Pin the real SHA-256 of the embedded KAT vectors and set Verified to the actual comparison, so the comparison earns the true value. Scope it precisely in the type, the function, and FIPS.md: it checks that the KAT vectors were not altered in the binary, NOT the .text section. A real binary/.text HMAC that fails hard in FIPS mode stays future work. The test now asserts the comparison passes, so a future KAT or pinned-hash drift fails loudly. Verified across the default and -tags fips builds.
@pzverkov pzverkov self-assigned this Jun 1, 2026
@pzverkov pzverkov merged commit c3a77f6 into main Jun 1, 2026
13 checks passed
@pzverkov pzverkov deleted the harden/module-integrity-honesty branch June 1, 2026 19:01
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.

1 participant