Recheck the submitting principal and protect stored log output

This commit is contained in:
2026-11-18 10:10:06 +01:00
parent db2f5b407d
commit 0f15f91f65
16 changed files with 788 additions and 209 deletions
+4 -2
View File
@@ -17,9 +17,10 @@ use std::collections::BTreeSet;
use uuid::Uuid;
const PREFIX: &str = "rmm_mcp_";
const SCOPES: [&str; 11] = [
const SCOPES: [&str; 12] = [
"inventory:read",
"logs:read",
"logs:read_sensitive",
"operations:read",
"operations:plan",
"operations:submit",
@@ -371,7 +372,7 @@ async fn authenticate_pool(
name: principal,
operator: effective
.iter()
.any(|scope| !READ_SCOPES.contains(&scope.as_str())),
.any(|scope| !READ_SCOPES.contains(&scope.as_str()) && scope != "logs:read_sensitive"),
session_hash: None,
csrf: None,
scopes: Some(effective),
@@ -427,6 +428,7 @@ async fn enabled(pool: &PgPool, principal: &str, tenant: Uuid) -> bool {
#[cfg(test)]
mod tests {
use super::*;
mod stored_logs;
#[test]
fn mcp_token_selection_is_explicit_and_bounded() {