Defense-in-depth predicate matching the server-side `validate_aws_bedrock_model_id` contract — see that function for the authoritative reasoning. Returns `true` when `value` is safe to interpolate into a Bedrock URL path segment. The router uses this before constructing an upstream path so a stale or out-of-band route store cannot bypass the resolver's validation.
(value: &str)
| 924 | /// before constructing an upstream path so a stale or out-of-band route |
| 925 | /// store cannot bypass the resolver's validation. |
| 926 | fn is_valid_bedrock_model_id(value: &str) -> bool { |
| 927 | if value.is_empty() || value != value.trim() { |
| 928 | return false; |
| 929 | } |
| 930 | if value.contains('/') || value.contains('\\') { |
| 931 | return false; |
| 932 | } |
| 933 | if value.chars().any(|c| matches!(c, '?' | '#' | '%')) { |
| 934 | return false; |
| 935 | } |
| 936 | if value.contains("..") { |
| 937 | return false; |
| 938 | } |
| 939 | if value.chars().any(|c| c.is_control() || c.is_whitespace()) { |
| 940 | return false; |
| 941 | } |
| 942 | true |
| 943 | } |
| 944 | |
| 945 | /// Check whether a route targets a Vertex AI Anthropic rawPredict endpoint. |
| 946 | /// |
no test coverage detected