Skip to content

Commit 087c856

Browse files
authored
wicket: Deny unknown fields when accepting RSS config TOML (#7667)
From discussions on #7653: wicket does not and should not accept a `[recovery_silo]` section in the uploaded TOML, but on main it will silently discard it. This PR turns on `serde(deny_unknown_fields)`; now, attempting to upload a config TOML with an unexpected section will fail: ``` Feb 27 16:44:21.805 INFO reading config from stdin..., file: wicket/src/cli/rack_setup.rs:110 Feb 27 16:44:21.805 INFO parsing config..., file: wicket/src/cli/rack_setup.rs:115 Error: failed to parse config TOML Caused by: TOML parse error at line 93, column 2 | 93 | [recovery_silo] | ^^^^^^^^^^^^^ unknown field `recovery_silo`, expected one of `bootstrap_sleds`, `ntp_servers`, `dns_servers`, `internal_services_ip_pool_ranges`, `external_dns_ips`, `external_dns_zone_name`, `rack_network_config`, `allowed_source_ips` ```
1 parent c21226a commit 087c856

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

openapi/wicketd.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3344,7 +3344,8 @@
33443344
"internal_services_ip_pool_ranges",
33453345
"ntp_servers",
33463346
"rack_network_config"
3347-
]
3347+
],
3348+
"additionalProperties": false
33483349
},
33493350
"RackOperationStatus": {
33503351
"description": "Current status of any rack-level operation being performed by this bootstrap agent.\n\n<details><summary>JSON schema</summary>\n\n```json { \"description\": \"Current status of any rack-level operation being performed by this bootstrap agent.\", \"oneOf\": [ { \"type\": \"object\", \"required\": [ \"id\", \"status\", \"step\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initializing\" ] }, \"step\": { \"$ref\": \"#/components/schemas/RssStep\" } } }, { \"description\": \"`id` will be none if the rack was already initialized on startup.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"id\": { \"oneOf\": [ { \"type\": \"null\" }, { \"allOf\": [ { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" } ] } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_panicked\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"resetting\" ] } } }, { \"description\": \"`reset_id` will be None if the rack is in an uninitialized-on-startup, or Some if it is in an uninitialized state due to a reset operation completing.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"reset_id\": { \"oneOf\": [ { \"type\": \"null\" }, { \"allOf\": [ { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" } ] } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"uninitialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_panicked\" ] } } } ] } ``` </details>",

wicket-common/src/rack_setup.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub struct CurrentRssUserConfigInsensitive {
5858
/// This is the "write" version of [`CurrentRssUserConfigInsensitive`], with
5959
/// some different fields.
6060
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema)]
61+
#[serde(deny_unknown_fields)]
6162
pub struct PutRssUserConfigInsensitive {
6263
/// List of slot numbers only.
6364
///

0 commit comments

Comments
 (0)