Skip to content

Prefix Redis keys with docket name for ACL isolation#2811

Merged
jlowin merged 1 commit intomainfrom
prefix-redis-keys-docket
Jan 9, 2026
Merged

Prefix Redis keys with docket name for ACL isolation#2811
jlowin merged 1 commit intomainfrom
prefix-redis-keys-docket

Conversation

@chrisguidry
Copy link
Copy Markdown
Collaborator

@chrisguidry chrisguidry commented Jan 8, 2026

The Redis keys fastmcp uses directly (not via docket) weren't prefixed with the docket name, making ACL-based isolation impossible. Now uses docket.key() to prefix all task metadata keys consistently.

Keys now look like {docket_name}:fastmcp:task:{session_id}:{task_id} instead of fastmcp:task:{session_id}:{task_id}.

Bumps pydocket requirement to >=0.16.4 for the new key() method.

See also: #2812 (2.x backport)

🤖 Generated with Claude Code

The Redis keys fastmcp uses directly (not via docket) weren't prefixed
with the docket name, making ACL-based isolation impossible. Now uses
docket.key() to prefix all task metadata keys consistently.

Bumps pydocket requirement to >=0.16.4 for the new key() method.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. server Related to FastMCP server implementation or server-side functionality. dependencies Updates to project dependencies. Automatically applied to dependabot PRs. labels Jan 8, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccae21ab5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +63 to +67
task_meta_key = docket.key(f"fastmcp:task:{session_id}:{client_task_id}")
created_at_key = docket.key(
f"fastmcp:task:{session_id}:{client_task_id}:created_at"
)
poll_interval_key = docket.key(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve access to pre-upgrade task metadata keys

Because _lookup_task_execution now builds task_meta_key via docket.key(...), lookups only hit the new {docket_name}:fastmcp:task:... namespace. Tasks submitted before this change stored metadata under the old fastmcp:task:... keys; after a rolling upgrade, tasks/get, tasks/result, and tasks/cancel will return “not found” until those tasks expire. Consider checking the legacy key as a fallback or migrating existing keys on startup to avoid breaking in-flight tasks.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep that's accurate, but I think this is an acceptable risk because most folks would be using the memory:// broker, and also these are fairly transient keys.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

Walkthrough

The changes replace direct Redis key string construction with docket.key-wrapped keys across three files in the tasks module. In handlers.py, task metadata keys for created_at and poll_interval are updated to use docket.key generation. In requests.py, Redis key construction is reworked for task metadata lookups and MGET calls. In subscriptions.py, created_at timestamp retrieval uses docket.key-wrapped keys. The control flow and logic remain unchanged; only the key construction mechanism is updated.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing required contributors checklist items and review checklist items specified in the template. Complete the checklist by checking the boxes: confirm issue closure, development workflow adherence, testing completion, documentation updates, self-review, and readiness for review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: prefixing Redis keys with docket names for ACL isolation, which aligns with all file modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jlowin jlowin merged commit 08caf77 into main Jan 9, 2026
18 checks passed
@jlowin jlowin deleted the prefix-redis-keys-docket branch January 9, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. dependencies Updates to project dependencies. Automatically applied to dependabot PRs. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants