GeezerVison is showing github.com — fix: use 0644 permissions for runtime data files in .func/ by Ankitsinghsisodya · Pull Request #3867 · knative/func
Conversation
Problem
.func/built-image and .func/built-hash were written using os.ModePerm
(0777), which sets the execute bit on plain data files and is inconsistent
with the rest of the codebase.
The pkg/config package already writes ~/.func/config.yaml with explicit
0600 permissions and has a dedicated test enforcing this. The runtime data
directory had no such discipline.
Changes
pkg/functions/function.go:577 — BuiltHash file now written with 0644
pkg/functions/function.go:833 — BuiltImage file now written with 0644
client.go:1277 (MkdirAll for the .func/ directory) is intentionally
unchanged — using os.ModePerm with MkdirAll is standard Go practice for
directories; the umask produces the correct 0755 result.
Why 0644 and not 0600
These files contain build metadata (image references, content hashes), not
credentials. They do not need to be private to the owner. 0644 gives the
owner read/write and others read-only, with no execute bits — appropriate for
data files.
Testing
make test passes with no changes to existing tests
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Changed file permission mode from os.ModePerm to 0644 for files written in the Stamp and WriteRuntimeBuiltImage functions to ensure proper access control.
|
Hi @Ankitsinghsisodya. Thanks for your PR.
I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.
Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Details
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Note Copilot was unable to run its full agentic suite in this review.
This PR tightens the permissions used when writing function build metadata files, avoiding overly permissive file modes.
Changes:
- Change
os.WriteFile permissions from os.ModePerm (0777) to 0644 when writing the built hash.
- Change
os.WriteFile permissions from os.ModePerm (0777) to 0644 when writing the built image reference.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
// Write out the hash
|
|
|
if err = os.WriteFile(filepath.Join(f.Root, RunDataDir, BuiltHash), []byte(hash), os.ModePerm); err != nil {
|
|
|
if err = os.WriteFile(filepath.Join(f.Root, RunDataDir, BuiltHash), []byte(hash), 0644); err != nil {
|
|
|
}
|
|
|
|
|
|
return os.WriteFile(path, []byte(f.Build.Image), os.ModePerm)
|
|
|
return os.WriteFile(path, []byte(f.Build.Image), 0644)
|
codecov
Bot
commented
May 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.39%. Comparing base (5b32fef) to head (f1e0bc4).
⚠️ Report is 16 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3867 +/- ##
==========================================
- Coverage 53.40% 53.39% -0.02%
==========================================
Files 200 200
Lines 23413 23413
==========================================
- Hits 12504 12501 -3
- Misses 9659 9661 +2
- Partials 1250 1251 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Harness.
📢 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.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Ankitsinghsisodya, matejvasek
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Details
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
dsimansk
Awaiting requested review from dsimansk
Uh oh!
There was an error while loading. Please reload this page.
Labels
approved
🤖 PR has been approved by an approver from all required OWNERS files.
lgtm
🤖 PR is ready to be merged.
ok-to-test
🤖 Non-member PR verified by an org member that is safe to test.
size/XS
🤖 PR changes 0-9 lines, ignoring generated files.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|