Skip to content

Validate token storage keys before Redis reads/deletes - #449

Open
quentinmayo wants to merge 1 commit into
pinterest:masterfrom
quentinmayo:fix/token-storage-key-validation
Open

Validate token storage keys before Redis reads/deletes#449
quentinmayo wants to merge 1 commit into
pinterest:masterfrom
quentinmayo:fix/token-storage-key-validation

Conversation

@quentinmayo

@quentinmayo quentinmayo commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate token-derived Redis storage keys before any exists/get/delete operation
  • reject tokens that do not match SnapPass key format (REDIS_PREFIX + 32 hex chars)
  • add regression tests to ensure non-SnapPass keys (e.g. session:42) cannot be used as an existence oracle or read/delete target

Test plan

  • MOCK_REDIS=1 .venv/bin/pytest -q tests.py
  • MOCK_REDIS=1 .venv/bin/pytest -q tests.py -k "non_snappass or rejects_non_snappass or get_password or password_exists or retrieve_password_api_v2 or check_password_api_v2"

Reject tokens that do not match SnapPass key format so arbitrary Redis keys cannot be probed, read, or deleted via password retrieval endpoints.

Co-authored-by: Cursor <cursoragent@cursor.com>
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