oxidecomputer / oxidecomputer/omicron

NameOrID resolution in networking db queries allow invalid UUIDs

Open
#6,349 6 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.