Skip to content

feat: Complete release 1.12 RBAC authorization foundations - #14215

Merged
erichare merged 6 commits into
release-1.12.0from
fix/release-1.12-rbac-deliverables
Jul 22, 2026
Merged

feat: Complete release 1.12 RBAC authorization foundations#14215
erichare merged 6 commits into
release-1.12.0from
fix/release-1.12-rbac-deliverables

Conversation

@erichare

@erichare erichare commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

This is the OSS half of the release 1.12 RBAC deliverables work. It supplies the shared authorization, data-model, API, provider-policy, migration, and frontend seams consumed by the companion Enterprise change.

Addresses deliverables 2.4, 2.10, 2.11, 3.4, 4.2, 4.6, 4.9, and 4.11. Deliverable 0.10 is intentionally out of scope.

What changed

  • derive project/workspace authorization scope consistently and prefilter large flow listings in SQL
  • make share synchronization incremental and atomic, including removal/repair behavior
  • add variable/global-secret sharing while preserving secret redaction
  • promote audit actor type/ID to first-class fields, including API-key attribution, filtering, CSV support, and migration coverage
  • introduce stable model-provider IDs and enforce provider policy across component metadata, execution, model APIs, and voice mode
  • add the Enterprise customization seam for variable sharing
  • add migrations and focused regression/performance coverage

Impact

The Enterprise companion PR consumes these contracts for custom-role hierarchy, scoped Casbin policy, admin UI, audit export, resource sharing, and provider-policy administration. Existing behavior remains unchanged when authorization/provider policy is disabled.

Validation

  • repository pre-commit suite: passed (Ruff, migration validation, detect-secrets, Biome, deprecated-import check)
  • LFX authorization/provider suites: 92 passed
  • backend authz admin/share suites: 139 passed
  • variable suites: 71 passed
  • audit/model suites: 34 passed
  • voice authorization: 13 passed
  • flow/folder/listing regression suites: 92 passed across focused runs
  • 10k-flow authorization prefilter benchmark: passed correctness, materialization, and latency thresholds
  • integrated OSS + Enterprise frontend: 12 suites / 61 tests passed; Biome clean
  • bundle release-plan validation: passed (lfx-ibm 0.1.4 and lfx-bundles 1.1.3 are metadata-consistent)
  • LFX upgrade/run regression suite: 159 passed, including both clean-flow bundled-registry checks
  • exact-SHA Enterprise compatibility/typecheck/production build against b83ab35911bb6a3eba021812844ac91c7c4ef942: passed

Enterprise implementation: WatsonOrchestrate/Langflow-Enterprise#113 (merged). Final pin follow-up: WatsonOrchestrate/Langflow-Enterprise#114, advancing oss-version to this PR head b83ab35911bb6a3eba021812844ac91c7c4ef942.

Summary by CodeRabbit

  • New Features
    • Added provider descriptors and model-provider visibility controls to the component palette and model APIs.
    • Added model-provider policy enforcement during configuration, execution, validation, and voice-mode authentication.
    • Added actor type and actor ID filtering for authorization audit logs.
    • Added ownership, sharing controls, masked values, and permission-aware actions for global variables.
  • Bug Fixes
    • Improved flow workspace and folder consistency during creation, updates, imports, and moves.
    • Strengthened sharing policy refresh and active-team visibility handling.
    • Prevented shared variable recipients from seeing credential values.

@coderabbitai

coderabbitai Bot commented Jul 22, 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

Run ID: f70e3e63-cc0e-45c9-b404-d18a2a6aee3d

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 model-provider policy enforcement and discovery, canonical flow workspace handling, audit actor identity, targeted share-policy hooks, variable ownership metadata, and permission-aware global-variable UI behavior. It also adds migrations, regression tests, benchmarks, provider metadata, and starter-template updates.

Changes

Model-provider policy and discovery

