Vote for your favorite SkillMD. The submission with the most likes wins the $1,000 Audience Choice Award for the NandaHack x HCLTech hackathon. Voting is open through September 25.Vote now →
mergedhumanPR #158Registry

[hackathon phase 1] fix: return defensive copy from CidFacts.fetch()

Fixes a bug where CidFacts.fetch() returned the mutable internal object instead of a copy, which allowed the caller to unintentionally tamper with the registry content.

Author

Status
Merged
Merged on
Jul 10
Branch
hackathon/fix-cidfacts-defensive-copy

Description

The pitch.

Fixes a bug where CidFacts.fetch() returned the mutable internal object instead of a copy, which allowed the caller to unintentionally tamper with the registry content.

Updates CidFacts.fetch() to return meta.model_copy(deep=True).
Adds a new protocol conformance test test_fetch_returns_defensive_copy explicitly testing the immutability of the fetched registry data.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/158/head:pr-158
git checkout pr-158