carlos / platform Public

console: CLI pipeline write is owner-only until CLI step-up (H4-M10)

A member's bearer could PUT a one-channel stable pipeline onto a legacy
app and then promote to stable, around the owner-plus-passkey gate that
applies only while the app has no pipeline. The browser save asks every
member for a passkey; the CLI cannot do step-up yet, so per the ruling
the CLI door holds the owner gate instead (apiOwnerOnly). Step-up for it
is owed to the H4-M9 design.

Carries the hunt test TestHunt_H4_M10_PipelineCannotBypassLegacyStableGate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev fd53eaa3f2b77059e8f10248299680717d78b0a1 parent 3c7897e
2 files changed, +47 −0
  • internal/console/apipipeline.go +8 −0
  • internal/console/hunt_H4-M10_test.go +39 −0
diff --git a/internal/console/apipipeline.go b/internal/console/apipipeline.go
index e22d172c1..8daae31a2 100644
--- a/internal/console/apipipeline.go
+++ b/internal/console/apipipeline.go
@@ -106,6 +106,14 @@ func (s *Server) handleAPIPipelinePut(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
+ // The browser's save asks a passkey of every member
+ // (handlePipelineSettingsSave). The CLI has no step-up yet, so this
+ // door holds the owner instead: a pipeline written here can take a
+ // legacy app's stable rung out from under the owner-plus-passkey
+ // promote gate (H4-M10).
+ if !s.apiOwnerOnly(w, r, acct, "change an app's pipeline") {
+ return
+ }
principal, _ := principalFrom(r.Context())
if !s.allowWrite(principal, time.Now()) {
jsonError(w, http.StatusTooManyRequests, "too many requests — wait a minute and try again")
diff --git a/internal/console/hunt_H4-M10_test.go b/internal/console/hunt_H4-M10_test.go
new file mode 100644
index 000000000..8590db049
--- /dev/null
+++ b/internal/console/hunt_H4-M10_test.go
@@ -0,0 +1,39 @@
+package console
+
+import (
+ "context"
+ "net/http"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/release"
+)
+
+func TestHunt_H4_M10_PipelineCannotBypassLegacyStableGate(t *testing.T) {
+ fx, member := huntInstanceFixture(t, "hunt-m10")
+ shipVersion(t, fx, "titogo", "abc1234")
+ shipVersion(t, fx, "titogo", "def5678")
+ if err := release.Promote(context.Background(), fx.rel, fx.priv, fx.sqid, "titogo", "stable", "def5678"); err != nil {
+ t.Fatal(err)
+ }
+ base := fx.ts.URL + "/api/cli/apps/bab/titogo"
+ body := map[string]string{"version": "abc1234", "channel": "stable"}
+ if code, out := postJSON(t, base+"/promote", body, member); code != http.StatusForbidden {
+ t.Fatalf("legacy stable control: %d %v", code, out)
+ }
+ code, out := putJSON(t, base+"/pipeline", map[string]any{"channels": []map[string]any{{"name": "stable"}}}, member)
+ if code == http.StatusForbidden || code == http.StatusNotFound {
+ return
+ }
+ if code != http.StatusOK {
+ t.Fatalf("pipeline setup: %d %v", code, out)
+ }
+ code, out = postJSON(t, base+"/promote", body, member)
+ cp, err := release.Channel(context.Background(), fx.rel, fx.pub, fx.sqid, "titogo", "stable")
+ if code != http.StatusForbidden || err != nil || cp.Version != "def5678" {
+ version := ""
+ if cp != nil {
+ version = cp.Version
+ }
+ t.Errorf("pipeline bypassed legacy stable passkey gate: promote_status=%d signed_pointer_version=%q verify_error=%v; want 403 and original def5678 pointer; response=%v", code, version, err, out)
+ }
+}