Skip to content

Commit

Permalink
agent: add back rego error logs
Browse files Browse the repository at this point in the history
take_prints takes and clear prints per https://github.com/microsoft/regorus/blob/748c11cfa1319c808977194c1657e0fd866269be/src/engine.rs#L848
Don't call take_prints in the same code path such that they get cleared and not returned from allow_request as expected.
  • Loading branch information
Redent0r committed Jan 14, 2025
1 parent a96690c commit 68c4ca8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/agent/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,13 @@ impl AgentPolicy {

let results = self.engine.eval_query(query, false)?;

let prints = match self.engine.take_prints() {
Ok(p) => p.join(" "),
Err(e) => format!("Failed to get policy log: {e}"),
};

if results.result.len() != 1 {
// Results are empty when AllowRequestsFailingPolicy is used to allow a Request that hasn't been defined in the policy
if self.allow_failures {
let prints = match self.engine.take_prints() {
Ok(p) => p.join(" "),
Err(e) => format!("Failed to get policy log: {e}"),
};
return Ok((true, prints));
}
bail!(
Expand Down

0 comments on commit 68c4ca8

Please sign in to comment.