Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Enable non breaking migration of schema representation #796

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lamindb_setup/_schema_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@


def _synchronize_schema(client: Client) -> tuple[bool, UUID, dict]:
# To be removed after migration
from ._schema_metadata_legacy import _get_legacy_schema_json

schema_metadata = _SchemaHandler()
schema_metadata_dict = schema_metadata.to_json()
schema_uuid = _dict_to_uuid(schema_metadata_dict)
Expand All @@ -48,6 +51,7 @@
"module_ids": module_ids,
"module_set_info": module_set_info,
"schema_json": schema_metadata_dict,
"json": _get_legacy_schema_json(), # To be removed after migration
}
)
.execute()
Expand Down Expand Up @@ -80,8 +84,8 @@

def _dict_to_uuid(dict: dict):
encoded = json.dumps(dict, sort_keys=True).encode("utf-8")
hash = hashlib.md5(encoded).digest()

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic hashing algorithm on sensitive data High

Sensitive data (id)
is used in a hashing algorithm (MD5) that is insecure.
Sensitive data (id)
is used in a hashing algorithm (MD5) that is insecure.
Sensitive data (id)
is used in a hashing algorithm (MD5) that is insecure.
Sensitive data (id)
is used in a hashing algorithm (MD5) that is insecure.
uuid = UUID(bytes=hash[:16])
uuid = UUID(bytes=hash[::-1])
return uuid


Expand Down
Loading
Loading