chore: restore clippy quality gate
This commit is contained in:
parent
e92d01acb8
commit
cad4bc0e74
4 changed files with 71 additions and 72 deletions
|
|
@ -258,46 +258,46 @@ fn explain_from_ops_and_view(
|
|||
let evaluated_ops = ops.len();
|
||||
if let Some(secret) = subject.as_str().strip_prefix("bearer:") {
|
||||
let secret = SecretId::new(secret.to_owned());
|
||||
if let Some(access) = view.bearer_access.get(&secret) {
|
||||
if access.resource == resource {
|
||||
if let Some(granted_capability) = access
|
||||
.capabilities
|
||||
.iter()
|
||||
.find(|granted| capability_allows(granted, &capability))
|
||||
{
|
||||
return AuthExplanation {
|
||||
subject: subject.to_string(),
|
||||
resource: resource.to_string(),
|
||||
capability: capability.to_string(),
|
||||
allowed: true,
|
||||
reason: format!(
|
||||
"active bearer access {} allows resource-scoped capability via {} without granting node identity",
|
||||
access.secret, granted_capability
|
||||
),
|
||||
evaluated_ops,
|
||||
diagnostics: vec![
|
||||
"subject:bearer-secret".to_owned(),
|
||||
format!("bearer:active:{}", access.secret),
|
||||
format!("capability:matched:{granted_capability}"),
|
||||
],
|
||||
};
|
||||
}
|
||||
if let Some(access) = view.bearer_access.get(&secret)
|
||||
&& access.resource == resource
|
||||
{
|
||||
if let Some(granted_capability) = access
|
||||
.capabilities
|
||||
.iter()
|
||||
.find(|granted| capability_allows(granted, &capability))
|
||||
{
|
||||
return AuthExplanation {
|
||||
subject: subject.to_string(),
|
||||
resource: resource.to_string(),
|
||||
capability: capability.to_string(),
|
||||
allowed: false,
|
||||
reason:
|
||||
"active bearer access exists for this resource but lacks the requested capability"
|
||||
.to_owned(),
|
||||
allowed: true,
|
||||
reason: format!(
|
||||
"active bearer access {} allows resource-scoped capability via {} without granting node identity",
|
||||
access.secret, granted_capability
|
||||
),
|
||||
evaluated_ops,
|
||||
diagnostics: vec![
|
||||
"subject:bearer-secret".to_owned(),
|
||||
format!("bearer:active:{secret}"),
|
||||
"capability:missing".to_owned(),
|
||||
format!("bearer:active:{}", access.secret),
|
||||
format!("capability:matched:{granted_capability}"),
|
||||
],
|
||||
};
|
||||
}
|
||||
return AuthExplanation {
|
||||
subject: subject.to_string(),
|
||||
resource: resource.to_string(),
|
||||
capability: capability.to_string(),
|
||||
allowed: false,
|
||||
reason:
|
||||
"active bearer access exists for this resource but lacks the requested capability"
|
||||
.to_owned(),
|
||||
evaluated_ops,
|
||||
diagnostics: vec![
|
||||
"subject:bearer-secret".to_owned(),
|
||||
format!("bearer:active:{secret}"),
|
||||
"capability:missing".to_owned(),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if ops.iter().any(|op| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue