Enforce trusted-agent policy conditions (#72)

This commit is contained in:
lazyGPT07 2026-06-13 23:44:00 -06:00 committed by GitHub
parent 8f4691584c
commit 7d6a033b41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 2 deletions

View file

@ -70,8 +70,10 @@ export function evaluateAccountPolicy(input: LogicSrcPolicyEvaluationInput): Log
if (policy?.default === "approval_required") {
return { decision: "approval_required", riskScore, reason: `policy ${policy.id} requires approval` };
}
if (policy?.default === "allow_if_trusted_agent" && input.principal?.trusted) {
return { decision: "allow", riskScore, reason: `policy ${policy.id} allows trusted principal` };
if (policy?.default === "allow_if_trusted_agent") {
return input.principal?.trusted
? { decision: "allow", riskScore, reason: `policy ${policy.id} allows trusted principal` }
: { decision: "approval_required", riskScore, reason: `policy ${policy.id} requires a trusted principal` };
}
if (policy?.default === "allow_if_below_risk_score") {
const maxRiskScore = typeof policy.conditions?.maxRiskScore === "number" ? policy.conditions.maxRiskScore : 0.25;