Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non-leaders can only view app secrets #1076

Merged
merged 4 commits into from
Nov 23, 2023

Conversation

tonyandrewmeyer
Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer commented Nov 23, 2023

A charm that owns a unit secret always has manage permissions, regardless of which unit is executing the charm. However, an app secret has manage permissions if the charm is executing on the leader, and view permissions otherwise (the matrix in this WIP documentation has been verified by @wallyworld).

This PR adjusts the Harness permission check (used by get-info, set, grant, revoke, remove, etc) so that if the secret is an app secret, then the leader flag must be set for access to be allowed.

Fixes #1071

Copy link
Contributor

@PietroPasotti PietroPasotti left a comment

Choose a reason for hiding this comment

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

couple of readability nits but nothing blocking from my side.
GJ!

test/test_testing.py Outdated Show resolved Hide resolved
ops/testing.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Great, thanks for this fix.

@benhoyt benhoyt merged commit 889c78e into canonical:main Nov 23, 2023
19 checks passed
@tonyandrewmeyer tonyandrewmeyer deleted the secret-permissions-1071 branch November 23, 2023 21:25
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.

[testing] Non-leader unit can set 'app' secret
3 participants