Skip to content

fix: validate attribute name length by UTF-8 byte count#2329

Merged
lucasmcdonald3 merged 7 commits into
mainfrom
fix/attribute-name-byte-length
Jun 24, 2026
Merged

fix: validate attribute name length by UTF-8 byte count#2329
lucasmcdonald3 merged 7 commits into
mainfrom
fix/attribute-name-byte-length

Conversation

@lucasmcdonald3

@lucasmcdonald3 lucasmcdonald3 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Attribute name length was validated asymmetrically: encode only rejected
keys that overflowed the 4-byte length field (~4.29 GB), while decode
enforced the character-based IsValid_AttributeName (<= 65535 chars). Keys
between 65,536 bytes and ~4.29 GB encrypted and persisted but were rejected
on decode, making the data permanently unreadable.

Add a byte-based check (1 <= |UTF8.Encode(key)| <= 65535) on both the encode
(SerializeMapItem) and decode (DeserializeMapEntry) paths so over-long keys
fail fast at encrypt time. The check is done in DB-ESDK rather than via
IsValid_AttributeName, which is generated and inherently character-based.
@lucasmcdonald3 lucasmcdonald3 requested a review from a team as a code owner June 16, 2026 22:42

@josecorella josecorella left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lucasmcdonald3 lucasmcdonald3 merged commit 1520838 into main Jun 24, 2026
125 of 130 checks passed
@lucasmcdonald3 lucasmcdonald3 deleted the fix/attribute-name-byte-length branch June 24, 2026 19:07
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