ingest-router: Verify incoming project configs requests#138
Conversation
The handler trait how has requires_relay_auth. When set to true the Relay verifier will verify the incoming request against it's statically configured relay keys before it is forwarded upstream. Relay keys is now a required property of ingest-router configuration. Signatures that can't be matched against this list return 401.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4db31aa. Configure here.
| #[serde(default)] | ||
| pub relay_timeouts: RelayTimeouts, | ||
| /// Trusted downstream relay public keys, keyed by relay id | ||
| pub relay_keys: HashMap<String, RelayInfo>, |
There was a problem hiding this comment.
Bug: The new relay_keys config field is missing #[serde(default)], which will cause service startup to fail with existing configurations that don't have this field.
Severity: CRITICAL
Suggested Fix
Add the #[serde(default)] attribute to the relay_keys field in config.rs. This will make the field optional during deserialization, allowing the service to start with older configuration files.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: ingest-router/src/config.rs#L192
Potential issue: The `relay_keys` field in the configuration struct is missing the
`#[serde(default)]` attribute. This makes the field mandatory during deserialization.
Consequently, deploying the service with an existing configuration file that lacks this
new field will cause a deserialization error, leading to a service startup failure. This
breaks backward compatibility for existing deployments.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
there aren't any existing deployments we need to maintain compatibility with
| #[serde(default)] | ||
| pub relay_timeouts: RelayTimeouts, | ||
| /// Trusted downstream relay public keys, keyed by relay id | ||
| pub relay_keys: HashMap<String, RelayInfo>, |
There was a problem hiding this comment.
Bug: The relay_keys field in the config struct is a HashMap without #[serde(default)]. Deserialization will fail if the YAML key is present but has a null value.
Severity: CRITICAL
Suggested Fix
Add the #[serde(default)] attribute to the relay_keys field in the Config struct. This will instruct serde to create a default, empty HashMap when the key is missing or its value is null, preventing the deserialization from failing.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: ingest-router/src/config.rs#L192
Potential issue: The `relay_keys` field in the `Config` struct is a `HashMap` but lacks
the `#[serde(default)]` attribute. When `serde_yaml` attempts to deserialize a
configuration where the `relay_keys` key is present but has no value (e.g., it's null or
all sub-keys are commented out), the deserialization will fail with an "invalid type:
unit value, expected a map" error. This will cause a panic at service startup. This
scenario is present in both the unit test `test_parse_valid_config` and the
`example_config_ingest_router.yaml`, making startup failure highly likely for users
following the example.
Also affects:
example_config_ingest_router.yaml:10~10ingest-router/src/config.rs:355~355

The handler trait now defines a
requires_relay_authfunction.When set to true by a specific handler (like project configs) - the Relay verifier will verify the incoming request against it's statically configured relay keys, before it is forwarded upstream.
relay_keysis now a required property of the ingest-router configuration. Signatures that can't be matched against this list return 401.