Skip to content

fix: reject whitespace-only keys - #663

Open
CRYPTONIKAV wants to merge 1 commit into
pinterest:masterfrom
CRYPTONIKAV:fix/662-whitespace-keys
Open

CRYPTONIKAV wants to merge 1 commit into
pinterest:masterfrom
CRYPTONIKAV:fix/662-whitespace-keys

Conversation

@CRYPTONIKAV

Copy link
Copy Markdown

Closes #662

What I changed

  • pymemcache/client/base.py: check_key_helper now also rejects non-empty keys whose split() is empty (whitespace-only). Third branch or (key and not parts); falsy empty keys still pass, length check keeps precedence.
  • pymemcache/test/test_client.py: 5 new failing-condition rows.

Verification

  • New cases fail on master, pass with the fix (RED→GREEN); unit suite 335/335, ruff check clean
  • Edge cases: '' still accepted, overlong whitespace keys report length first, None still TypeError

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.

check_key_helper accepts whitespace-only keys, which the docs say it must reject

1 participant