Skip to content

Make instance CPU metrics accessible to non-fleet users #6155

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

Closed
david-crespo opened this issue Jul 25, 2024 · 2 comments · Fixed by #6873
Closed

Make instance CPU metrics accessible to non-fleet users #6155

david-crespo opened this issue Jul 25, 2024 · 2 comments · Fixed by #6873
Assignees
Milestone

Comments

@david-crespo
Copy link
Contributor

Because of #5298, oxql queries to the main endpoint require fleet viewer permissions. But we want to be able to do things like show instance CPU metrics to people with view perms on the instance (technically, the instance's project). Short of the fully general authz solution, the easiest way to hack in access is to make a one-off endpoint for this analogous to the ones we already (reluctantly) have for disk metrics and silo metrics, where we call the timeseries_query function but do a different authz check.

Currently that function includes the fleet viewer check, so we'd probably have to move that up a level.

/// Run an OxQL query against the timeseries database.
pub(crate) async fn timeseries_query(
&self,
opctx: &OpContext,
query: impl AsRef<str>,
) -> Result<Vec<oxql::Table>, Error> {
// Must be a fleet user to list timeseries schema.
//
// TODO-security: We need to figure out how to implement proper security
// checks here, letting less-privileged users fetch data for the
// resources they have access to.
opctx.authorize(authz::Action::Read, &authz::FLEET).await?;

@david-crespo david-crespo added this to the 10 milestone Jul 25, 2024
@bnaecker
Copy link
Collaborator

I wrote up some notes here which might impact this work a bit.

@morlandi7 morlandi7 modified the milestones: 10, 11 Aug 26, 2024
@morlandi7 morlandi7 modified the milestones: 11, 12 Oct 11, 2024
@morlandi7 morlandi7 modified the milestones: 12, 13 Jan 21, 2025
@david-crespo david-crespo linked a pull request Jan 27, 2025 that will close this issue
2 tasks
@david-crespo david-crespo self-assigned this Jan 27, 2025
@david-crespo
Copy link
Contributor Author

Closed by #6873. Console side in progress in oxidecomputer/console#2654.

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 a pull request may close this issue.

3 participants