Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/services/namespace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ edition.workspace = true
anyhow.workspace = true
gas.workspace = true
internal.workspace = true
reqwest.workspace = true
rivet-api-builder.workspace = true
rivet-api-util.workspace = true
rivet-api-types.workspace = true
rivet-api-util.workspace = true
rivet-data.workspace = true
rivet-error.workspace = true
rivet-types.workspace = true
Expand Down
30 changes: 30 additions & 0 deletions packages/services/namespace/src/ops/runner_config/upsert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub async fn namespace_runner_config_upsert(ctx: &OperationCtx, input: &Input) -
match &input.config {
RunnerConfig::Serverless {
url,
headers,
slots_per_runner,
..
} => {
Expand All @@ -51,6 +52,35 @@ pub async fn namespace_runner_config_upsert(ctx: &OperationCtx, input: &Input) -
}));
}

if headers.len() > 16 {
return Ok(Err(errors::RunnerConfig::Invalid {
reason: "too many headers (max 16)".to_string(),
}));
}

for (n, v) in headers {
if n.len() > 128 {
return Ok(Err(errors::RunnerConfig::Invalid {
reason: format!("invalid header name: too long (max 128)"),
}));
}
if let Err(err) = n.parse::<reqwest::header::HeaderName>() {
return Ok(Err(errors::RunnerConfig::Invalid {
reason: format!("invalid header name: {err}"),
}));
}
if v.len() > 4096 {
return Ok(Err(errors::RunnerConfig::Invalid {
reason: format!("invalid header value: too long (max 4096)"),
}));
}
if let Err(err) = v.parse::<reqwest::header::HeaderValue>() {
return Ok(Err(errors::RunnerConfig::Invalid {
reason: format!("invalid header value: {err}"),
}));
}
}

// Validate slots per runner
if *slots_per_runner == 0 {
return Ok(Err(errors::RunnerConfig::Invalid {
Expand Down
Loading