broker: Set broker.conf.d permissions to 755#1426
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1426 +/- ##
==========================================
- Coverage 87.05% 80.19% -6.87%
==========================================
Files 93 20 -73
Lines 6367 1015 -5352
Branches 111 0 -111
==========================================
- Hits 5543 814 -4729
+ Misses 768 201 -567
+ Partials 56 0 -56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e7293f1 to
646032d
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the OIDC broker’s configuration drop-in directory (broker.conf.d) is permissioned so non-root users can list it (improving discoverability and shell tab-completion) while still requiring config files to be non-world-readable.
Changes:
- Add a snap
post-refreshmigration to chmodbroker.conf.dto0755and enforce0600on files within it. - Change the daemon to create/require
broker.conf.dwith0755instead of0700. - Add runtime permission checks to ensure
broker.confand drop-in config files are0600.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
snap/hooks/post-refresh |
Adds a migration to make broker.conf.d listable (0755) while forcing config files to 0600. |
authd-oidc-brokers/cmd/authd-oidc/daemon/fs.go |
Introduces a helper to validate config file permissions. |
authd-oidc-brokers/cmd/authd-oidc/daemon/daemon.go |
Creates broker.conf.d with 0755 and checks permissions on config files at startup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9c022a3 to
60945bb
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is a config directory, so admins are expected to read and modify the files in that directory. However, the permissions 700 don't allow non-root users to list the directory contents, so tab-completion doesn't list any files. That has caused confusion on multiple occasions. The config files can contain secrets (e.g. the client_secret setting), so it's important that the files are not world-readable, but that's ensured as long as the permissions of the *files* are 600.
907c250 to
c2c61fd
Compare
Agent-Logs-Url: https://github.com/canonical/authd/sessions/3d4bb673-c349-4f8e-b150-7e14658d1ba2 Co-authored-by: adombeck <18482300+adombeck@users.noreply.github.com>
It's not insecure if directories are world-readable as long as the files actually containing secrets have secure permissions - and it's definitely not insecure if the directories have e.g. permissions 0700 instead of the expected 0755. The broker failing to start, on the other hand, can have pretty bad consequences, because users are not able to log in.
c2c61fd to
068c001
Compare
|
Fixed the linter issue |
This is a config directory, so admins are expected to read and modify the files in that directory. However, the permissions
700don't allow non-root users to list the directory contents, so tab-completion doesn't list any files. That has caused confusion on multiple occasions.The config files can contain secrets (e.g. the
client_secretsetting), so it's important that the files are not world-readable, but that's ensured as long as the permissions of the files are600.UDENG-9634