Skip to content

fix: strict RFC 4122 UUID validation in *_from_uid methods - #10

Merged
atoomic merged 2 commits into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/strict-uuid-validation
Sep 11, 2026
Merged

atoomic merged 2 commits into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/strict-uuid-validation

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Mar 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Enforce strict 8-4-4-4-12 hex UUID format validation at server_from_uid(), image_from_uid(), and all spec-generated getfromid entry points.

Why

The loose qr{^[a-f0-9\-]+$}i regex 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

  • Added strict RFC 4122 regex (^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$) in GetFromId.pm (_get_from_id and _get_from_id_spec) and Images.pm (image_from_uid)
  • Kept _looks_valid_id() in MetaAPI.pm as 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")
  • Fixed test fixture UUIDs that used non-compliant formats (e.g., 000000-1111-22222-33333-444444 → 00000000-1111-2222-3333-444444444444)
  • Added 9 new tests verifying malformed UUID rejection for both server_from_uid and image_from_uid

Testing

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

@Koan-Bot
Koan-Bot force-pushed the koan.atoomic/strict-uuid-validation branch from 2f4b548 to 87800fd Compare April 20, 2026 13:22
@atoomic
atoomic marked this pull request as ready for review September 11, 2026 00:15
Koan-Bot and others added 2 commits September 10, 2026 18:37
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
Koan-Bot force-pushed the koan.atoomic/strict-uuid-validation branch from 87800fd to 8eef092 Compare September 11, 2026 00:38
@atoomic
atoomic merged commit 11543bd into cpan-authors:main Sep 11, 2026
19 checks passed
@Koan-Bot

Copy link
Copy Markdown
Contributor Author

Rebase with conflict resolution

Branch koan.atoomic/strict-uuid-validation was rebased onto main with automatic conflict resolution.

Changes applied

  • CI fix: Applied pre-push CI fix
  • CI fix: Pre-push CI fix applied

Stats

10 files changed, 167 insertions(+), 45 deletions(-)
Actions performed
  • Already-solved check: negative (confidence=high, reasoning=Current main has no UUID format check in GetFromId.pm::_get_from_id_spec or `Images.pm::image_fr)
  • Resolved merge conflicts (1 round(s))
  • Rebased koan.atoomic/strict-uuid-validation onto upstream/main
  • Pre-push CI check: previous run #24668971175 failed
  • Applied pre-push CI fix
  • Pre-push CI fix applied
  • Force-pushed koan.atoomic/strict-uuid-validation to origin
  • Force-pushed koan.atoomic/strict-uuid-validation to origin
  • Private review gate passed after 1 fix round(s)
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Skuggi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants