A sync change can modify a channel other than the one it names

Aperta
#6,413 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python

Direzione di ricerca

Start with SyncView.handle_changes in contentcuration/contentcuration/viewsets/sync/endpoint.py, then trace the contentnode create, update, and move handlers that use parent or target. Add tests for changes naming a different channel and run the relevant sync endpoint tests. Done means those mismatched changes are rejected without creating nodes or change records, while valid same-channel changes still work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

DEV: backend

Overview

The sync endpoint checks that the user can edit the channel_id a change names, and records the change under that channel. Nothing checks that the parent or target of a contentnode create, update or move is in that channel. A user who edits two channels can send a change naming channel A that creates a node in channel B, and channel B records no change for it, so its unpublished-changes tracking misses the edit.

Complexity: Medium
Target branch: hotfixes

Context
  • SyncView.handle_changes sorts changes by their channel_id and creates the Change rows with it. The contentnode create, update and move handlers then place the node under whatever parent or target the change gives.
  • Reproduced: an editor of channels A and B sent a contentnode create change with channel_id A and parent set to B's root node. The node was created in B, the Change row was recorded under A, and B had no Change rows.
The Change
  • A contentnode create, update or move change should be rejected when its parent or target isn't in the channel the change names.
Acceptance Criteria
General
  • The reproduced change in Context is rejected with an error, and nothing is created in either channel.
  • Changes whose objects are in the named channel are applied as before.
Testing
  • Tests cover create, update and move changes whose parent or target is in a different channel from the one the change names.

AI usage

I scoped the audit. Claude Code found and reproduced this failure and drafted this issue.

Lingua principale
Python
Stelle
212
Fork
321
Merge medio
1g 7h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di learningequality/studio

Tutte le issue di learningequality/studio

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.