Repository navigation
RBAC: refuse when the role check can't decide (1.5.1, A) - #278
Merged
Merged
Conversation
rbac_before_model_callback let a model call through, with a warning, when the context had no user id or no agent name, or when no enabled agents_config row was found for the agent. get_root_agent_by_name returns None on a query error too, so a database error also became an allow. All three now refuse, as the exception path already did, and the mate.rbac_check span records allowed=false for them. The LangGraph hook refuses an agent without a config the same way. Eval and Playground runs (is_eval_run) and the system agents in _should_skip_rbac_check still skip the check; agents built in code get no MATE callbacks. Also the CHANGELOG entry for #260.
… plugin mode From the security review of the previous commit: - combined_user_profile_and_rbac_callback caught an exception from the RBAC check, logged a warning and went on to the model. It now refuses. - With MATE_PLUGINS_ENABLED=true the check runs for every LLM agent in the app, so an agent built in code without an agents_config row is now refused. The guide and CHANGELOG say so instead of claiming code-built agents never reach the check, and the LangGraph line says what its hook actually adds. - Tests: system agents and eval runs still pass without a config row, and the chain refuses when the check raises.
This was referenced Oct 17, 2026
Merged
6 tasks done
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.
What and why
Fix A from #276 (plan item 3 in
documents/design/2.0-plan.md).Before each model call,
rbac_before_model_callbackcompares the caller's roles with the agent'sallowed_for_roles. In three cases it let the call through, with only a warning:agents_configrow for the agent.get_root_agent_by_namereturnsNonewhen its query raises, so case 3 also turned a database error into an allow.All three now refuse with
RBAC_ACCESS_DENIED, as the exception path already did, and themate.rbac_checkspan recordsallowed=false. Two more places change the same way:combined_user_profile_and_rbac_callback. It wraps the check, and it used to log a warning and carry on to the model when the check raised. It now refuses.check_rbac. It refuses an agent without a config. Its/run_ssealready returns 400 without a user id or app name.Unchanged:
is_eval_run) and the system agents in_should_skip_rbac_checkstill skip the check.disabledmeans.Behaviour change, in the CHANGELOG and guide: with
MATE_PLUGINS_ENABLED=true(off by default), the check runs for every LLM agent in the app. An agent built in code without anagents_configrow is therefore refused now, where it used to be allowed with a warning. Nothing shipped is affected:hardcoded_agentslist is empty;hardcodedflag have rows.Also the CHANGELOG entry for #260 (#243, thanks to @sourabh65mehta).
How it was tested
shared/test/test_rbac_fail_closed.py:The five refusal tests fail on
mainand pass here.Full suite: 1543 OK.
gen_docs.py --checkOK.I checked that the real tree keeps config names: I built a real ADK tree from an in-memory database with a sub-agent under two parents.
{name}_{parent}instance names come only frombuild_agent_tree, called only byrbac_agent_factory.py, which nothing imports.An independent security review traced every caller:
trigger_runner), Slack, the widget, the OpenAI API, the MCP bridge and A2A;create_agenttool (the row is committed before the cache reload).It found no blocking issue. Its non-blocking points are fixed in the second commit: the wrapper failing open, the guide's wording on code-built agents and on LangGraph, and the two extra tests.
Pre-existing, outside this PR (noted on #276):
_should_skip_rbac_checkmatches by name, so a database agent namedsystem_agent,health_check_agentormate_fallback_agentskips the check.Checklist
shared/test/, andpython -m unittest discover -s shared/test -p "test_*.py"passespython scripts/gen_docs.py drift --base origin/main.docs/dev/auth-and-access.mdis updated. These still hold:docs/dev/agent-runtime.mdanddocs/dev/langgraph-runtime.mddescribe where the check runs, not its fallbacks;docs/dev/releases.mdis listed only because ofCHANGELOG.md.