Layer / File(s) Summary
Provider policy contracts and runtime gates
src/lfx/..., src/backend/base/langflow/...
Model components expose provider policy modes and stable identities; runtime execution, validation, configuration, palette discovery, and voice authentication enforce provider policy.
Provider descriptors and permission slugs
src/backend/base/langflow/api/v1/models.py, src/backend/base/langflow/api/v1/schemas/authz_roles.py, src/lfx/...
Provider descriptors are assembled from registries and component metadata, filtered by discovery policy, and model-provider permission slugs are validated.
Policy context propagation
src/lfx/src/lfx/services/model_provider_policy/*, src/backend/base/langflow/services/auth/service.py
Request-local user attributes are bound and reused for matching-user policy resolution.
Provider metadata and templates
src/bundles/*, src/backend/base/langflow/initial_setup/starter_projects/*, src/lfx/src/lfx/_assets/component_index.json
Provider identifiers, policy modes, model categories, and embedded component metadata are updated.

Canonical flow destinations and authorization

Layer / File(s) Summary
Destination canonicalization
src/backend/base/langflow/api/v1/authz_route_dependencies.py, src/backend/base/langflow/api/v1/flows_helpers.py, src/backend/base/langflow/api/v1/flows.py
Flow destinations resolve through user-scoped folders and canonical workspace/folder tuples before authorization and persistence.
Retry locking and reauthorization
src/backend/base/langflow/services/authorization/fetch.py, src/backend/base/langflow/api/v1/flows.py
Flow update and upsert retries reload locked rows, recalculate destinations, and reauthorize source and destination scopes.
Workspace-aware listing and moves
src/backend/base/langflow/api/v1/projects.py, src/backend/base/langflow/services/authorization/listing.py
Flow and project authorization prefilters use canonical workspace expressions, while project moves update both folder and workspace identifiers.
Migration and regression coverage
src/backend/base/langflow/alembic/versions/*, src/backend/tests/unit/api/v1/test_flow_folder_integrity.py, src/backend/tests/performance/test_flow_authz_prefilter_benchmark.py
Migrations repair workspace data and tests validate canonical destinations, workspace scoping, and SQL prefilter correctness/performance.

Audit actor identity

Layer / File(s) Summary
Audit schema and persistence
src/backend/base/langflow/services/database/models/auth/authz.py, src/backend/base/langflow/alembic/versions/a6c4e2f8b1d3_add_authz_audit_actor_identity.py
Audit rows gain nullable actor type and UUID fields, composite timestamp indexes, and non-FK actor storage.
Actor attribution pipeline
src/backend/base/langflow/services/authorization/audit.py
Queued audit entries resolve API-key, user, and unknown actors and preserve credential metadata during batch persistence.
Audit API filtering
src/backend/base/langflow/api/v1/authz_audit.py, src/backend/tests/unit/api/v1/test_authz_audit_schemas.py
Audit responses expose actor fields and support actor-type, actor-id, legacy unknown matching, and deterministic pagination ordering.

Targeted share authorization hooks

Layer / File(s) Summary
Share hook contract
src/lfx/src/lfx/services/authorization/base.py, src/lfx/src/lfx/services/authorization/__init__.py
An immutable ShareRuleSnapshot and targeted synchronization/removal hooks are added to the authorization service API.
Share lifecycle integration
src/backend/base/langflow/api/v1/authz_shares.py, src/backend/tests/unit/api/v1/test_authz_share_routes.py
Share creation, updates, and deletion use targeted hooks after commit, with coarse-sync and invalidation fallbacks; team visibility considers active teams only.

Variable access controls

Layer / File(s) Summary
Backend variable responses
src/backend/base/langflow/services/database/models/variable/model.py, src/backend/base/langflow/api/v1/variable.py, src/backend/base/langflow/services/variable/service.py
Variable responses include ownership and share-management flags, and non-owner updates redact stored values.
Frontend permissions and display
src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/*, src/frontend/src/types/global_variables/index.ts
The global variables page applies permission-aware value formatting, sharing actions, editing, deletion, row selection, and access indicators.
OSS customization seam
src/frontend/src/customization/components/custom-variable-share-action.tsx
A default no-op share-action component is added for replacement by downstream customization.

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

Possibly related PRs

Suggested labels: migration, test

Suggested reviewers: himavarshavs

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.54% 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 PASS: The PR adds real backend unit/perf tests and frontend *.test.ts[x] coverage for the new authz, flow, variable, and model-policy behavior; assertions are substantive, not placeholders.
Test Quality And Coverage ✅ Passed The new tests are real pytest/Jest behavior tests, cover success and failure paths for the new APIs/policies, and assert concrete outputs/call effects rather than smoke checks.
Test File Naming And Structure ✅ Passed PASS: New backend tests are test_*.py, the frontend test is *.test.ts, and the added suites use descriptive names plus fixtures/teardown in the expected unit/performance dirs.
Excessive Mock Usage Warning ✅ Passed Mocks are limited to external seams; tests still exercise real clients, DB models, and small fakes/stubs, so there’s no excessive mock usage.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the PR’s broad focus on RBAC authorization foundations for release 1.12.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1.12-rbac-deliverables

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.

@erichare
erichare force-pushed the fix/release-1.12-rbac-deliverables branch from 18b17f0 to 23f5ea9 Compare July 22, 2026 21:48
@erichare
erichare marked this pull request as ready for review July 22, 2026 21:48
@github-actions

Copy link
Copy Markdown
Contributor

Migration Validation Passed

All migrations follow the Expand-Contract pattern correctly.

@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 Complete release 1.12 RBAC authorization foundations feat: Complete release 1.12 RBAC authorization foundations Jul 22, 2026
@erichare
erichare marked this pull request as draft July 22, 2026 21:57
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 22, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 22, 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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/backend/base/langflow/services/database/models/folder/utils.py (1)

44-53: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use .is_(None) in the UPDATE WHERE predicate.

Flow.folder_id is None is evaluated in Python on the InstrumentedAttribute before and_() builds the clause, so it becomes and_(False, ...) and the UPDATE matches no rows. The workspace_id=folder.workspace_id repair therefore never takes effect, while the nearby SELECT already uses the correct Flow.folder_id.is_(None).

🐛 Proposed fix
         await session.exec(
             update(Flow)
             .where(
                 and_(
-                    Flow.folder_id is None,
+                    Flow.folder_id.is_(None),
                     Flow.user_id == user_id,
                 )
             )
             .values(folder_id=folder.id, workspace_id=folder.workspace_id)
         )
🤖 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/base/langflow/services/database/models/folder/utils.py` around
lines 44 - 53, Update the UPDATE predicate in the folder reassignment flow to
use Flow.folder_id.is_(None) instead of Python’s “is None” comparison, matching
the nearby SELECT predicate. Preserve the existing Flow.user_id filter and
values assignment so eligible flows receive the folder and workspace IDs.
src/lfx/src/lfx/_assets/component_index.json (1)

23445-23525: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Keep the deployment policy gate fail-closed when the setting is missing.

getattr(..., True) permits guard-code execution if the settings object is present but lacks allow_custom_components due to version skew or incomplete initialization. That contradicts the method’s fail-closed contract and can allow execution of client-editable Python code in a locked-down deployment.

Use a false default or explicitly reject a missing setting, then regenerate this embedded asset and checksum.

Proposed fix
-        return bool(getattr(settings_service.settings, "allow_custom_components", True))
+        return bool(getattr(settings_service.settings, "allow_custom_components", False))
🤖 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/lfx/src/lfx/_assets/component_index.json` around lines 23445 - 23525, The
deployment policy check in _code_execution_allowed must fail closed when the
settings object lacks allow_custom_components. Change the getattr fallback from
permissive to false (or explicitly reject the missing attribute), preserving
fail-open only when the settings layer cannot be imported; then regenerate the
embedded component_index.json asset and its checksum.
🧹 Nitpick comments (7)
src/backend/base/langflow/alembic/versions/b7d5f9a3c2e4_sync_flow_workspace_from_project.py (1)

43-56: 🚀 Performance & Scalability | 🔵 Trivial

Bulk UPDATE over the entire flow table may lock/scan large deployments.

The single correlated UPDATE is functionally correct and the EXISTS guard properly avoids nulling rows with a dangling folder_id. On large installations, though, this rewrites every project-scoped flow row in one statement and can hold a broad lock / long scan during the MIGRATE phase. Consider batching (e.g., keyset over flow.id) or documenting expected downtime for large datasets.

🤖 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/base/langflow/alembic/versions/b7d5f9a3c2e4_sync_flow_workspace_from_project.py`
around lines 43 - 56, The migration’s correlated UPDATE rewrites all
project-scoped flow rows in one potentially long-running operation. Replace the
single statement in the migration upgrade logic with bounded keyset batches over
flow.id, preserving the existing folder_id and EXISTS conditions and continuing
until no rows remain; keep workspace_id sourced from the matching folder.
src/backend/tests/unit/api/v1/test_authz_audit_schemas.py (1)

101-220: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a real-DB integration test instead of fake session/SQL-substring assertions.

_Session/_Result fully fake the DB layer, and correctness is asserted via substrings of compiled SQL text (e.g. "authz_audit_log.actor_type IS NULL" in count_sql) rather than actual query results. This is brittle to SQLAlchemy rendering changes and doesn't prove the filter semantics hold against a real engine. Consider seeding rows via a real async session (the authz_async_session fixture pattern used in test_authz_models.py) and asserting on list_audit_log's returned items.

Based on path instructions for **/test_*.py: "Warn when backend pytest files rely on excessive mocks that obscure what is actually being tested, replace mocks with real objects or test doubles when mocks become excessive, and prefer integration tests when unit tests are overly mocked."

🤖 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_audit_schemas.py` around lines 101 -
220, Replace the fake _Session/_Result setup and SQL-substring assertions in
test_audit_query_filters_and_returns_first_class_actor_fields and
test_unknown_actor_filter_includes_legacy_null_and_explicit_unknown_rows with
the real async database session fixture pattern used by test_authz_models.py.
Seed the relevant audit rows through that session, invoke list_audit_log, and
assert the returned items and ordering directly, preserving coverage for actor
filters including legacy NULL and explicit "unknown" rows.

Source: Path instructions

src/lfx/tests/unit/services/model_provider_policy/test_policy.py (1)

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

Remove the redundant async marker.

asyncio_mode = "auto" is configured in pyproject.toml, so pytest-asyncio will run async tests without @pytest.mark.asyncio.

Proposed fix
-@pytest.mark.asyncio
 async def test_standalone_model_component_denied_before_build_method(monkeypatch):
🤖 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/lfx/tests/unit/services/model_provider_policy/test_policy.py` at line
157, Remove the redundant `@pytest.mark.asyncio` decorator from the affected async
test; rely on the existing asyncio_mode = "auto" configuration in pyproject.toml
while leaving the test implementation unchanged.

Source: Learnings

src/backend/tests/unit/agentic/helpers/test_validation.py (1)

