feat(etl): enforce immutable field set on track/playlist update (parity 2D)#245
Open
raymondjacobson wants to merge 1 commit intoetl/parity-2c-pending-routesfrom
Open
feat(etl): enforce immutable field set on track/playlist update (parity 2D)#245raymondjacobson wants to merge 1 commit intoetl/parity-2c-pending-routesfrom
raymondjacobson wants to merge 1 commit intoetl/parity-2c-pending-routesfrom
Conversation
…ty 2D) Stack 2D. Adds the immutable_fields / immutable_track_fields / immutable_playlist_fields sets from apps/packages/discovery-provider/src/tasks/metadata.py and applies them in track_update + playlist_update before merging metadata. Immutable on Update: - common: blocknumber, blockhash, txhash, created_at, updated_at, slot, metadata_multihash, is_current, is_delete - tracks add: track_id, owner_id, is_available, ddex_app - playlists add: playlist_id, playlist_owner_id, is_album, ddex_app stripImmutableFields() deletes these keys from params.Metadata in place before mergeTrackFromMetadata / mergePlaylistFromMetadata sees them. Tests: unit test for the strip helper; DB-backed test that an Update trying to mutate owner_id leaves it unchanged (while title still mutates); DB-backed test that is_album cannot be flipped after create. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
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
Stack 2D. Adds apps' `immutable_fields` / `immutable_track_fields` / `immutable_playlist_fields` sets and applies them in track_update + playlist_update before merging metadata. Without this, a malicious or buggy client could rewrite `owner_id`, `track_id`, `is_album`, etc. via an Update.
Immutable on Update (mirrors apps' metadata.py):
`stripImmutableFields()` deletes these keys from `params.Metadata` before `mergeTrackFromMetadata` / `mergePlaylistFromMetadata` runs.
Stack context
Stacked on #244 (2C — same-block route audit).
Test plan
🤖 Generated with Claude Code