Allow colons in model IDs (versioned IDs and inference profiles)#4
Conversation
Bedrock model IDs can carry a version suffix (e.g. anthropic.claude-3-5-sonnet-20241022-v2:0), which the model/subagent_model validation regexes rejected. Relax both to accept ':' and note in the input description that inference profile IDs work too. Upstreamed from the vendored copy in sirob-tech/.github. The zai.glm-5 default stays unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| # that reaches prompts or CLI flags to prevent injection. | ||
| raw_model = str(cfg.get("model") or model) | ||
| if re.fullmatch(r"[A-Za-z0-9._-]+", raw_model): | ||
| if re.fullmatch(r"[A-Za-z0-9._:-]+", raw_model): |
There was a problem hiding this comment.
The regex does not allow forward slashes, which are required for application inference profile ARNs (e.g., arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/my-profile). This could prevent callers from using application inference profiles even though the description mentions 'inference profile ID'. Consider if / should be added to the allowed character set, or clarify in the description which inference profile formats are supported.
There was a problem hiding this comment.
Addressed in 52b942c by clarifying the description instead of widening the charset: the input now states that cross-region inference profile IDs (e.g. us.anthropic.claude-opus-4-8) are supported and ARN-style application inference profiles are not. Keeping / out of the sanitizer preserves the tight injection surface, and OpenCode's amazon-bedrock provider hasn't been verified to accept ARNs as model refs.
AI Code Review Summary
Additional observations
This summary was automatically generated by the AI code review workflow. |
Scope the description to cross-region inference profile IDs; ARN-style application inference profiles stay outside the sanitizer's charset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
model/subagent_modelvalidation regexes from[A-Za-z0-9._-]+to[A-Za-z0-9._:-]+in both spots (repo-config sanitizer and subagent-model check) — Bedrock model IDs can carry a version suffix likeanthropic.claude-3-5-sonnet-20241022-v2:0, which the old regex rejectedmodelinput description to say "Bedrock model or inference profile ID"Upstreamed from the vendored copy in
sirob-tech/.github(diverged when it was pointed at Opus). Thezai.glm-5default is intentionally unchanged; the org-specific caller wiring there was not brought back.🤖 Generated with Claude Code