api: branches/create ignores expected_target_sha, so a guarded create or move can overwrite a branch

Offen
#803 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@ThomasK33 arbeitet bereits daran.

Seit 12.11.2026.

  • #811 von @ThomasK33 — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
go

Rechercherichtung

Start with the POST /repos/branches/create decoder and the persistent and ephemeral branch creation paths, then trace the existing ref_guard_failed problem path (refGuardProblem). Add tests for all five guard cases on each of the three stores, including force with a stale guard; the issue asks to dogfood with SDK 0.1.2. Done means every case matches the documented spec and the guard prevents branch changes on failure.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Problem

Spec 5d8e1801 documents expected_target_sha on POST /repos/branches/create (and v1): 40 zeros means the branch must not exist yet, a tip value guards a move, and a failed guard answers 409 and leaves the branch alone, "even with force". SDK 0.1.1 and later send it.

open.storage has no such field and its decoder ignores unknown fields. Live on a node at 3af232d9: a forced create with a stale guard answered 200 and moved the branch, and a non-zero guard on a missing branch created it. A client that relies on the guard loses its branch tip.

Desk decision

Implement the guard exactly as the spec documents, reusing the existing ref_guard_failed problem path (refGuardProblem), on the persistent and ephemeral forms. Test every case on all three stores: zeros on a new branch, zeros on an existing branch, correct tip, stale tip, force with a stale guard. Dogfood with the real SDK 0.1.2. Not breaking (it accepts a new field).

Severity

High: silent branch overwrite for a client that sends the documented guard.

Upstream audit 2026-11-12, evidence 2026-11-12-1159UTC. Docs spec 5d8e1801 (ETag W/"8GUlAlKU8eko7Rr2", Last-Modified 2026-11-10 22:29:59 GMT). The cluster still serves ee8092bf, so this is documented drift, not a proven deployment (#234 rule: adopt what the docs publish). SDK 0.1.1 (Nov 10) and 0.1.2 (Nov 11) shipped on npm, PyPI and Go; their route list and token minting are unchanged from 0.1.0.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: medium

Vorherrschende Sprache
Go
Sterne
0
Forks
0
Ø Merge
6 Std. 16 Min.
Gemergte PRs (30 T.)
243

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus coder/openstorage

Alle Issues in coder/openstorage

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.