oxidecomputer / oxidecomputer/omicron
NameOrID resolution in networking db queries allow invalid UUIDs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
Currently we look up the parent record if the caller provides a NameOrId::Name, but does not look up the parent record if the caller provides NameOrId::Id. Since we don't use "real" Foreign Keys in our tables, the queries / DML will continue along happily if the user provides a Uuid that does not exist in the parent table, leading to child records that point to a parent that doesn't exist.
An example of such resolution logic can be found here:
https://github.com/oxidecomputer/omicron/blob/8b3e948dd8afab54d5fe0c821beb4af5a83b7701/nexus/db-queries/src/db/datastore/bgp.rs#L46-L57
So we need to audit for similar structures and update them to perform an actual lookup and verify that the uuid points to a real record.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the resolution logic in nexus/db-queries/src/db/datastore/bgp.rs at lines 46-57. Audit networking database queries for similar NameOrId handling, focusing on the Id path and whether it verifies that the parent UUID exists. Done means analogous paths perform a real parent lookup before child records are written.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100