Skip to content

fix: Enforce required_tags and lineage RBAC, and store BatchFeatureView UDF changes - #7191

Merged
ntkathole merged 4 commits into
feast-dev:masterfrom
patelchaitany:fix/permission-tags-lineage-rbac-bfv-udf
Nov 23, 2026
Merged

ntkathole merged 4 commits into
feast-dev:masterfrom
patelchaitany:fix/permission-tags-lineage-rbac-bfv-udf

Conversation

@patelchaitany

@patelchaitany patelchaitany commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

I was testing RBAC in the Feast UI with a real OIDC login and ran into a few holes, plus one feast apply bug.

What was wrong

  • required_tags on a Permission was never checked. The matcher looked for resource.required_tags, which resources don't have, so a "team=risk only" permission matched everything.
  • With that fixed, listing resources under a tag-only permission failed with a 403, because list filtering only skipped out-of-scope resources for name_patterns. It now does the same for required_tags.
  • Lineage RBAC failed open. A user allowed no projects (or whose permission check errored) got None, which means "no filter", so they saw every namespace. Fixed in the lineage server, the REST API that feast ui uses, and the lineage store.
  • feast apply didn't store BatchFeatureView UDF changes on the file registry. The change check never compared the UDF, and BatchFeatureView.from_proto dropped it.

Before / after

Top: risk-analyst may only see resources tagged team=risk. Bottom: intern has no permissions and opens Lineage.

feast-rbac-before-after

Tests

One unit test per fix, and each one fails without its fix.


Devin Review

@patelchaitany
patelchaitany requested a review from a team as a code owner November 20, 2026 10:03

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

from feast.batch_feature_view import BatchFeatureView
# BatchFeatureView.from_proto must restore the transformation too, or
# `feast apply` compares a new UDF against a stored copy that has none.
if has_transformation and cls in (FeatureView, BatchFeatureView):

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.

🔴 Reapplied batch views crash during deserialization

Reapplying SQL or Flink batch views through Registry.apply_feature_view now raises AttributeError. Neither SQLTransformation nor FlinkTransformation implements from_proto, and the dispatch only catches ValueError and KeyError. Even unchanged definitions cannot be reapplied.

Learn more

The file registry calls the incoming view's concrete class to restore an existing definition before comparing changes in Registry.apply_feature_view. Previously, BatchFeatureView bypassed transformation reconstruction there. The expanded condition now dispatches restoration through the mode-specific class selected by get_transformation_class_from_type. SQLTransformation and FlinkTransformation have no from_proto, including through their Transformation base. Calling that missing method raises AttributeError, which escapes the existing exception handler; Spark wrappers have the same missing deserializer.

Example: Apply a BatchFeatureView with a FileSource, an explicit schema, mode="sql", and a SQL-producing UDF through Registry.apply_feature_view. Applying the identical definition again enters transformation restoration and raises AttributeError: type object 'SQLTransformation' has no attribute 'from_proto'.

Recommended fix: Provide mode-preserving deserialization for every supported transformation wrapper before routing BatchFeatureView restoration through this dispatch. Add round-trip and repeated-apply tests for SQL and Flink, and cover Spark when its dependencies are available. Simply swallowing AttributeError or discarding the transformation would leave the persisted definition incorrect.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 70.37037% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.04%. Comparing base (3ece12f) to head (3c16720).

Files with missing lines Patch % Lines
sdk/python/feast/batch_feature_view.py 60.00% 6 Missing and 4 partials ⚠️
sdk/python/feast/lineage_server.py 0.00% 5 Missing ⚠️
sdk/python/feast/api/registry/rest/__init__.py 20.00% 4 Missing ⚠️
sdk/python/feast/permissions/matcher.py 66.66% 2 Missing and 1 partial ⚠️
sdk/python/feast/permissions/enforcer.py 50.00% 0 Missing and 1 partial ⚠️
...ython/feast/transformation/spark_transformation.py 80.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7191      +/-   ##
==========================================
+ Coverage   53.82%   54.04%   +0.22%     
==========================================
  Files         462      466       +4     
  Lines       58639    58870     +231     
  Branches     8651     8671      +20     
==========================================
+ Hits        31562    31819     +257     
+ Misses      24938    24902      -36     
- Partials     2139     2149      +10     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 55.65% <70.37%> (+0.23%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/feature_view.py 87.98% <100.00%> (ø)
sdk/python/feast/openlineage/consumer.py 67.14% <100.00%> (+4.27%) ⬆️
sdk/python/feast/openlineage/store.py 87.04% <100.00%> (+0.63%) ⬆️
sdk/python/feast/transformation/base.py 77.35% <100.00%> (+2.35%) ⬆️
...ython/feast/transformation/flink_transformation.py 50.00% <100.00%> (+8.33%) ⬆️
.../python/feast/transformation/sql_transformation.py 100.00% <100.00%> (ø)
sdk/python/feast/permissions/enforcer.py 72.91% <50.00%> (ø)
...ython/feast/transformation/spark_transformation.py 62.50% <80.00%> (+1.78%) ⬆️
sdk/python/feast/permissions/matcher.py 90.16% <66.66%> (+1.45%) ⬆️
sdk/python/feast/api/registry/rest/__init__.py 62.57% <20.00%> (+25.53%) ⬆️
... and 2 more

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ece12f...3c16720. Read the comment docs.

🚀 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.

@franciscojavierarceo franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to handle source-less UDF changes and the remaining graph symlink disclosure before merging.

Comment thread sdk/python/feast/batch_feature_view.py Outdated
# text, or the bytecode when there is no source text.
if new.udf_string and old.udf_string:
return new.udf_string != old.udf_string
return new.udf.__code__.co_code != old.udf.__code__.co_code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

co_code excludes constants and captured values. with the default empty udf_string, SQL UDFs lambda _: "SELECT 1" and lambda _: "SELECT 2" have the same bytecode, so this reports no change and Registry.apply_feature_view takes its metadata-only return, retaining the old query. we need a comparison that includes the callable's relevant constants, defaults and closure state, plus a repeated-apply regression without source text.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. The same co_code-only fallback is already in the other transformations' eq and in the stream view check, so would you be okay with me fixing it for all types (consts, defaults, closures) in a follow-up PR rather than only here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can handle the other transformation types in a follow-up. we need the new BatchFeatureView comparison here to detect constants, defaults and closures, with an empty-udf_string repeated-apply regression; otherwise the apply bug this PR fixes still leaves changed SQL UDFs stored unchanged.

@@ -513,7 +513,8 @@ def _get_namespace_filter(ns_callable) -> Optional[List[str]]:
try:
return ns_callable()
except Exception:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

returning [] still leaves a lineage read path open: get_full_lineage_graph calls store.get_all_symlinks() without a namespace filter, returns those records and appends them to edges. a user with no allowed projects, including a failed permission check, can still read dataset names and namespaces from other teams through /lineage/openlineage/graph. we need to filter symlinks by authorized endpoints and cover this endpoint with denied-access and mixed-namespace regressions.

@franciscojavierarceo franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the CI type-check failure also needs a code change in the new deserialization API.

Comment thread sdk/python/feast/transformation/base.py Outdated

@classmethod
def from_proto(
cls, user_defined_function_proto: UserDefinedFunctionProto

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the full type check now fails because this inherited from_proto contract takes UserDefinedFunctionV2, while SubstraitTransformation.from_proto overrides it with SubstraitTransformationV2: CI reports an incompatible override. we need an override-compatible deserialization contract for these distinct proto types so the existing Substrait implementation and the new SQL/Flink restoration both pass type checking.

…ew UDF changes

- Match Permission.required_tags against resource.tags. The matcher read a
  required_tags attribute that resources do not have, so tag-scoped
  permissions matched every resource. List filtering now also skips
  resources outside a tag-scoped permission instead of failing the list.
- Lineage RBAC no longer fails open: when a user is allowed no namespaces,
  or the permission check errors, lineage is hidden instead of showing every
  namespace. Fixed in the lineage server, the REST API that feast ui uses,
  and the lineage store, where an empty list now means "nothing".
- feast apply now detects BatchFeatureView UDF changes, and
  BatchFeatureView.from_proto restores the transformation, so the file
  registry stores the new UDF instead of keeping the old one.

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
SQLTransformation and FlinkTransformation had no from_proto, so reading a
SQL or Flink BatchFeatureView from the registry raised AttributeError, and
since BatchFeatureView.from_proto now restores the transformation,
re-applying one did too. Add a mode-preserving from_proto to the base
Transformation, and compare SQL and Flink UDFs by source text so an
unchanged re-apply stays a metadata-only update.

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
…roto typing

- /lineage/openlineage/graph returned every dataset symlink and kept edges
  with only one end in an allowed namespace, so a user without access
  could still read other teams' dataset names and namespaces. With RBAC on,
  symlinks and edges are now returned only when both ends are in
  namespaces the caller may see.
- The base Transformation.from_proto clashed with SubstraitTransformation's
  override (different proto type) and failed the type check. Move the shared
  UDF restore into udf_transformation_from_proto and give SQL, Flink and
  Spark their own from_proto that calls it.

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
With an empty udf_string, the change check compared only co_code, which
leaves out constants, default arguments and closure values. So
`lambda _: "SELECT 1"` and `lambda _: "SELECT 2"` looked the same,
feast apply took the metadata-only path and kept the old query. Compare
the whole code object (which includes constants), the defaults and the
closure values instead, and add an empty-udf_string re-apply regression.

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
@ntkathole
ntkathole force-pushed the fix/permission-tags-lineage-rbac-bfv-udf branch from 60d6fc1 to 3c16720 Compare November 22, 2026 13:18
@ntkathole
ntkathole merged commit 5773d49 into feast-dev:master Nov 23, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants