Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement RBAC layer for runtimeconfig package #154

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

Open
Emyrk opened this issue Sep 6, 2024 · 2 comments
Open

Implement RBAC layer for runtimeconfig package #154

Emyrk opened this issue Sep 6, 2024 · 2 comments

Comments

@Emyrk
Copy link
Member

Emyrk commented Sep 6, 2024

Related to coder/coder#14586

If a cache layer is introduced, then dbauthz would be skipped for cache hits. Since the dbauthz is a general settings update, the dbauthz layer cannot sufficiently distinguish the rbac properties of a setting by it's key string alone.

RBAC needs to be woven into runtimeconfig.

One idea is to add some rbac element to Initialize and New so that each field knows it's own RBAC properties.

@spikecurtis
Copy link

What do you think about inserting the cache between dbauthz and the real database? We pass db.Store around a lot, and I don't want people to call the low-level config queries and bypass the authorization.

@Emyrk
Copy link
Member Author

Emyrk commented Sep 9, 2024

@spikecurtis I looked into that awhile back when doing the dbauthz layer. The downside is the interface for db store is massive. So in this case, I'd have to stub out 349 of the 352 functions, since the cache only cares about the functions related to runtime config settings.

The other issue is the runtime config is using a single query to interact with all config settings. Just GetRuntimeConfig(ctx context.Context, key string) (string, error). The dbauthz (at least today), does not know what the setting is, aside from the key.

This is instead of making a different set of CRUD queries for each settings. So the RBAC needs to be defined by the caller somehow. Or dbauthz needs to inspect the key and determine the rbac requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants