fix: strict RFC 4122 UUID validation in *_from_uid methods#10
Draft
Koan-Bot wants to merge 1 commit into
Draft
Conversation
Malformed UUIDs (e.g. "aaa-bbb", "not-a-uuid") were silently passed to the OpenStack API, producing cryptic 404 or 400 errors. Now server_from_uid(), image_from_uid(), and all spec-generated getfromid methods validate input against the 8-4-4-4-12 hex format before making any API call, with a clear die message. The _looks_valid_id() heuristic is intentionally left loose — it serves as an ID-vs-name routing check, and OpenStack resources like flavors use simple numeric IDs. Strict UUID validation is applied at the entry points where UUIDs are the expected format. Test fixture UUIDs that used non-compliant formats have been corrected to proper 8-4-4-4-12 format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Koan-Bot
force-pushed
the
koan.atoomic/strict-uuid-validation
branch
from
April 20, 2026 13:22
2f4b548 to
87800fd
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enforce strict 8-4-4-4-12 hex UUID format validation at
server_from_uid(),image_from_uid(), and all spec-generatedgetfromidentry points.Why
The loose
qr{^[a-f0-9\-]+$}iregex accepted any mix of hex and dashes — strings like"aaa","---", or"abc-def"passed validation and were sent to the OpenStack API, producing cryptic remote 404/400 errors instead of a clear local error message.How
^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$) inGetFromId.pm(_get_from_idand_get_from_id_spec) andImages.pm(image_from_uid)_looks_valid_id()inMetaAPI.pmas a loose heuristic — it's used for ID-vs-name routing and must accept non-UUID IDs (e.g., numeric flavor IDs like"1","2")000000-1111-22222-33333-444444→00000000-1111-2222-3333-444444444444)server_from_uidandimage_from_uidTesting
Full test suite passes: 32 tests across 6 files.
🤖 Generated with Claude Code
Quality Report
Changes: 7 files changed, 76 insertions(+), 23 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline