feat(security): harden client IP and admin controls

This commit is contained in:
elky
2026-07-10 15:13:12 +08:00
parent 6e0dc3b59e
commit bc1da3bf3f
19 changed files with 976 additions and 378 deletions
+18 -1
View File
@@ -355,7 +355,8 @@ fn openai_reasoning_effort_value(suffix: &str) -> Option<&'static str> {
"low" => Some("low"),
"medium" => Some("medium"),
"high" => Some("high"),
"xhigh" | "max" => Some("xhigh"),
"xhigh" => Some("xhigh"),
"max" => Some("max"),
_ => None,
}
}
@@ -457,6 +458,22 @@ mod tests {
);
}
#[test]
fn default_max_suffix_is_preserved_for_openai_formats() {
assert_eq!(
default_reasoning_mapping("openai:chat", "max"),
Some(json!({ "reasoning_effort": "max" }))
);
assert_eq!(
default_reasoning_mapping("openai:responses", "max"),
Some(json!({ "reasoning": { "effort": "max" } }))
);
assert_eq!(
default_reasoning_mapping("openai:responses:compact", "max"),
Some(json!({ "reasoning": { "effort": "max" } }))
);
}
#[test]
fn combined_suffixes_are_order_insensitive() {
let expected = Some(vec!["xhigh".to_string(), "fast".to_string()]);