Skip to content

fix: clear Kuudo tenant state on bearer swaps#100

Merged
tspicer merged 3 commits into
mainfrom
feat-add-kuudo-auth-provider
Jul 22, 2026
Merged

fix: clear Kuudo tenant state on bearer swaps#100
tspicer merged 3 commits into
mainfrom
feat-add-kuudo-auth-provider

Conversation

@tspicer

@tspicer tspicer commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

  • bind each Kuudo bearer to persisted MCP tenant state with a provider-local fingerprint
  • clear active identity, credentials, and profiles before tool execution when the bearer changes
  • derive the discriminator with the existing salted 600,000-iteration PBKDF2 implementation
  • reuse the derived fingerprint across nested middleware and provider operations within one request

Root cause

The inbound Kuudo middleware scoped the current API key for downstream provider calls, but the session bridge could hydrate identity and credentials selected under a previous bearer. The initial keyed HMAC discriminator fixed ownership tracking but triggered the repository's sensitive-data CodeQL policy.

Validation

  • uv sync
  • uv run ruff check --fix
  • uv run pytest -q tests/unit/test_kuudo_provider.py tests/unit/test_inbound_auth.py tests/unit/test_authentication_middleware.py tests/unit/test_auth_session_bridge.py tests/unit/test_session_state.py tests/unit/test_session_scope_signaling.py

Result: 117 passed.

Comment thread src/amazon_ads_mcp/auth/providers/kuudo.py Fixed
Comment thread tests/unit/test_kuudo_provider.py Fixed

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

Copy link
Copy Markdown

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: b5fb755ad7

ℹ️ 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 thread src/amazon_ads_mcp/auth/session_state.py
Comment thread src/amazon_ads_mcp/middleware/authentication.py Outdated
@tspicer tspicer changed the title update HMAC key fix: clear Kuudo tenant state on bearer swaps Jul 22, 2026
@tspicer
tspicer merged commit f489126 into main Jul 22, 2026
10 checks passed
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