fix: correct project_id scoping in get_user_metadata and delete_project#6248
Open
Abhishek8108 wants to merge 1 commit intofeast-dev:masterfrom
Open
fix: correct project_id scoping in get_user_metadata and delete_project#6248Abhishek8108 wants to merge 1 commit intofeast-dev:masterfrom
Abhishek8108 wants to merge 1 commit intofeast-dev:masterfrom
Conversation
get_user_metadata was filtering only by feature view name, allowing a
shared Snowflake registry to return user metadata from a different
project's feature view with the same name. Added project_id = '{project}'
to the WHERE clause, consistent with apply_user_metadata.
delete_project was interpolating a Project object into the SQL string
instead of the project name string, which would use __str__ of the object
rather than the actual name. Changed to use the `name` parameter directly.
Signed-off-by: Abhishek8108 <[email protected]>
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
Two pre-existing SQL correctness bugs in
SnowflakeRegistry, noticed while working on #6243.get_user_metadata(line 1119)The SELECT query filtered only by
{fv_column_name}_name, without scoping toproject_id. The primary key for feature view tables is(feature_view_name, project_id), so in a shared Snowflake registry this could return user metadata from a different project's feature view with the same name. Fixed by addingproject_id = '{project}'to the WHERE clause — consistent withapply_user_metadatawhich already does this correctly.delete_project(line 1326)The DELETE query interpolated
project, which is aProjectobject returned byself.get_project(name).Project.__str__returnsstr(MessageToJson(self.to_proto()))— a JSON blob — which never matches anyproject_idstored in the database. This madedelete_projecta silent no-op: all DELETE statements executed successfully but matched zero rows. Fixed by using thenamestring parameter directly.Testing
Both are SQL correctness fixes. The existing integration test suite in
test_universal_registry.pycovers both methods end-to-end; no new unit test surface is introduced by these changes.Relates to #6243.