[team] Review fixes: a deployment ticket and a MAC on target.request, an unknown author is unsatisfiable under others, a signed request cannot be refused afterwards; TEAM.md limits; v0.18.1
This commit is contained in:
@@ -244,8 +244,13 @@ pub fn evaluate(policy: &Policy, roster: &[RosterMember], env: &str, author: &st
|
||||
ignored.push(a.clone());
|
||||
}
|
||||
}
|
||||
// `others` needs to know who the author is (core 0.18.1): an empty author, or one no member is, would let the
|
||||
// author approve their own release under a name the rule cannot see.
|
||||
let unknown_author = rule.others && roster.len() >= 2 && !roster.iter().any(|m| m.is(author));
|
||||
let verdict = if rule.approvals == 0 {
|
||||
Verdict::Allowed(KeyRole::Test)
|
||||
} else if unknown_author {
|
||||
Verdict::Unsatisfiable("the release's author is not a member the team knows, so the rule cannot exclude them")
|
||||
} else if counted.len() >= rule.approvals as usize {
|
||||
Verdict::Allowed(KeyRole::Release)
|
||||
} else if eligible.len() < rule.approvals as usize {
|
||||
@@ -278,5 +283,8 @@ pub fn may_approve(
|
||||
if rule.others && roster.len() >= 2 && me.is(author) {
|
||||
return Err(TeamError::NotEligible("the release's author may not approve it here"));
|
||||
}
|
||||
if rule.approvals > 0 && rule.others && roster.len() >= 2 && !roster.iter().any(|m| m.is(author)) {
|
||||
return Err(TeamError::NotEligible("the release's author is not a member the team knows"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user