Skip to content

feat: Complete RBAC and distribution contracts - #14230

Merged
erichare merged 4 commits into
release-1.12.0from
fix/release-1.12-ticket-completion
Jul 23, 2026
Merged

feat: Complete RBAC and distribution contracts#14230
erichare merged 4 commits into
release-1.12.0from
fix/release-1.12-ticket-completion

Conversation

@erichare

@erichare erichare commented Jul 23, 2026

Copy link
Copy Markdown
Member

What this completes

Closes the remaining OSS implementation gaps for LE-1913, LE-1914, LE-1869, and the LE-192 umbrella on release-1.12.0:

  • adds a canonical authorization endpoint/action matrix with CI drift enforcement and persona/privacy expectations;
  • applies authorization before side effects for A2A, voice, and personal provider-account surfaces;
  • adds a public, transaction-aware identity mutation contract for users, API keys, roles, assignments, teams, and team membership;
  • preserves compatibility with existing authorization plugins through the legacy invalidation adapter;
  • documents and validates the Python 3.10–3.14 core/default/full distribution and image profiles.

Scope boundary

LE-1828 is intentionally excluded. Deployment RBAC for that ticket is handled by #14104. This PR only adds provider-account authorization where needed for LE-1913.

Validation

  • 244-test moderate backend authorization suite
  • 66 focused lifecycle, voice, and guard tests
  • 14 isolated LFX authorization tests
  • 13 endpoint-matrix and release-inventory tests
  • 5 focused user/API-key integration tests
  • canonical endpoint-matrix checker
  • Ruff, Ruff format, actionlint, detect-secrets, and git diff --check

Enterprise pairing

Companion EE draft: https://github.ibm.com/WatsonOrchestrate/Langflow-Enterprise/pull/116

The EE PR pins this exact OSS commit and validates the lifecycle, endpoint-matrix, frontend-vocabulary, and hardened-bundle contracts.

Generated with OpenAI Codex.

Summary by CodeRabbit

  • New Features
    • Improved authorization for provider accounts, voice features, API keys, roles, teams, and user management.
    • A2A agents now respect sharing and visibility permissions.
    • Unauthorized requests receive safer responses and are blocked before accessing secrets or external services.
  • Documentation
    • Added guidance for choosing Core, Default, or Full Docker images, version pinning, migrations, and rollbacks.
  • Bug Fixes
    • Improved authorization change handling, auditing, and recovery when post-change processing fails.
  • Chores
    • Added automated release and authorization coverage validation.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 45aaf025-a06a-41e4-8682-4190249dc53f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR adds authorization mutation lifecycle contracts and integrates them into identity and authorization CRUD flows, adds provider-account and voice permission guards, expands A2A and voice enforcement, introduces an endpoint authorization matrix validator, adds core release inventory checks, and documents Docker image profiles.

Changes

Authorization lifecycle pipeline