335-335: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the redundant pytest.mark.asyncio decorator.

pytest-asyncio is configured for automatic async-test detection, so this marker is unnecessary and inconsistent with the repository convention.

🤖 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/agentic/helpers/test_validation.py` at line 335,
Remove the redundant pytest.mark.asyncio decorator from the affected async test
in the validation helpers test module. Leave the test function and its async
behavior unchanged, following the repository’s automatic async-test detection
convention.

Source: Learnings

src/backend/tests/unit/api/v1/test_voice_mode_flow_authz.py (1)

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

Redundant @pytest.mark.asyncio decorator.

This repo runs pytest-asyncio in asyncio_mode = "auto", so async tests are auto-detected; the rest of this file (e.g. the test at line 198) already omits the decorator. Drop it here for consistency.

Based on a retrieved learning: "pytest-asyncio is configured with asyncio_mode = 'auto' in pyproject.toml... you do not need to decorate test functions or classes with pytest.mark.asyncio."

🧹 Proposed cleanup
-@pytest.mark.asyncio
 async def test_openai_voice_policy_denial_precedes_secret_lookup(monkeypatch):
-@pytest.mark.asyncio
 async def test_openai_voice_policy_allows_secret_lookup(monkeypatch):

Also applies to: 69-69

🤖 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_voice_mode_flow_authz.py` at line 39,
Remove the redundant `@pytest.mark.asyncio` decorators from the affected async
tests in this file, including the tests near lines 39 and 69; rely on the
repository’s asyncio_mode = "auto" configuration and preserve the existing test
implementations.

Source: Learnings

src/backend/base/langflow/services/auth/service.py (1)

688-698: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract a shared is_superuser attributes-builder for model-provider policy calls. Four sites independently reconstruct the same {"is_superuser": ...} dict passed to resolve_model_provider_policy/require_model_provider, each with a different accessor style (bool(x.is_superuser), bool(getattr(x, "is_superuser", False)), bool(principal and principal.is_superuser)). Consolidating into one helper in lfx.services.model_provider_policy removes the duplication and the risk of a future call site using the unguarded accessor on an object that doesn't guarantee the attribute.

  • src/backend/base/langflow/services/auth/service.py#L688-L698: replace the inline dicts in get_current_active_user/get_current_active_superuser (and the MCP variant at L1119-L1126) with a call to the shared helper.
  • src/backend/base/langflow/api/v1/models.py#L51-L57: replace the inline getattr(...) dict in _resolve_policy (and the duplicate at L196-L201) with the shared helper.
  • src/backend/base/langflow/api/v1/voice_mode.py#L113-L121: replace the inline getattr(...) dict in authenticate_and_get_openai_key with the shared helper.
  • src/backend/base/langflow/services/variable/service.py#L40-L46: replace the principal and principal.is_superuser construction (and the DB lookup it requires) with the shared helper, which can accept an already-loaded principal object.
🤖 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/base/langflow/services/auth/service.py` around lines 688 - 698,
Extract a shared is_superuser attributes-builder in
lfx.services.model_provider_policy that safely accepts a principal object and
returns the policy attributes, then reuse it for all model-provider policy
calls. Update src/backend/base/langflow/services/auth/service.py:688-698 and its
MCP variant at 1119-1126, src/backend/base/langflow/api/v1/models.py:51-57 and
196-201, src/backend/base/langflow/api/v1/voice_mode.py:113-121, and
src/backend/base/langflow/services/variable/service.py:40-46; in the variable
service, remove the redundant database lookup and pass the already-loaded
principal to the helper.
src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx (1)

66-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider page-level test coverage for the new permission-gating behavior.

variableAccess.ts's pure helpers are well covered by variableAccess.test.ts, but the integration in this file (Access/Actions columns, isRowSelectable, keyboard/click gating, selection revalidation effect) has no accompanying test in this PR's file set. If this isn't already covered by an existing Playwright suite outside this batch, consider adding component/integration coverage for the new column rendering and selection-gating behavior.

Based on coding guidelines: "For new frontend implementations or bug fixes, ensure corresponding test files are included ... verify the tests actually cover the new or changed behavior rather than acting as placeholders."

🤖 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/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx`
around lines 66 - 77, Expand test coverage for GlobalVariablesPageContent to
verify permission-gated Access/Actions columns, isRowSelectable behavior,
keyboard and click selection gating, and selection revalidation after permission
changes. Add meaningful component or integration assertions for these behaviors,
reusing existing test utilities or an established Playwright suite rather than
placeholder tests.

Source: Coding guidelines

🤖 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 `@src/backend/base/langflow/api/v1/authz_shares.py`:
- Around line 176-224: Bound the plugin hook awaits in _refresh_policy_for_share
and _remove_policy_for_share with asyncio.wait_for using a named timeout
constant, while preserving the existing exception logging and fallback behavior.
Apply the timeout to authz.sync_share(share_id) and
authz.remove_share_rules(snapshot), ensuring these post-commit hooks cannot
delay the create_share, update_share, or delete_share flows indefinitely.

In `@src/backend/base/langflow/api/v1/endpoints.py`:
- Around line 1561-1565: Update the configuration lifecycle around the Component
instance in the endpoint handler to bind the authenticated user’s policy
attributes with set_current_model_provider_policy_context(...) before calling
require_model_provider_policy(ModelProviderPolicyPurpose.CONFIGURE), and always
reset the returned context token afterward via
reset_current_model_provider_policy_context(...). Add a regression test covering
a superuser to verify policy resolution receives is_superuser=True and permits
configuration.

In `@src/backend/base/langflow/api/v1/voice_mode.py`:
- Line 1261: Ensure the authenticate_and_get_openai_key call passes
client_websocket as its WebSocket argument rather than the client_send closure,
preserving the function’s ability to send authentication or policy failure
responses through the WebSocket.

In `@src/backend/base/langflow/initial_setup/starter_projects/Basic`
Prompting.json:
- Line 1044: Regenerate the serialized code_hash for the embedded
LanguageModelComponent metadata so it matches the updated source. Update the
Language Model node metadata in
src/backend/base/langflow/initial_setup/starter_projects/Basic
Prompting.json:1044-1044, Research Translation Loop.json:1115-1115, and Image
Sentiment Analysis.json:790-790, replacing the stale hash while leaving the
component source and other metadata unchanged.

In `@src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx`:
- Around line 385-397: Update the Space-key branch in the page’s onCellKeyDown
handler to call keyboardEvent.preventDefault() and
keyboardEvent.stopPropagation() before checking canMutateVariable. Keep the
permission check before changing selection so unauthorized Space presses remain
a no-op without triggering browser scrolling.

In `@src/lfx/src/lfx/base/models/provider_registry.py`:
- Around line 655-662: Update uses_standalone_model_provider_policy so only
explicit "delegate" and "none" model_provider_policy_mode values return False;
treat missing, "standalone", and any unknown or misspelled values as standalone
enforcement.

---

Outside diff comments:
In `@src/backend/base/langflow/services/database/models/folder/utils.py`:
- Around line 44-53: Update the UPDATE predicate in the folder reassignment flow
to use Flow.folder_id.is_(None) instead of Python’s “is None” comparison,
matching the nearby SELECT predicate. Preserve the existing Flow.user_id filter
and values assignment so eligible flows receive the folder and workspace IDs.

In `@src/lfx/src/lfx/_assets/component_index.json`:
- Around line 23445-23525: The deployment policy check in
_code_execution_allowed must fail closed when the settings object lacks
allow_custom_components. Change the getattr fallback from permissive to false
(or explicitly reject the missing attribute), preserving fail-open only when the
settings layer cannot be imported; then regenerate the embedded
component_index.json asset and its checksum.

---

Nitpick comments:
In
`@src/backend/base/langflow/alembic/versions/b7d5f9a3c2e4_sync_flow_workspace_from_project.py`:
- Around line 43-56: The migration’s correlated UPDATE rewrites all
project-scoped flow rows in one potentially long-running operation. Replace the
single statement in the migration upgrade logic with bounded keyset batches over
flow.id, preserving the existing folder_id and EXISTS conditions and continuing
until no rows remain; keep workspace_id sourced from the matching folder.

In `@src/backend/base/langflow/services/auth/service.py`:
- Around line 688-698: Extract a shared is_superuser attributes-builder in
lfx.services.model_provider_policy that safely accepts a principal object and
returns the policy attributes, then reuse it for all model-provider policy
calls. Update src/backend/base/langflow/services/auth/service.py:688-698 and its
MCP variant at 1119-1126, src/backend/base/langflow/api/v1/models.py:51-57 and
196-201, src/backend/base/langflow/api/v1/voice_mode.py:113-121, and
src/backend/base/langflow/services/variable/service.py:40-46; in the variable
service, remove the redundant database lookup and pass the already-loaded
principal to the helper.

In `@src/backend/tests/unit/agentic/helpers/test_validation.py`:
- Line 335: Remove the redundant pytest.mark.asyncio decorator from the affected
async test in the validation helpers test module. Leave the test function and
its async behavior unchanged, following the repository’s automatic async-test
detection convention.

In `@src/backend/tests/unit/api/v1/test_authz_audit_schemas.py`:
- Around line 101-220: Replace the fake _Session/_Result setup and SQL-substring
assertions in test_audit_query_filters_and_returns_first_class_actor_fields and
test_unknown_actor_filter_includes_legacy_null_and_explicit_unknown_rows with
the real async database session fixture pattern used by test_authz_models.py.
Seed the relevant audit rows through that session, invoke list_audit_log, and
assert the returned items and ordering directly, preserving coverage for actor
filters including legacy NULL and explicit "unknown" rows.

In `@src/backend/tests/unit/api/v1/test_voice_mode_flow_authz.py`:
- Line 39: Remove the redundant `@pytest.mark.asyncio` decorators from the
affected async tests in this file, including the tests near lines 39 and 69;
rely on the repository’s asyncio_mode = "auto" configuration and preserve the
existing test implementations.

In `@src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx`:
- Around line 66-77: Expand test coverage for GlobalVariablesPageContent to
verify permission-gated Access/Actions columns, isRowSelectable behavior,
keyboard and click selection gating, and selection revalidation after permission
changes. Add meaningful component or integration assertions for these behaviors,
reusing existing test utilities or an established Playwright suite rather than
placeholder tests.

In `@src/lfx/tests/unit/services/model_provider_policy/test_policy.py`:
- Line 157: Remove the redundant `@pytest.mark.asyncio` decorator from the
affected async test; rely on the existing asyncio_mode = "auto" configuration in
pyproject.toml while leaving the test implementation unchanged.
🪄 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

Run ID: 4623dd90-d54f-4d71-b477-e69fb7e498e1

📥 Commits

Reviewing files that changed from the base of the PR and between 24e82b9 and d23024d.

