Skip to content

moved the compute file hash function to utils#46

Merged
alsanmsft merged 3 commits into
mainfrom
dev/anasanc/move-hash-to-utils
Apr 10, 2026
Merged

moved the compute file hash function to utils#46
alsanmsft merged 3 commits into
mainfrom
dev/anasanc/move-hash-to-utils

Conversation

@alsanmsft

Copy link
Copy Markdown
Contributor

small change: moving the Computefilehash() function (and other similar functions) used in extensionpolicysettings to utils before dependencies grow.

Comment thread pkg/extensionpolicysettings/extensionpolicysettings.go Outdated
Comment thread pkg/utils/utils.go
Comment thread pkg/extensionpolicysettings/extensionpolicysettings.go Outdated
@alsanmsft alsanmsft merged commit 91b4725 into main Apr 10, 2026
3 checks passed
@alsanmsft alsanmsft deleted the dev/anasanc/move-hash-to-utils branch April 10, 2026 17:16
value, err := ComputeFileHash(value, hashOpt)
if hashOpt == hashutils.HashTypeNone {
// If no hashing is needed, we can directly validate the file content against the allowlist.
content, err := os.ReadFile(filePath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Streaming via io.Copy instead of os.ReadFile into memory is probably good for large files.

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.

3 participants