swarm-controller: refuse an inference model name that starts with "-"
`check_model` accepted a value like `--dangerously-skip-permissions`, and the stored model ends up in the agent's `claude` argv. A PUT whose `model`, or any `subagent_models` entry (same validator), starts with `-` is now a 400 with the same problem+json shape as the other model checks. A dash inside a name (`claude-opus-4-8`) is still accepted. Raised by argus on #5084. Refs #5034
This commit is contained in:
parent
19a045a401
commit
47bd83054f
3 changed files with 32 additions and 18 deletions
|
|
@ -5544,17 +5544,16 @@ mod tests {
|
|||
"DELETE {name}"
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
status(
|
||||
put_agent_inference(
|
||||
State(state),
|
||||
Path("iris".to_owned()),
|
||||
body(r#"{"model":"opus 4"}"#)
|
||||
)
|
||||
.await
|
||||
),
|
||||
Some(StatusCode::BAD_REQUEST)
|
||||
);
|
||||
for bad in [r#"{"model":"opus 4"}"#, r#"{"model":"--print"}"#] {
|
||||
assert_eq!(
|
||||
status(
|
||||
put_agent_inference(State(state.clone()), Path("iris".to_owned()), body(bad))
|
||||
.await
|
||||
),
|
||||
Some(StatusCode::BAD_REQUEST),
|
||||
"{bad}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue