Skip to content

CFE-3725: fix double change detection with hash=>"best"#6241

Open
nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:CFE-3725/master
Open

CFE-3725: fix double change detection with hash=>"best"#6241
nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:CFE-3725/master

Conversation

@nickanderson

@nickanderson nickanderson commented Jul 21, 2026

Copy link
Copy Markdown
Member

hash => "best" in a changes body now uses SHA-512.

In community builds, best hashed files with both MD5 and SHA1. A bug in how the two were checked meant that after a file changed, only one of the two stored hashes was updated. The stale one then reported the same change again on the next run, so a single change showed up as "changed" on two runs in a row.

Instead of fixing the two-hash bookkeeping, best now uses one strong hash, SHA-512. That is what CFEngine Enterprise has always used for best.

On community, the first agent run after upgrading re-records best-tracked files under SHA-512 and file changes would be realized.

Documentation stats that best cross correlates the two best options available. That doesn't seem to have ever been true for Enterprise. Since community could explicitly already select sha512 I thought it made the most sense to align on Enterpise behavior rather than add additional hashing to enterprise best.

@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

In community builds hash => "best" hashed files with both MD5 and SHA1,
combining them with a short-circuiting || that skipped updating the second
hash once the first reported a change. The stale hash then re-reported the
same change on the next run, so one change was detected on two consecutive
runs.

Resolve "best" to a single SHA-512 instead (matching enterprise, stronger
than the MD5+SHA1 pair, and FIPS-friendly) and drop the dual-hash branch.
Community files tracked with "best" are re-baselined under SHA-512 on the
first run after upgrade. Adds an acceptance test.

Changelog: Community 'files' promises using hash => "best" now use SHA-512 (previously MD5+SHA1) and no longer report a content change on two consecutive agent runs. Affected files are re-baselined on the first run after upgrade.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense to me 🚀

@nickanderson
nickanderson requested a review from olehermanse July 22, 2026 13:58
@nickanderson

Copy link
Copy Markdown
Member Author

@olehermanse do you agree with this. I was on the fence between making Enterprise do 2 hashes vs changing best to pick the singular best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants