No retyped owner once the team is seeded, unless a stopgap allowlist needs one
Fable's re-check of P2-2: a retype made the owner held again, and ownOnlyFits could not tell it from Home's confirmed address. Retype is now refused after the seed unless an active app is a stopgap allowlist (none exist); before the seed it still goes back through Home's credential confirm. A held owner is therefore always the one Home confirmed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+38
−6
internal/web/app.go+8 −6internal/web/web_test.go+12 −0internal/web/words.go+1 −0provision/apps.go+17 −0
CI cancelled — superseded by a newer push — run details
diff --git a/internal/web/app.go b/internal/web/app.go| index 0535a33..bb13958 100644 |
| --- a/internal/web/app.go |
| +++ b/internal/web/app.go |
| @@ -481,12 +481,7 @@ func (a *App) team(w http.ResponseWriter, r *http.Request) { |
| // An app whose recipe still writes the owner (a stopgap allowlist) is |
| // the only reason to ask for the address again once the team is at |
| // Home. With every app in roster mode there is none. |
| - needsOwner := false |
| - for app, st := range t.Apps { |
| - if spec, ok := provision.AppBySlug(app); ok && st == "active" && provision.NeedsOwner(spec) { |
| - needsOwner = true |
| - } |
| - } |
| + needsOwner := provision.RetypeAllowed(t.Apps) |
| notice := "" |
| if code := r.URL.Query().Get("audit"); knownCode(code) { |
| notice = describe(code) |
| @@ -550,6 +545,13 @@ func (a *App) retypeOwner(w http.ResponseWriter, r *http.Request) { |
| } |
| _ = r.ParseForm() |
| addr := strings.TrimSpace(r.PostForm.Get("owner")) |
| + // Before the seed, a retyped owner goes back through Home's credential |
| + // confirm on the resumed create-team; after it, only a stopgap |
| + // allowlist may take one (RetypeAllowed). |
| + if t.TeamSQID != "" && !provision.RetypeAllowed(t.Apps) { |
| + http.Redirect(w, r, "/teams/"+t.Label+"?audit=owner-retype-refused", http.StatusSeeOther) |
| + return |
| + } |
| if !homeop.OwnerAddress(addr) { |
| http.Redirect(w, r, "/teams/"+t.Label+"?audit=owner-shape", http.StatusSeeOther) |
| return |
diff --git a/internal/web/web_test.go b/internal/web/web_test.go| index 688ad66..1cb19e5 100644 |
| --- a/internal/web/web_test.go |
| +++ b/internal/web/web_test.go |
| @@ -318,6 +318,18 @@ func TestRefusedOwnerLeadsToTheOwnerForm(t *testing.T) { |
| if got, _, _ := f.store.Owner(context.Background(), "lagged"); got != owner { |
| t.Fatal("retyped owner not held") |
| } |
| + // Once the team is seeded at Home, no app takes a retyped owner: a |
| + // seeded app's owner is only ever the address Home confirmed. |
| + if err := f.store.SetSeeded(context.Background(), "lagged", 1, "Uk", 1, "g", "pr_x", nil); err != nil { |
| + t.Fatal(err) |
| + } else { |
| + if w := f.do("POST", "/teams/lagged/owner", url.Values{"owner": {"someone-else@lagged.test"}}, sameOrigin); w.Code != 303 || !strings.Contains(w.Header().Get("Location"), "audit=owner-retype-refused") { |
| + t.Fatalf("retype after the seed: %d %s", w.Code, w.Header().Get("Location")) |
| + } |
| + if got, _, _ := f.store.Owner(context.Background(), "lagged"); got != owner { |
| + t.Fatal("a retype after the seed replaced the owner") |
| + } |
| + } |
| // A code Alta never produced is not shown as if Alta said it. |
| if page := f.do("GET", "/teams/lagged?audit=Your+account+is+suspended", nil, nil).Body.String(); strings.Contains(page, "suspended") { |
| t.Fatal("an arbitrary audit code was reflected") |
diff --git a/internal/web/words.go b/internal/web/words.go| index 3f366e5..a30daaf 100644 |
| --- a/internal/web/words.go |
| +++ b/internal/web/words.go |
| @@ -65,6 +65,7 @@ var words = map[string]string{ |
| "app-own-only": "Equipo and Base are for your own teams only: choose the own profile, or leave them out", |
| "label-too-long-for-base": "Base needs a label of 19 characters or fewer", |
| "base-needs-team-apps": "Base comes last: the team needs every other app, Equipo included, before Base is added", |
| + "owner-retype-refused": "No app on this team needs the owner's address again, so Alta takes no retyped one", |
| "owner-forgotten-seeded": "Alta no longer holds this team's owner, and Equipo and Base write it: create them with the team instead", |
| "probe-mode-mismatch": "The app's /api/team answers in a mode this recipe was not written for", |
| "name-shape": "Give the team a name", |
diff --git a/provision/apps.go b/provision/apps.go| index 5d9bc5d..b6fb79a 100644 |
| --- a/provision/apps.go |
| +++ b/provision/apps.go |
| @@ -789,3 +789,20 @@ func freshKey() string { |
| } |
| return base64.StdEncoding.EncodeToString(b) |
| } |
| + |
| +// RetypeAllowed reports whether Paul may retype a forgotten owner address |
| +// for a team with these apps (name → active|retired). Only a stopgap |
| +// allowlist still needs one (none since every app has roster mode). A |
| +// seeded app's owner is never retyped: the address Home confirmed at |
| +// create-team is the only one a seeded recipe may write, and a retyped |
| +// address, checked for shape alone, would make someone else its owner |
| +// (team-bundle, Fable's whole-branch review P2-2). With retype refused, |
| +// a held owner is always Home's confirmed one. |
| +func RetypeAllowed(apps map[string]string) bool { |
| + for slug, st := range apps { |
| + if app, ok := AppBySlug(slug); ok && st == "active" && NeedsOwner(app) && !app.Seeded { |
| + return true |
| + } |
| + } |
| + return false |
| +} |