📒 Files selected for processing (73)
  • .secrets.baseline
  • src/backend/base/langflow/agentic/helpers/validation.py
  • src/backend/base/langflow/alembic/versions/a6c4e2f8b1d3_add_authz_audit_actor_identity.py
  • src/backend/base/langflow/alembic/versions/b7d5f9a3c2e4_sync_flow_workspace_from_project.py
  • src/backend/base/langflow/api/v1/authz_audit.py
  • src/backend/base/langflow/api/v1/authz_route_dependencies.py
  • src/backend/base/langflow/api/v1/authz_shares.py
  • src/backend/base/langflow/api/v1/endpoints.py
  • src/backend/base/langflow/api/v1/flows.py
  • src/backend/base/langflow/api/v1/flows_helpers.py
  • src/backend/base/langflow/api/v1/models.py
  • src/backend/base/langflow/api/v1/projects.py
  • src/backend/base/langflow/api/v1/projects_files.py
  • src/backend/base/langflow/api/v1/schemas/authz_roles.py
  • src/backend/base/langflow/api/v1/variable.py
  • src/backend/base/langflow/api/v1/voice_mode.py
  • src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json
  • src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json
  • src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json
  • src/backend/base/langflow/services/auth/service.py
  • src/backend/base/langflow/services/authorization/audit.py
  • src/backend/base/langflow/services/authorization/fetch.py
  • src/backend/base/langflow/services/authorization/listing.py
  • src/backend/base/langflow/services/database/models/auth/authz.py
  • src/backend/base/langflow/services/database/models/folder/utils.py
  • src/backend/base/langflow/services/database/models/variable/model.py
  • src/backend/base/langflow/services/variable/service.py
  • src/backend/tests/performance/test_flow_authz_prefilter_benchmark.py
  • src/backend/tests/unit/agentic/helpers/test_validation.py
  • src/backend/tests/unit/alembic/test_authz_audit_actor_migration.py
  • src/backend/tests/unit/alembic/test_flow_workspace_sync_migration.py
  • src/backend/tests/unit/api/v1/test_authz_admin_routes.py
  • src/backend/tests/unit/api/v1/test_authz_audit_schemas.py
  • src/backend/tests/unit/api/v1/test_authz_share_routes.py
  • src/backend/tests/unit/api/v1/test_flow_folder_integrity.py
  • src/backend/tests/unit/api/v1/test_models_provider_policy.py
  • src/backend/tests/unit/api/v1/test_variable.py
  • src/backend/tests/unit/api/v1/test_voice_mode_flow_authz.py
  • src/backend/tests/unit/services/authorization/test_audit.py
  • src/backend/tests/unit/services/authorization/test_capability_flag.py
  • src/backend/tests/unit/services/authorization/test_fetch.py
  • src/backend/tests/unit/services/authorization/test_flow_route_guards.py
  • src/backend/tests/unit/services/authorization/test_listing_null_owner_prefilter.py
  • src/backend/tests/unit/services/variable/test_service.py
  • src/backend/tests/unit/test_authz_models.py
  • src/backend/tests/unit/test_endpoints.py
  • src/bundles/ibm/src/lfx_ibm/components/ibm/watsonx.py
  • src/bundles/ibm/src/lfx_ibm/components/ibm/watsonx_embeddings.py
  • src/bundles/lfx-bundles/src/lfx_bundles/azure/azure_openai.py
  • src/bundles/lfx-bundles/src/lfx_bundles/azure/azure_openai_embeddings.py
  • src/frontend/src/customization/components/custom-variable-share-action.tsx
  • src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/__tests__/variableAccess.test.ts
  • src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx
  • src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/variableAccess.ts
  • src/frontend/src/types/global_variables/index.ts
  • src/lfx/src/lfx/_assets/component_index.json
  • src/lfx/src/lfx/base/embeddings/model.py
  • src/lfx/src/lfx/base/models/model.py
  • src/lfx/src/lfx/base/models/provider_registry.py
  • src/lfx/src/lfx/components/langchain_utilities/fake_embeddings.py
  • src/lfx/src/lfx/components/models_and_agents/embedding_model.py
  • src/lfx/src/lfx/components/models_and_agents/language_model.py
  • src/lfx/src/lfx/components/models_and_agents/policies_component.py
  • src/lfx/src/lfx/custom/custom_component/component.py
  • src/lfx/src/lfx/custom/utils.py
  • src/lfx/src/lfx/services/authorization/__init__.py
  • src/lfx/src/lfx/services/authorization/base.py
  • src/lfx/src/lfx/services/model_provider_policy/__init__.py
  • src/lfx/src/lfx/services/model_provider_policy/context.py
  • src/lfx/src/lfx/services/model_provider_policy/utils.py
  • src/lfx/tests/unit/base/models/test_provider_registry.py
  • src/lfx/tests/unit/custom/test_utils_metadata.py
  • src/lfx/tests/unit/services/model_provider_policy/test_policy.py

Comment thread src/backend/base/langflow/api/v1/authz_shares.py
Comment thread src/backend/base/langflow/api/v1/endpoints.py
Comment thread src/backend/base/langflow/api/v1/voice_mode.py
Comment thread src/lfx/src/lfx/base/models/provider_registry.py Outdated
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 22, 2026
@erichare
erichare marked this pull request as ready for review July 22, 2026 22:22
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 22, 2026
@erichare

erichare commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the two outside-diff findings in commit e917b02:\n\n- Fixed orphan-flow reassignment to use Flow.folder_id.is_(None), with a real DB regression covering folder/workspace adoption.\n- Made PoliciesComponent fail closed when allow_custom_components is missing, then regenerated the component index and integrity checksum.\n\nAlso applied the low-risk review nits (redundant async markers and focused Global Variables keyboard coverage). I left the migration-batching, shared-helper extraction, and audit-test-harness rewrites out: those are non-functional, substantially broader refactors that are safer as separate follow-ups.\n\nValidation: focused backend suite 64 passed; final share-hook suite 43 passed; isolated LFX suite 69 passed (including both clean-flow upgrade regressions); frontend suite 17 passed; Ruff, Biome, pre-commit, starter-template validation, bundle release plan, and generated hash/checksum checks passed.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.04348% with 155 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.47%. Comparing base (597d05f) to head (e917b02).
⚠️ Report is 2 commits behind head on release-1.12.0.

Files with missing lines Patch % Lines
...s/SettingsPage/pages/GlobalVariablesPage/index.tsx 42.38% 87 Missing ⚠️
src/backend/base/langflow/api/v1/flows.py 33.33% 28 Missing ⚠️
src/lfx/src/lfx/base/models/provider_registry.py 58.62% 9 Missing and 3 partials ⚠️
src/backend/base/langflow/api/v1/flows_helpers.py 54.54% 10 Missing ⚠️
src/backend/base/langflow/api/v1/variable.py 69.23% 4 Missing ⚠️
...zation/components/custom-variable-share-action.tsx 63.63% 4 Missing ⚠️
src/backend/base/langflow/api/v1/models.py 93.10% 2 Missing ⚠️
src/backend/base/langflow/api/v1/projects.py 50.00% 2 Missing ⚠️
src/frontend/src/types/global_variables/index.ts 0.00% 2 Missing ⚠️
src/lfx/src/lfx/services/authorization/base.py 83.33% 2 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.12.0   #14215      +/-   ##
==================================================
- Coverage           61.47%   61.47%   -0.01%     
==================================================
  Files                2339     2342       +3     
  Lines              237145   237682     +537     
  Branches            35410    33330    -2080     
==================================================
+ Hits               145787   146113     +326     
- Misses              89561    89766     +205     
- Partials             1797     1803       +6     
Flag Coverage Δ
backend 69.11% <82.06%> (+0.15%) ⬆️
frontend 59.67% <59.91%> (-0.08%) ⬇️
lfx 60.28% <81.48%> (+0.07%) ⬆️

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

Files with missing lines Coverage Δ
...ackend/base/langflow/agentic/helpers/validation.py 90.00% <100.00%> (+2.50%) ⬆️
src/backend/base/langflow/api/v1/authz_audit.py 88.05% <100.00%> (+31.16%) ⬆️
...d/base/langflow/api/v1/authz_route_dependencies.py 87.80% <100.00%> (-1.94%) ⬇️
src/backend/base/langflow/api/v1/authz_shares.py 91.05% <100.00%> (+2.48%) ⬆️
src/backend/base/langflow/api/v1/endpoints.py 77.43% <100.00%> (+0.32%) ⬆️
...ackend/base/langflow/api/v1/schemas/authz_roles.py 100.00% <100.00%> (ø)
src/backend/base/langflow/api/v1/voice_mode.py 24.38% <100.00%> (+3.23%) ⬆️
src/backend/base/langflow/initial_setup/setup.py 61.32% <100.00%> (-1.38%) ⬇️
src/backend/base/langflow/services/auth/service.py 76.85% <100.00%> (+0.50%) ⬆️
...kend/base/langflow/services/authorization/audit.py 89.93% <100.00%> (+8.73%) ⬆️
... and 24 more

... and 37 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

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 46%
46.96% (67244/143194) 70.03% (9457/13503) 45.53% (1551/3406)

Unit Test Results

Tests Skipped Failures Errors Time
5364 0 💤 0 ❌ 0 🔥 20m 27s ⏱️

@erichare
erichare merged commit 2e677bf into release-1.12.0 Jul 22, 2026
287 of 289 checks passed
@erichare
erichare deleted the fix/release-1.12-rbac-deliverables branch July 22, 2026 23:39
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