WorkScope latest pointer accepts a contract that contradicts its verified bundle

オープン 初心者向け
#148 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend, security

調査の方向性

src/devostasis/workscope/bundle.pyを読み、169~183行目のlatest()に注目し、build()とpublish()ヘルパーを使用する既存のテストを確認します。正規ポインターが通ることを確認したら、その契約だけをもう一方のサポート対象の値に変更し、latest()がScopeError("latest pointer binding mismatch")を送出することを検証します。一致する過去のv1ポインターは引き続き通るはずです。

索引モデルが issue の本文から書いたものです。

説明

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
  1. Build/publish a real canonical WorkScope v2 bundle with the existing build()/publish() test helpers. Verify that latest(root), work verify --latest, and work replay --latest accept the unmodified pointer.
  2. Edit only latest.json["contract"] from the actual v2 value to the other supported v1 value; keep bundle_id, manifest_digest, project and every immutable bundle byte unchanged. Require latest(root) to raise ScopeError("latest pointer binding mismatch"); both CLI variants must fail, never emit VERIFIED. A later canonical publish() must not silently promote/rely on the contradictory pointer.
  3. 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.
  4. Run real offline pytest, bundle replay and installed-wheel verification, plus exact-head CI. Use a focused fix branch targeting release/0.6.0 and 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.

主要言語
Python
スター
6
フォーク
1
平均マージ
6分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

drevendev/Devostasis のほかの issue

drevendev/Devostasis の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。