WorkScope latest pointer accepts a contract that contradicts its verified bundle
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Read src/devostasis/workscope/bundle.py, focusing on latest() lines 169–183, and inspect the existing tests that use the build() and publish() helpers. Confirm that a canonical pointer passes, then change only its contract to the other supported value and verify latest() raises ScopeError("latest pointer binding mismatch"); a matching historical v1 pointer should still pass.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 6
- Forks
- 1
- Avg merge
- 6m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from drevendev/Devostasis
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
drevendev/Devostasis#158 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
drevendev/Devostasis#25 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
drevendev/Devostasis#157 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
drevendev/Devostasis#156 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
drevendev/Devostasis#155 · 9 comments ·
All issues in drevendev/Devostasis
Similar issues
-
bug bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
simplify
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Elko Super TR: temperature stops updating once the thermostat reports its active sensorPossibly taken @zigpy-review-bot claimed this today. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
zigpy/zha-device-handlers#5790 ·
Maintainers usually reply within 1 day
-
source defect
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
mampfes/hacs_waste_collection_schedule#8269 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day