Skip to content

state: do not treat short hex node names as UUID prefixes - #23865

Open
ShravanthReddy wants to merge 1 commit into
hashicorp:mainfrom
ShravanthReddy:fix-23724-short-hex-node-name
Open

state: do not treat short hex node names as UUID prefixes#23865
ShravanthReddy wants to merge 1 commit into
hashicorp:mainfrom
ShravanthReddy:fix-23724-short-hex-node-name

Conversation

@ShravanthReddy

Copy link
Copy Markdown

Description

NodeServices("ba1") can return an unrelated node.

Root Cause

On a name miss the catalog does a UUID prefix lookup. minUUIDLookupLen is 2, and resizeNodeLookupKey("ba1") is ba, so any node whose ID starts BA… matches.

Fix

Require 8 hex characters after resize before treating the query as a UUID prefix. A missing short hex name returns nothing. Existing UUID and prefix lookups are unchanged.

Testing

go test ./agent/consul/state -run 'TestStateStore_NodeServices' -count=1

Fixes #23724

On a name miss, nodeServices treated any 2+ character hex query as a
UUID prefix. resizeNodeLookupKey("ba1") is "ba", so NodeServices("ba1")
returned an unrelated node whose ID started BA. Require an 8-character
prefix after resize.
@ShravanthReddy
ShravanthReddy requested review from a team as code owners August 30, 2026 03:11
@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

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.

Consul Returns Incorrect Nodes when a Queried Node Doesn't Exist (Short Node Names)

1 participant