security(agent): require explicit read-only classification before automatic SKILL/parallel dispatch
This commit is contained in:
1 parent
f859e6eeea
commit
70b88b3767
1 file changed
+18
@@ -171,6 +171,16 @@ fn next_doc(ckpt: &Value, id: &str, reused: bool) -> Result<Value,String> {
|
||||
"cursor":index,"step":step,"completed":meta["completed"],
|
||||
"partial": meta.get("partial").cloned().unwrap_or(Value::Null)}));
|
||||
}
|
||||
// Never auto-dispatch effectful or unclassified child documents.
|
||||
// Those must be executed using the existing EffectLedger policy and an
|
||||
// independently verified receipt, not an arbitrary model instruction.
|
||||
if (step["kind"]=="skill" || step["kind"]=="parallel")
|
||||
&& step["effect_class"]!="read"
|
||||
{
|
||||
return Ok(json!({"ok":false,"id":id,"status":"manual_review",
|
||||
"cursor":index,"step":step,
|
||||
"reason":"automatic child dispatch requires an explicit read-only effect class"}));
|
||||
}
|
||||
let waiting=match step["kind"].as_str().unwrap_or("") {
|
||||
"model"=>"waiting_model",
|
||||
"input"=>"waiting_input",
|
||||
@@ -434,6 +444,14 @@ mod tests {
|
||||
assert_eq!(open(&a).unwrap()["status"],"succeeded");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_and_write_effects_never_auto_dispatch() {
|
||||
let mut a=fixture();
|
||||
a["steps"]=json!([{"id":"publish","kind":"skill","skill":"office"}]);
|
||||
open(&a).unwrap();
|
||||
assert_eq!(next(&a).unwrap()["status"],"manual_review");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_change_conflict_and_invalid_model_choice() {
|
||||
let a=fixture();
|
||||
|
||||
Reference in new issue
Block a user