Skip to content

Conversation

@crivetimihai
Copy link
Member

Summary

  • Fixes bug where plugins receive user: null in GlobalContext when the context is reused from middleware
  • Ensures app_user_email is propagated to global_context.user when available

Root Cause

In invoke_tool, when a plugin_global_context is passed from middleware, the code updated server_id but not user. This caused security plugins to be unable to track which user made each request.

Fix

Added propagation of app_user_email to global_context.user in the existing context reuse path, consistent with how the fallback path already sets the user.

Attribution

This PR supersedes #1551 by @IliaMManolov from Edison-Watch, which identified the issue correctly but had a minor bug in the condition (checking gateway_id instead of app_user_email).

Closes #1550
Supersedes #1551

Co-authored-by: Ilia Manolov iliamanolov@outlook.com

When invoke_tool receives an existing plugin_global_context from middleware,
the user email was not being propagated to the global context. This caused
plugins to receive user: null in their GlobalContext.

This fix ensures the user email is always propagated to the global context
when available, enabling security plugins to properly track which user
made each request.

Closes #1550
Supersedes #1551

Co-authored-by: Ilia Manolov <iliamanolov@outlook.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai merged commit b028857 into main Dec 12, 2025
52 checks passed
@crivetimihai crivetimihai deleted the fix/propagate-app-user-email branch December 12, 2025 20:57
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.

[Bug]: app_user_email not propagated to plugin global context if a context already exists

2 participants