WorkScope latest pointer accepts a contract that contradicts its verified bundle
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Leggi src/devostasis/workscope/bundle.py, concentrandoti su latest() alle righe 169–183, e controlla i test esistenti che usano gli helper build() e publish(). Verifica che un puntatore canonico passi, poi cambia solo il suo contratto all’altro valore supportato e verifica che latest() sollevi ScopeError("latest pointer binding mismatch"); un puntatore v1 storico corrispondente dovrebbe continuare a passare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Finding — the WorkScope latest pointer admits a contradictory contract field
Pinned repository source: release/0.6.0@6d935ee111e2efab7a5f7d7c8f8d050af8d35567; src/devostasis/workscope/bundle.py Git blob 2de1ef2b47b983ffad6f45bd32262cb4b8d655b1, latest() lines 169–183; src/devostasis/workscope/__init__.py blob a2cfa113dbc7904c6f0ca7c24ae85f2d749358ed. The source and CONTRIBUTING.md were read on 2026-11-17.
The canonical publish() writes the actual bundle contract into latest.json:
atomic(pointer, canonical_bytes({
"contract": decoded["manifest.json"]["contract"],
"bundle_id": bundle_id,
"manifest_digest": digest_bytes(content["manifest.json"]),
"project": identity(scope["subject"])
}))
latest() only requires data["contract"] in CONTRACTS, which currently includes both devostasis.work.v1 and devostasis.work.v2. It then validates the referenced bundle's digest, ID, project and CANONICAL context, but never compares the pointer's contract to decoded["manifest.json"]["contract"].
Thus a canonical, verified WorkScope v2 bundle can be left untouched while the mutable latest.json pointer is edited to say "contract":"devostasis.work.v1". The pointer remains shape-valid, and every existing binding predicate can pass, despite the pointer falsely naming a different replay contract. devostasis work verify --latest / replay --latest can then report VERIFIED for a pointer with internally contradictory metadata. The immutable bundle still independently verifies; this is a pointer metadata-consistency false acceptance, not proof that the returned bundle's contents are corrupt or that Vital evaluation changes.
Reproduction / verification boundary
An isolated exact-predicate control with both contracts in the actual CONTRACTS tuple produced: allowed-pointer-contract=True; bundle_id-match=True; digest-match=True; project-match=True; canonical-context=True; pointer-contract-equals-manifest-contract=False; the conjunction of all currently enforced predicates was True. This is a source/predicate reproduction, not imported full-package pytest or a live WorkScope CLI invocation.
Focused implementation (no semantic policy change)
Inside latest()'s final binding require, add the missing equality without changing the supported contract set:
require(digest_bytes(content["manifest.json"]) == data["manifest_digest"] and
+ decoded["manifest.json"]["contract"] == data["contract"] and
decoded["manifest.json"]["bundle_id"] == data["bundle_id"] and
identity(decoded["scope.json"]["subject"]) == data["project"] and
decoded["scope.json"]["subject"]["context"] == "CANONICAL", "latest pointer binding mismatch")
This is an implementation-local consistency check: canonical publish() already emits matching fields. It neither changes version dispatch nor the verified bundle's identity/replay.
Acceptance and verification shape
- Build/publish a real canonical WorkScope v2 bundle with the existing
build()/publish()test helpers. Verify thatlatest(root),work verify --latest, andwork replay --latestaccept the unmodified pointer. - Edit only
latest.json["contract"]from the actual v2 value to the other supported v1 value; keepbundle_id,manifest_digest,projectand every immutable bundle byte unchanged. Requirelatest(root)to raiseScopeError("latest pointer binding mismatch"); both CLI variants must fail, never emitVERIFIED. A later canonicalpublish()must not silently promote/rely on the contradictory pointer. - Historical legitimate v1 WorkScope bundles/pointers whose two contracts match must still pass; existing pointer-digest tamper and replay regressions stay green. Add an implementation-local test and docs/conformance citation only if a permanent case ID is introduced.
- Run real offline pytest, bundle replay and installed-wheel verification, plus exact-head CI. Use a focused fix branch targeting
release/0.6.0and independent review before merging.
Deduplication and boundary
Searched open and closed Issues and PRs for "latest.json" "contract", "pointer" "contract", and "latest pointer" "binding". Existing #147 is about the unbounded actual read of latest.json, not a mismatched-but-allowed contract; #146 is about member read budgets. The fix may share a focused release PR with #147 if convenient, but preserve separate test coverage.
Permissions / limits: authenticated andy-zen-dev has pull=true, push=false, triage=false, maintain=false, admin=false. This issue is the actual durable deliverable; no branch, code commit, PR, merge or release is claimed. Full Devostasis pytest/CLI/CI on a fixing commit: NOT_RUN.
- Lingua principale
- Python
- Stelle
- 6
- Fork
- 1
- Merge medio
- 6m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di drevendev/Devostasis
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
drevendev/Devostasis#158 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
drevendev/Devostasis#25 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
drevendev/Devostasis#157 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
drevendev/Devostasis#156 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
drevendev/Devostasis#155 · 9 commenti ·
Tutte le issue di drevendev/Devostasis
Issue simili
-
bug bugfix
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
simplify
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Elko Super TR: temperature stops updating once the thermostat reports its active sensorForse già presa @zigpy-review-bot l’ha presa oggi. Apertabot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
zigpy/zha-device-handlers#5790 ·
I maintainer di solito rispondono entro 1 giorno
-
source defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
mampfes/hacs_waste_collection_schedule#8269 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno