fix: Add project_id filter to SnowflakeRegistry UPDATE path#6243
Open
Abhishek8108 wants to merge 2 commits intofeast-dev:masterfrom
Open
fix: Add project_id filter to SnowflakeRegistry UPDATE path#6243Abhishek8108 wants to merge 2 commits intofeast-dev:masterfrom
Abhishek8108 wants to merge 2 commits intofeast-dev:masterfrom
Conversation
d1458cf to
7a9cf1f
Compare
_apply_object had a missing project_id clause in the UPDATE branch's WHERE condition. In a shared Snowflake registry, this allowed a feast apply in one project to silently overwrite a same-named object belonging to a different project. The SELECT path already scoped correctly by project_id. The DELETE path (_delete_object) also scoped correctly. This commit brings the UPDATE path in line with both. Fixes feast-dev#6208 Signed-off-by: Abhishek8108 <87538407+Abhishek8108@users.noreply.github.com>
7a9cf1f to
13f6fc0
Compare
Member
|
@Abhishek8108 please fix linting and if possible, consider adding test case for a cross-project isolation scenario. |
…stry UPDATE - Reformat with-statement blocks to parenthesized form (ruff format) - Add test_apply_object_does_not_overwrite_sibling_project: simulates two projects sharing a registry, applies an object to project_b, and asserts the UPDATE WHERE clause is scoped to project_b and does not reference project_a — direct regression coverage for feast-dev#6208 Signed-off-by: Abhishek8108 <87538407+Abhishek8108@users.noreply.github.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
Fixes #6208.
SnowflakeRegistry._apply_objecthad a missingproject_idclause in the UPDATE branch's WHERE condition. In a shared Snowflake registry, this allowed afeast applyin one project to silently overwrite a same-named object belonging to a different project.Root cause: The helper has two SQL branches:
WHERE project_id = '{project}' AND {id_field} = '{name}'project_id:WHERE {id_field} = '{name}'The fix brings the UPDATE path in line with the SELECT and DELETE paths, which already scoped by
project_idcorrectly.Impact: Affects all resource types routed through
_apply_object— entities, data sources, feature views, feature services, saved datasets, validation references, permissions, and infrastructure objects.Changes
sdk/python/feast/infra/registry/snowflake.py— addproject_id = '{project}' ANDto the UPDATE WHERE clause (one line)sdk/python/tests/unit/infra/registry/test_snowflake_registry.py— new regression test; mocks the Snowflake connection, drives_apply_objectinto the UPDATE path, and assertsproject_idappears in the WHERE clauseTest plan
pytest sdk/python/tests/unit/infra/registry/test_snowflake_registry.py -vpytest sdk/python/tests/unit/infra/registry/ -vWHERE project_id = '{project}' AND {id_field} = '{name}'