fix: add PERMISSION_AUDIT_ENABLED toggle for RBAC auditing#2716
Merged
crivetimihai merged 3 commits intomainfrom Feb 5, 2026
Merged
fix: add PERMISSION_AUDIT_ENABLED toggle for RBAC auditing#2716crivetimihai merged 3 commits intomainfrom
crivetimihai merged 3 commits intomainfrom
Conversation
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
* fix: add PERMISSION_AUDIT_ENABLED toggle for RBAC auditing Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * chore: clarify permission audit settings docstring Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * chore: remove unrelated CHANGELOG.md changes Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PERMISSION_AUDIT_ENABLEDenvironment variable (defaultfalse) to control whether RBAC permission checks are written to thepermission_audit_logtablePermissionService.__init__default tosettings.permission_audit_enabledinstead of always-on auditing, preventing unnecessary DB writes under load_roles_cacheduringget_user_permissions()so_get_roles_for_audit()reuses them synchronously instead of issuing a duplicate DB querycontains_eager+result.unique()in_get_user_rolesto avoid N+1 queries when eager-loading theRolerelationship.env.example, Helmvalues.yaml/values.schema.json, and configuration docsTest plan
PERMISSION_AUDIT_ENABLED=false(default) produces no rows inpermission_audit_logPERMISSION_AUDIT_ENABLED=truewrites audit rows for each permission checktests/unit/mcpgateway/services/test_permission_service_comprehensive.py