Layer / File(s) Summary
Mutation contracts and compatibility hooks
src/lfx/src/lfx/services/authorization/*, src/backend/base/langflow/services/authorization/*
Adds canonical authorization mutation types, lifecycle hooks, context fields, guard exports, and legacy invalidation compatibility.
API mutation integration
src/backend/base/langflow/api/v1/users.py, api_key.py, authz_roles.py, authz_teams.py, authz_role_assignments.py
Stages authorization mutations before database commit and publishes committed events for user, API-key, role, team, and assignment changes.
Lifecycle validation tests
src/backend/tests/unit/api/v1/test_authz_lifecycle_contract.py, test_authz_admin_routes.py, src/lfx/tests/unit/services/authorization/*
Tests ordering, rejection, rollback, auditing, post-commit failures, and legacy hook adaptation.

Resource and endpoint authorization

Layer / File(s) Summary
Provider-account and voice guard contracts
src/backend/base/langflow/services/authorization/*, api/v1/schemas/authz_roles.py
Adds provider-account and voice actions, resource specifications, permission helpers, and role permission validation.
Endpoint authorization and visibility
src/backend/base/langflow/api/v1/a2a.py, deployments.py, voice_mode.py
Adds provider-account checks, A2A API-key execution enforcement, visibility-aware agent listing, and voice authorization early returns.
Resource authorization regression tests
src/backend/tests/unit/api/v1/test_a2a.py, test_deployment_route_handlers.py, test_voice_mode_flow_authz.py, test_voice_mode_client_scoping.py, services/authorization/*
Covers visibility grants, scoped permissions, denial ordering, and suppression of downstream credential or network lookups.

Authorization endpoint matrix

Layer / File(s) Summary
Route matrix and validator
scripts/ci/authz_endpoint_matrix.json, scripts/ci/check_authz_endpoint_matrix.py
Defines route authorization contracts and validates matrix schema, references, discovered routes, duplicates, omissions, and stale entries.
Matrix coverage tests
scripts/ci/test_authz_endpoint_matrix.py
Tests complete decorated-route coverage, required contract dimensions, persona presets, and detection of unclassified routes.

Release inventory and Docker documentation

Layer / File(s) Summary
Core release inventory gate
.github/workflows/release-inventory-gate.yml, scripts/ci/test_release_inventory.py
Adds Python 3.10–3.14 core wheel installation, inventory validation, authorization import checks, backend health verification, and artifact upload.
Docker profile guidance
docs/docs/Deployment/docker-image-profiles.mdx, docs/docs/Deployment/deployment-docker.mdx, docs/sidebars.js
Documents Core, Default, and Full image profiles, pinning, migration, custom images, rollback, and navigation to the new guide.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant A2AEndpoint
  participant APIKeyAuthentication
  participant AuthorizationGuard
  participant AgentVisibility
  Client->>A2AEndpoint: request agent or message/send
  A2AEndpoint->>APIKeyAuthentication: authenticate API key
  APIKeyAuthentication-->>A2AEndpoint: authenticated user
  A2AEndpoint->>AuthorizationGuard: enforce flow execute permission
  A2AEndpoint->>AgentVisibility: compute visible agent flows
  AgentVisibility-->>Client: authorized agent response
Loading

Possibly related PRs

Suggested labels: enhancement, test, migration, documentation

Suggested reviewers: himavarshavs

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.97% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Test Coverage For New Implementations ✅ Passed Dedicated tests cover the new authz, lifecycle, voice, provider-account, and release-matrix behavior; filenames follow test_*.py and assertions hit real code paths.
Test Quality And Coverage ✅ Passed New tests are behavior-focused, use pytest async/anyio correctly, and cover success/error paths for the added authz, lifecycle, voice, provider-account, and workflow checks.
Test File Naming And Structure ✅ Passed PASS: Added tests are all test_*.py pytest modules in unit/CI dirs, with descriptive names, fixtures, and positive/negative coverage; no misplaced frontend/integration tests.
Excessive Mock Usage Warning ✅ Passed Mocks stay at external seams: purpose-built fakes for session/authz, a real-session voice path, and no core logic is mocked away, so no excessive-mock warning.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the PR’s main focus on RBAC and distribution contract completion.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1.12-ticket-completion

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.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@erichare
erichare marked this pull request as ready for review July 23, 2026 17:05
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Advisor

No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉

Advisory check only — never blocks merge.

@erichare erichare changed the title [release-1.12.0] Complete RBAC and distribution contracts feat: Complete RBAC and distribution contracts Jul 23, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/backend/tests/unit/api/v1/test_authz_lifecycle_contract.py (1)

40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant @pytest.mark.asyncio decorators. This repo runs pytest-asyncio in asyncio_mode = 'auto', so async tests under tests/ are auto-detected; the explicit markers throughout this file can be dropped for consistency with the convention.

Based on learnings: pytest-asyncio is configured with asyncio_mode = 'auto' in pyproject.toml, so @pytest.mark.asyncio decorators are unnecessary for tests under tests/ paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/backend/tests/unit/api/v1/test_authz_lifecycle_contract.py` at line 40,
Remove the redundant `@pytest.mark.asyncio` decorators from the async tests in
this file, including the test identified by the surrounding lifecycle contract
test definitions. Rely on the repository’s asyncio_mode = "auto" configuration
while preserving each test’s async behavior and other decorators.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-inventory-gate.yml:
- Around line 88-91: Update the release contract checkout step using
actions/checkout@v6 to disable GitHub token persistence via its
credential-persistence option. Keep the existing inputs.ref checkout behavior
unchanged and apply the change only to this checkout step.

In `@docs/docs/Deployment/docker-image-profiles.mdx`:
- Around line 33-36: Update the moving-tag examples in the deployment
documentation to use complete, consistent image references:
langflowai/langflow:core-latest, langflowai/langflow:latest, and
langflowai/langflow-all:latest. Preserve the surrounding guidance about pinning
version tags and registry digests.

In `@scripts/ci/check_authz_endpoint_matrix.py`:
- Around line 86-98: Update _parse_matrix_route to validate the parsed action
against the script’s known action vocabulary, rejecting unknown values with a
source- and handler-specific ValueError like the existing access validation.
Preserve the current incomplete-entry and access-mode checks, and return only
validated action values.

In `@src/backend/base/langflow/api/v1/a2a.py`:
- Around line 694-708: Update the flow query using
restrict_to_owned_or_visible_scope so owned_clause is passed only when
should_apply_owner_override() allows the owner override. Preserve
visibility-only filtering for scoped API keys, matching the behavior of
filter_visible_resources and preventing unrestricted enumeration of the current
user’s flows.

In `@src/backend/base/langflow/api/v1/users.py`:
- Around line 211-223: Update the user update flow around update_user so await
session.commit() executes for every successful user patch, not only when
lifecycle_mutation is present. Keep lifecycle staging, committed notification,
and audit_decision within the lifecycle_mutation branch, while placing the
commit after that branch so password, role, and profile updates are persisted as
well.

---

Nitpick comments:
In `@src/backend/tests/unit/api/v1/test_authz_lifecycle_contract.py`:
- Line 40: Remove the redundant `@pytest.mark.asyncio` decorators from the async
tests in this file, including the test identified by the surrounding lifecycle
contract test definitions. Rely on the repository’s asyncio_mode = "auto"
configuration while preserving each test’s async behavior and other decorators.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c1ba488-a045-487d-b01c-897e1e813131

📥 Commits

Reviewing files that changed from the base of the PR and between 77964d4 and 1ac46cc.

📒 Files selected for processing (33)
  • .github/workflows/release-inventory-gate.yml
  • docs/docs/Deployment/deployment-docker.mdx
  • docs/docs/Deployment/docker-image-profiles.mdx
  • docs/sidebars.js
  • scripts/ci/authz_endpoint_matrix.json
  • scripts/ci/check_authz_endpoint_matrix.py
  • scripts/ci/test_authz_endpoint_matrix.py
  • scripts/ci/test_release_inventory.py
  • src/backend/base/langflow/api/v1/a2a.py
  • src/backend/base/langflow/api/v1/api_key.py
  • src/backend/base/langflow/api/v1/authz_role_assignments.py
  • src/backend/base/langflow/api/v1/authz_roles.py
  • src/backend/base/langflow/api/v1/authz_teams.py
  • src/backend/base/langflow/api/v1/deployments.py
  • src/backend/base/langflow/api/v1/schemas/authz_roles.py
  • src/backend/base/langflow/api/v1/users.py
  • src/backend/base/langflow/api/v1/voice_mode.py
  • src/backend/base/langflow/services/authorization/__init__.py
  • src/backend/base/langflow/services/authorization/actions.py
  • src/backend/base/langflow/services/authorization/guards.py
  • src/backend/base/langflow/services/authorization/lifecycle.py
  • src/backend/base/langflow/services/authorization/utils.py
  • src/backend/tests/unit/api/v1/test_a2a.py
  • src/backend/tests/unit/api/v1/test_authz_admin_routes.py
  • src/backend/tests/unit/api/v1/test_authz_lifecycle_contract.py
  • src/backend/tests/unit/api/v1/test_deployment_route_handlers.py
  • src/backend/tests/unit/api/v1/test_voice_mode_flow_authz.py
  • src/backend/tests/unit/services/authorization/_policy_double.py
  • src/backend/tests/unit/services/authorization/test_guards.py
  • src/backend/tests/unit/test_voice_mode_client_scoping.py
  • src/lfx/src/lfx/services/authorization/__init__.py
  • src/lfx/src/lfx/services/authorization/base.py
  • src/lfx/tests/unit/services/authorization/test_default_authorization_service.py

Comment thread .github/workflows/release-inventory-gate.yml
Comment thread docs/docs/Deployment/docker-image-profiles.mdx Outdated
Comment thread scripts/ci/check_authz_endpoint_matrix.py
Comment thread src/backend/base/langflow/api/v1/a2a.py
Comment thread src/backend/base/langflow/api/v1/users.py
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.72093% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.45%. Comparing base (597d05f) to head (63e5951).
⚠️ Report is 34 commits behind head on release-1.12.0.

Files with missing lines Patch % Lines
src/lfx/src/lfx/services/authorization/base.py 83.72% 10 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.12.0   #14230      +/-   ##
==================================================
- Coverage           61.47%   61.45%   -0.03%     
==================================================
  Files                2339     2402      +63     
  Lines              237145   239005    +1860     
  Branches            35410    36984    +1574     
==================================================
+ Hits               145787   146874    +1087     
- Misses              89561    90317     +756     
- Partials             1797     1814      +17     
Flag Coverage Δ
lfx 60.41% <83.72%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/backend/base/langflow/api/v1/a2a.py 85.11% <ø> (+0.29%) ⬆️
src/backend/base/langflow/api/v1/api_key.py 75.00% <ø> (+0.53%) ⬆️
...end/base/langflow/api/v1/authz_role_assignments.py 88.88% <ø> (-0.45%) ⬇️
src/backend/base/langflow/api/v1/authz_roles.py 70.96% <ø> (-0.13%) ⬇️
src/backend/base/langflow/api/v1/authz_teams.py 73.48% <ø> (-0.99%) ⬇️
src/backend/base/langflow/api/v1/deployments.py 81.27% <ø> (-0.12%) ⬇️
...ackend/base/langflow/api/v1/schemas/authz_roles.py 100.00% <ø> (ø)
src/backend/base/langflow/api/v1/users.py 71.87% <ø> (-2.62%) ⬇️
src/backend/base/langflow/api/v1/voice_mode.py 20.92% <ø> (-0.23%) ⬇️
...nd/base/langflow/services/authorization/actions.py 100.00% <ø> (ø)
... and 3 more

... and 483 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 47%
47.01% (67374/143289) 70.15% (9504/13547) 45.58% (1554/3409)

Unit Test Results

Tests Skipped Failures Errors Time
5375 0 💤 0 ❌ 0 🔥 15m 45s ⏱️

@erichare
erichare merged commit 52b1ea1 into release-1.12.0 Jul 23, 2026
23 checks passed
@erichare
erichare deleted the fix/release-1.12-ticket-completion branch July 23, 2026 17:59
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant