fix: harden workflow config rpc target routing

This commit is contained in:
lda
2026-06-03 09:49:56 +07:00 Verified
parent 8a1d627f06
commit 9389dd6df6
14 changed files with 379 additions and 47 deletions
+9 -2
View File
@@ -18,9 +18,16 @@ class LocalTargetConfig(WorkflowConfigModel):
class RpcHttpTargetConfig(WorkflowConfigModel):
kind: Literal["rpc_http"]
url: str
url: str = Field(min_length=1)
timeout_seconds: float = Field(default=30.0, gt=0)
@field_validator("url")
@classmethod
def validate_url(cls, value: str) -> str:
if not value.startswith(("http://", "https://")):
raise ValueError("rpc_http target url must start with http:// or https://")
return value
TargetConfig = Annotated[
LocalTargetConfig | RpcHttpTargetConfig,
@@ -65,7 +72,7 @@ ServerTransportConfig = Annotated[
class StdlibSourceConfig(WorkflowConfigModel):
kind: Literal["stdlib"]
id: str = Field(min_length=1)
id: Literal["wf.std", "wf.recipes"]
SourceConfig = Annotated[