Repository navigation
Validate instance hostnames in the Nexus API - #4938
Conversation
|
I'm beefing up the tests here, I think these are not actually testing what I want. |
- Add the `Hostname` type to the external API, which checks that a string conforms to RFC 1035 (and others) describing valid Internet hostnames. Add some tests for that. - Use the new type everywhere in Nexus and its integration tests, though we still serialize to a String in the database and when passing the instance information to the sled-agent. The sled-agent does its own validation internally through OPTE. - Add a few regression tests for creating instances with known-bad hostnames.
4388023 to
8e4e4ad
Compare
|
Ok folks, this is ready for a review. |
smklein
left a comment
There was a problem hiding this comment.
I think the current build failures are real;
end-to-end-tests/src/instance_launch.rs:67
looks like it's using a hostname. Might not be built by default within the workspace?
|
Thanks Sean, nice catch. Fixed. |
- Deserialize hostname from an owned string - Fix hostname in end-to-end-tests
|
Ok, I've run a quick test locally to confirm that this does what I expect. It's a bit nasty, hold your hat. I launched the control plane as usual on my dev machine, using Note that I created the instance but did not start it. Now, I went into the DB and manually dorked with the hostname, to make it invalid. This should simulate exactly the case of a user having previously created an instance with an invalid hostname, and the applying the offline update past this Omicron commit. Now let's start the instance: So, we're at least preventing users from torpedoing an entire sled, by triggering #4931. We're also providing a reasonably clear set of steps to recover the instance's data, if needed. |
|
Failed the OpenAPI check yet again, since the new commits return a String as the hostname when fetching an instance. |
Hostnametype to the external API, which checks that a string conforms to RFC 1035 (and others) describing valid Internet hostnames. Add some tests for that.