Skip to content

fix: use secure file permissions for config files#3726

Merged
knative-prow[bot] merged 1 commit into
knative:mainfrom
Itx-Psycho0:fix/config-file-permissions
May 15, 2026
Merged

fix: use secure file permissions for config files#3726
knative-prow[bot] merged 1 commit into
knative:mainfrom
Itx-Psycho0:fix/config-file-permissions

Conversation

@Itx-Psycho0
Copy link
Copy Markdown
Contributor

Summary

Fixes config file permissions from 0777 to 0600 for security.

Changes

  • Config files now use 0600 (owner read/write only)
  • Config directories use 0755 (standard directory permissions)
  • Added tests to verify correct permissions

Security Impact

  • Prevents unauthorized users from reading sensitive config data
  • Prevents unauthorized modification of configuration
  • Follows industry standard (kubectl, docker, git use 0600)

Testing

  • Added TestWrite_FilePermissions and TestCreatePaths_DirectoryPermissions
  • All existing tests pass
  • make check passes

Fixes #3725

Change config file permissions from 0777 to 0600 and directory
permissions from 0777 to 0755 to follow security best practices.

Changes:
- Config files now use 0600 (owner read/write only)
- Config directories use 0755 (owner rwx, group/others rx)
- Added tests to verify correct permissions are applied

Security impact:
- Prevents unauthorized users from reading sensitive config data
- Prevents unauthorized modification of configuration
- Follows industry standard (kubectl, docker, git use 0600)

Fixes: Config files were world-readable and world-writable
@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 14, 2026 10:24
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 14, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 14, 2026

Hi @Itx-Psycho0. 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.

Regular contributors should join the org to skip this step.

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.

@matejvasek matejvasek requested review from gauron99 and lkingland May 14, 2026 10:31
@matejvasek
Copy link
Copy Markdown
Contributor

PTAL @lkingland

@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.96%. Comparing base (0209813) to head (5aa2383).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3726      +/-   ##
==========================================
+ Coverage   56.90%   56.96%   +0.06%     
==========================================
  Files         181      181              
  Lines       20933    21116     +183     
==========================================
+ Hits        11912    12029     +117     
- Misses       7811     7863      +52     
- Partials     1210     1224      +14     
Flag Coverage Δ
e2e 35.80% <0.00%> (-0.36%) ⬇️
e2e go 32.42% <0.00%> (-0.33%) ⬇️
e2e node 28.20% <0.00%> (-0.29%) ⬇️
e2e python 32.78% <0.00%> (-0.34%) ⬇️
e2e quarkus 28.34% <0.00%> (-0.29%) ⬇️
e2e rust 27.75% <0.00%> (-0.27%) ⬇️
e2e springboot 26.26% <0.00%> (-0.25%) ⬇️
e2e typescript 28.31% <0.00%> (-0.30%) ⬇️
e2e-config-ci 17.70% <0.00%> (-0.18%) ⬇️
integration 17.29% <0.00%> (-0.15%) ⬇️
unit macos-14 45.05% <100.00%> (+0.05%) ⬆️
unit macos-latest 45.05% <100.00%> (+0.05%) ⬆️
unit ubuntu-24.04-arm 45.32% <100.00%> (+0.15%) ⬆️
unit ubuntu-latest 46.00% <100.00%> (+0.16%) ⬆️
unit windows-latest 45.09% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@gauron99
Copy link
Copy Markdown
Contributor

FYI I found https://specifications.freedesktop.org/basedir/latest/ which states

If, when attempting to write a file, the destination directory is non-existent an attempt should be made to create it with permission 0700. If the destination directory exists already the permissions should not be changed.

so maybe we could go even more strict 😄
cc @matejvasek

@matejvasek
Copy link
Copy Markdown
Contributor

/approve
/lgtm

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label May 15, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Itx-Psycho0, 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

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label May 15, 2026
@knative-prow knative-prow Bot merged commit c0d60c2 into knative:main May 15, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. lgtm 🤖 PR is ready to be merged. needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Config file written with overly permissive 0777 permissions

3 participants