set_status: reject multi-line and over-200-char text (#720)
This commit is contained in:
parent
26d8565365
commit
6c2cd078f1
4 changed files with 121 additions and 1 deletions
|
|
@ -502,6 +502,12 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
}
|
||||
}
|
||||
ManagerRequest::SetStatus { text } => {
|
||||
// #720: cap length + reject multi-line so a confused caller
|
||||
// can't dump a multi-paragraph session report into the
|
||||
// dashboard chip.
|
||||
if let Err(message) = crate::limits::check_status_text(text) {
|
||||
return ManagerResponse::Err { message };
|
||||
}
|
||||
let path = Coordinator::agent_notes_dir(MANAGER_AGENT).join("hyperhive-status");
|
||||
let result = if text.trim().is_empty() {
|
||||
std::fs::remove_file(&path).or_else(|e| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue