Read-only replay of a recorded Gatecrasher run against a self-hosted Flagsmith lab · buttons are disabled · install it to run it on your own Flagsmith

Fix plans

Every change to Flagsmith waits here for a person. Review what changes, why, and what could break, then approve, reject or roll back.

Build plans from a report

Assign identifiers on the server for pricing_page on Production

pending PRODUCTION

Plan plan-44408bad · Production · identifiers:pricing_page · hash 0a4c2f5e707f · created

What changes

Draft a pull request to assign Flagsmith identifiers on the server (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Assign visitor identifier on the server so users can't pick their experiment group

## Problem

The `pricing_page` price test buckets visitors by identifier. The identifier was generated in the browser (`crypto.randomUUID()`) and stored in a cookie that JavaScript could write. Anyone could change `acme_visitor` or re-roll it until they landed in `price_low`. The scan reproduced this: about half of arbitrary identifiers get `price_low`.

## Fix

- `main.go`: new `GET /api/session` endpoint. It reads the `acme_visitor` cookie and accepts it only if it matches the format the server issues (`visitor-` followed by 32 hex characters). Otherwise it generates a new identifier with `crypto/rand` and sets it as an `HttpOnly`, `SameSite=Lax` cookie, with `Secure` when served over TLS. It returns `{"identifier": ...}`.
- `app.js`: `visitorId()` now fetches the identifier from `/api/session` instead of generating it and writing the cookie. The browser can no longer create or overwrite the identifier through `document.cookie`.

Cookies set earlier by the browser don't match the new format, so those visitors get a new server-assigned identifier once and then keep it.

## Limits (please read)

- The identifier is still passed to the Flagsmith client SDK, and the client-side environment key is public by design. A determined user can still call the Flagsmith API directly with any identifier. This change stops casual tampering through the app's cookie but does not fully prevent it.
- To close it completely, evaluate `pricing_page` on the server for the server-assigned identifier (using the server-side key) and send only the resulting price to the page. That is a larger change, so it is not part of this PR.
- The `plan` trait is still set from the browser. That is a separate finding and is untouched here.

## Testing

- Load `/` with no cookies and confirm an `acme_visitor` cookie is set with the `HttpOnly` flag.
- Confirm `document.cookie` does not show `acme_visitor`.
- Reload and confirm the same identifier and variant are kept.
- Send a request with a forged `acme_visitor` value and confirm `/api/session` replaces it.

Proposed change (a suggestion to review; Gatecrasher never applies it):

--- a/app.js+++ b/app.js@@ -10,15 +10,11 @@   return hit ? decodeURIComponent(hit.split("=")[1]) : null; } -// Each visitor gets a random browser-generated ID kept in a cookie.-function visitorId() {-  let id = cookie("acme_visitor");-  if (!id) {-    id = "visitor-" + crypto.randomUUID();-    document.cookie = "acme_visitor=" + id + "; path=/; max-age=31536000; SameSite=Lax";-  }-  return id;-}+// The server assigns the visitor ID (HttpOnly cookie); the browser only reads it back.+async function visitorId() {+  const res = await fetch("/api/session", { credentials: "same-origin" });+  return (await res.json()).identifier;+}  function show(id, visible) {   document.getElementById(id).hidden = !visible;@@ -45,7 +41,7 @@ }  async function main() {-  const id = visitorId();+  const id = await visitorId();   document.getElementById("visitor").textContent = id;   const plan = cookie("acme_plan") || "free";   document.getElementById("plan").value = plan;--- a/main.go+++ b/main.go@@ -8,6 +8,8 @@ import ( 	"bufio" 	"context"+	"crypto/rand" 	"embed"+	"encoding/hex" 	"encoding/json" 	"errors"@@ -60,9 +62,49 @@ 	mux.HandleFunc("GET /{$}", s.serveAsset("index.html", "text/html; charset=utf-8", false)) 	mux.HandleFunc("GET /app.js", s.serveAsset("app.js", "text/javascript; charset=utf-8", true)) 	mux.HandleFunc("GET /api/checkout-config", s.checkoutConfig)+	mux.HandleFunc("GET /api/session", s.session) 	return mux } +// session returns the visitor identifier, assigning one server-side on the+// first visit. The identifier lives in an HttpOnly cookie, so the browser+// cannot choose or re-roll it by writing document.cookie.+func (s *shop) session(w http.ResponseWriter, r *http.Request) {+	id := ""+	if c, err := r.Cookie("acme_visitor"); err == nil && validVisitorID(c.Value) {+		id = c.Value+	}+	if id == "" {+		buf := make([]byte, 16)+		if _, err := rand.Read(buf); err != nil {+			http.Error(w, "cannot assign visitor id", http.StatusInternalServerError)+			return+		}+		id = "visitor-" + hex.EncodeToString(buf)+		http.SetCookie(w, &http.Cookie{+			Name:     "acme_visitor",+			Value:    id,+			Path:     "/",+			MaxAge:   31536000,+			HttpOnly: true,+			Secure:   r.TLS != nil,+			SameSite: http.SameSiteLaxMode,+		})+	}+	w.Header().Set("Cache-Control", "no-store")+	writeJSON(w, http.StatusOK, map[string]string{"identifier": id})+}++// validVisitorID accepts only identifiers this server issued.+func validVisitorID(id string) bool {+	rest, ok := strings.CutPrefix(id, "visitor-")+	if !ok || len(rest) != 32 {+		return false+	}+	_, err := hex.DecodeString(rest)+	return err == nil+}+ // serveAsset serves an embedded file, optionally substituting the lab keys // in place (one token per line, so line numbers never shift). func (s *shop) serveAsset(name, contentType string, template bool) http.HandlerFunc {

Re-rolling pricing_page closes only when identifiers are assigned on the server, or when the percentage rollout or variant split is removed. Marking the flag Server-side only hides it from client SDKs but does not stop re-rolling: a server that evaluates it for a browser-chosen identifier is still steered. manual Guidance only, never executed

After the fix is live, restart the experiment so its results are not biased by forged or re-rolled assignments. Gatecrasher never stops or restarts experiments itself. manual Guidance only, never executed

Why

What could break

No code that reads this setting was found in the scanned repository.

Guidance only. This plan changes nothing in Flagsmith: review the drafts above and make the change in your code.

Assign identifiers on the server for early_access_ai on Production

pending PRODUCTION

Plan plan-780d3357 · Production · identifiers:early_access_ai · hash 191bae5200bf · created

What changes

Draft a pull request to assign Flagsmith identifiers on the server (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Assign the visitor identifier on the server (signed HttpOnly cookie)

## Problem

The storefront generated the Flagsmith identity in the browser (`crypto.randomUUID()` stored in a script-readable `acme_visitor` cookie). Anyone could discard or replace that value and get a new identity. Doing so repeatedly (about 11 tries at the observed ~9% hit rate) lands in the `canary_10` percentage segment and unlocks `early_access_ai`.

## Change

- **`main.go`**: new `GET /api/identity` endpoint. The server generates a random visitor ID and stores it in an `HttpOnly`, `SameSite=Lax` cookie signed with HMAC-SHA256. Cookies that are missing or whose signature does not verify (including the old browser-made `visitor-<uuid>` cookies) are replaced with a fresh server-generated ID. The HMAC key comes from `SHOP_COOKIE_SECRET`, or is random per process if unset.
- **`app.js`**: `visitorId()` no longer generates or writes a cookie. It asks `/api/identity` for the identifier and passes it to `flagsmith.init`.

## Notes and limits

- Set `SHOP_COOKIE_SECRET` in production. Without it, restarting the process invalidates all cookies and reassigns every visitor, which also changes who falls into percentage rollouts.
- The `Secure` cookie attribute is not set because the lab serves over plain HTTP. Add it when deploying behind HTTPS.
- This stops the app's own client from choosing or forging the identity. It does not stop someone who deliberately drops cookies, since each new session gets a new server-assigned ID. It also does not stop direct calls to the Flagsmith identities endpoint with the public client key and an arbitrary identifier, as in the evidence curl. Fully closing that path needs the flag evaluation to go through the server (server-side key), or the rollout not to gate anything sensitive. `early_access_ai` should be treated as non-sensitive unless that is done.
- The `plan` trait is unchanged and is covered by a separate finding.

Proposed change (a suggestion to review; Gatecrasher never applies it):

--- a/main.go+++ b/main.go@@ -8,7 +8,11 @@ import ( 	"bufio" 	"context"+	"crypto/hmac"+	"crypto/rand"+	"crypto/sha256" 	"embed"+	"encoding/hex" 	"encoding/json" 	"errors" 	"fmt"@@ -29,24 +33,32 @@ 	apiURL    string 	clientKey string 	serverKey string 	http      *http.Client+	cookieKey []byte }  func main() { 	env := loadEnv() 	apiURL := env["GATECRASHER_API_URL"] 	if apiURL == "" { 		apiURL = "http://localhost:8000/api/v1/" 	} 	s := &shop{ 		apiURL:    strings.TrimRight(apiURL, "/") + "/", 		clientKey: pair(env["GATECRASHER_CLIENT_KEYS"], "Production"), 		serverKey: pair(env["GATECRASHER_SERVER_KEYS"], "Production"), 		http:      &http.Client{Timeout: 10 * time.Second}, 	} 	if s.clientKey == "" || s.serverKey == "" { 		log.Fatal("Production keys missing from .env: run `go run ./lab/provision` first") 	}+	s.cookieKey = []byte(env["SHOP_COOKIE_SECRET"])+	if len(s.cookieKey) == 0 {+		s.cookieKey = make([]byte, 32)+		if _, err := rand.Read(s.cookieKey); err != nil {+			log.Fatal(err)+		}+	} 	addr := ":3030" 	if v := os.Getenv("SHOP_ADDR"); v != "" { 		addr = v@@ -60,8 +72,40 @@ 	mux.HandleFunc("GET /{$}", s.serveAsset("index.html", "text/html; charset=utf-8", false)) 	mux.HandleFunc("GET /app.js", s.serveAsset("app.js", "text/javascript; charset=utf-8", true)) 	mux.HandleFunc("GET /api/checkout-config", s.checkoutConfig)+	mux.HandleFunc("GET /api/identity", s.identity) 	return mux }++// sign returns the hex HMAC of a visitor ID under the server's cookie key.+func (s *shop) sign(id string) string {+	m := hmac.New(sha256.New, s.cookieKey)+	m.Write([]byte(id))+	return hex.EncodeToString(m.Sum(nil))+}++// identity returns the visitor's server-assigned identifier. The identifier+// lives in an HttpOnly, signed cookie, so the browser can neither choose nor+// forge it. A missing or invalid cookie gets a fresh server-generated one.+func (s *shop) identity(w http.ResponseWriter, r *http.Request) {+	w.Header().Set("Cache-Control", "no-store")+	if c, err := r.Cookie("acme_visitor"); err == nil {+		if id, sig, ok := strings.Cut(c.Value, "."); ok && hmac.Equal([]byte(sig), []byte(s.sign(id))) {+			writeJSON(w, http.StatusOK, map[string]string{"identifier": id})+			return+		}+	}+	buf := make([]byte, 16)+	if _, err := rand.Read(buf); err != nil {+		http.Error(w, "identity unavailable", http.StatusInternalServerError)+		return+	}+	id := "visitor-" + hex.EncodeToString(buf)+	http.SetCookie(w, &http.Cookie{+		Name: "acme_visitor", Value: id + "." + s.sign(id), Path: "/",+		MaxAge: 31536000, HttpOnly: true, SameSite: http.SameSiteLaxMode,+	})+	writeJSON(w, http.StatusOK, map[string]string{"identifier": id})+}  // serveAsset serves an embedded file, optionally substituting the lab keys // in place (one token per line, so line numbers never shift).--- a/app.js+++ b/app.js@@ -10,15 +10,12 @@   return hit ? decodeURIComponent(hit.split("=")[1]) : null; } -// Each visitor gets a random browser-generated ID kept in a cookie.-function visitorId() {-  let id = cookie("acme_visitor");-  if (!id) {-    id = "visitor-" + crypto.randomUUID();-    document.cookie = "acme_visitor=" + id + "; path=/; max-age=31536000; SameSite=Lax";-  }-  return id;-}+// The server assigns the visitor ID and keeps it in an HttpOnly cookie.+async function visitorId() {+  const res = await fetch("/api/identity", { credentials: "same-origin" });+  if (!res.ok) throw new Error("could not get visitor identity");+  return (await res.json()).identifier;+}  function show(id, visible) {   document.getElementById(id).hidden = !visible;@@ -46,6 +43,6 @@  async function main() {-  const id = visitorId();+  const id = await visitorId();   document.getElementById("visitor").textContent = id;   const plan = cookie("acme_plan") || "free";   document.getElementById("plan").value = plan;

Re-rolling early_access_ai closes only when identifiers are assigned on the server, or when the percentage rollout or variant split is removed. Marking the flag Server-side only hides it from client SDKs but does not stop re-rolling: a server that evaluates it for a browser-chosen identifier is still steered. manual Guidance only, never executed

Why

What could break

No code that reads this setting was found in the scanned repository.

Guidance only. This plan changes nothing in Flagsmith: review the drafts above and make the change in your code.

Guidance for internal_tools on Production: assign identifiers on the server and stop targeting on identifier patterns

pending PRODUCTION

Plan plan-6995c9d7 · Production · identifier-targeting:internal_tools · hash 4b40ab01539a · created

What changes

Draft a pull request to assign identifiers on the server and stop targeting on identifier patterns (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Assign visitor identifier on the server instead of in the browser

## Problem

The storefront let the browser create and own its Flagsmith identifier (`acme_visitor`, a JS-written cookie). Anything the browser can choose, a visitor can overwrite. Choosing an identifier such as `a@acmeshop.dev` matches the `staff_by_identifier` segment and turns `internal_tools` on, with no trait involved. Turning off client traits does not stop this.

## Change

- `main.go`: adds `GET /api/session`. The server generates a random identifier (`visitor-<32 hex>` from `crypto/rand`) and stores it in an **HttpOnly**, `SameSite=Lax` cookie. If the browser already presents a cookie, it is reused only when it has exactly that server-issued shape. Any other value, such as an email address, is discarded and replaced with a fresh random ID. The endpoint returns the identifier so the SDK can be initialised with it.
- `app.js`: removes the browser-side ID generation and the JS-written `acme_visitor` cookie. `main()` now gets its identity from `/api/session`.

## Scope

- This fixes the app's own behaviour, so the app never generates or accepts a chosen identifier. The Flagsmith client-side environment key is public by design, and anyone who calls the Flagsmith identities API directly can still send any identifier. To close that fully, either stop matching on identifiers in segments that grant access (`staff_by_identifier` should not unlock `internal_tools`), or evaluate flags on the server with the server-side key and send the results to the browser. Please review the segment rule in Flagsmith as a follow-up.
- The `plan` trait set via `setTrait` is a separate issue and is intentionally not changed here.

## Testing

- Load `/` with no cookie: `acme_visitor` is set as HttpOnly and is not visible in `document.cookie`.
- Manually set `acme_visitor=a@acmeshop.dev`: the next `/api/session` call replaces it with a random `visitor-...` ID, and `internal_tools` stays off.

Proposed change (a suggestion to review; Gatecrasher never applies it):

--- a/app.js+++ b/app.js@@ -10,15 +10,13 @@   return hit ? decodeURIComponent(hit.split("=")[1]) : null; } -// Each visitor gets a random browser-generated ID kept in a cookie.-function visitorId() {-  let id = cookie("acme_visitor");-  if (!id) {-    id = "visitor-" + crypto.randomUUID();-    document.cookie = "acme_visitor=" + id + "; path=/; max-age=31536000; SameSite=Lax";-  }-  return id;-}+// The visitor ID is assigned by the server in an HttpOnly cookie; the browser+// never generates or chooses its own identifier.+async function visitorId() {+  const res = await fetch("/api/session", { credentials: "same-origin" });+  const body = await res.json();+  return body.identifier;+}  function show(id, visible) {   document.getElementById(id).hidden = !visible;@@ -45,7 +43,7 @@ }  async function main() {-  const id = visitorId();+  const id = await visitorId();   document.getElementById("visitor").textContent = id;   const plan = cookie("acme_plan") || "free";   document.getElementById("plan").value = plan;--- a/main.go+++ b/main.go@@ -8,8 +8,10 @@ import ( 	"bufio" 	"context"+	"crypto/rand" 	"embed"+	"encoding/hex" 	"encoding/json" 	"errors" 	"fmt" 	"io"@@ -60,9 +62,48 @@ 	mux.HandleFunc("GET /{$}", s.serveAsset("index.html", "text/html; charset=utf-8", false)) 	mux.HandleFunc("GET /app.js", s.serveAsset("app.js", "text/javascript; charset=utf-8", true)) 	mux.HandleFunc("GET /api/checkout-config", s.checkoutConfig)+	mux.HandleFunc("GET /api/session", s.session) 	return mux } +const visitorCookie = "acme_visitor"++// visitorID returns the server-assigned visitor identifier. A cookie is only+// reused if it has exactly the shape the server issues; anything else is replaced.+func visitorID(w http.ResponseWriter, r *http.Request) (string, error) {+	if c, err := r.Cookie(visitorCookie); err == nil && strings.HasPrefix(c.Value, "visitor-") {+		if b, err := hex.DecodeString(strings.TrimPrefix(c.Value, "visitor-")); err == nil && len(b) == 16 {+			return c.Value, nil+		}+	}+	buf := make([]byte, 16)+	if _, err := rand.Read(buf); err != nil {+		return "", err+	}+	id := "visitor-" + hex.EncodeToString(buf)+	http.SetCookie(w, &http.Cookie{+		Name:     visitorCookie,+		Value:    id,+		Path:     "/",+		MaxAge:   31536000,+		HttpOnly: true,+		Secure:   r.TLS != nil,+		SameSite: http.SameSiteLaxMode,+	})+	return id, nil+}++// session tells the app which identifier the server assigned to this browser.+func (s *shop) session(w http.ResponseWriter, r *http.Request) {+	id, err := visitorID(w, r)+	if err != nil {+		writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "could not assign visitor id"})+		return+	}+	w.Header().Set("Cache-Control", "no-store")+	writeJSON(w, http.StatusOK, map[string]string{"identifier": id})+}+ // serveAsset serves an embedded file, optionally substituting the lab keys // in place (one token per line, so line numbers never shift). func (s *shop) serveAsset(name, contentType string, template bool) http.HandlerFunc {

Replace the segment rule that matches on the identifier for internal_tools with one keyed on data only your server can set (a server-set trait, or an identity override made by your backend). Turning off "Allow client SDKs to set user traits" does not close this: no trait is involved, and the client still chooses its identifier. manual Guidance only, never executed

Why

What could break

No code that reads this setting was found in the scanned repository.

Guidance only. This plan changes nothing in Flagsmith: review the drafts above and make the change in your code.

Disable client-set traits on Production, hide sensitive data

verified PRODUCTION

Plan plan-8f239e2c · Production · environment:Production · hash 868b2509e786 · created

What changes

Turn off "Allow client SDKs to set user traits" on Production env.patch

Before and after for Turn off "Allow client SDKs to set user traits" on Production
SettingBeforeAfter
allow_client_traitstruefalse

Turn on "Hide sensitive data" on Production env.patch

Before and after for Turn on "Hide sensitive data" on Production
SettingBeforeAfter
hide_sensitive_datafalsetrue

Draft a pull request to move client-side trait writes to your server (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Move plan trait and visitor identity to the server; stop setting traits in the browser

## Why

Gatecrasher confirmed that a visitor holding only the client-side environment key can send `role=admin` and flip `admin_panel` from off to on (segment `admins`). The affected code sets the `plan` trait from the browser: `app.js:56` passes it to `init`, and `app.js:62` calls `setTrait` from a dropdown. It also uses a browser-generated visitor ID. Anything the browser decides, a visitor can forge.

## What changed

**`main.go`**
- New `POST /api/identity` endpoint. It assigns the visitor identifier with a server-signed, `HttpOnly` cookie (HMAC keyed with the server-side key). The browser can no longer choose or re-roll it. A missing or invalid cookie gets a fresh identifier.
- The endpoint sets the `plan` trait with the **server-side key**, from `planFor(visitorID)`, a server-side lookup. Nothing is copied from the request.
- It returns `{identifier, plan}` so the SDK can initialise with the server-assigned identity.

**`app.js`**
- Removed the browser-generated `visitorId()`, the `acme_plan` cookie, the `traits: { plan }` argument to `init` and the `setTrait` call.
- `main()` now calls `/api/identity` first and initialises the SDK with the identifier it returns.
- The plan dropdown is read-only and displays the server-assigned plan.

## Review notes

- **`planFor` returns `"free"` by default.** Connect it to your subscription or entitlement store, and the server sets each visitor's plan.
- **This PR does not close the `role=admin` finding on its own.** The client-side key can still send arbitrary traits directly to the Flagsmith API, as the probe did. To finish the fix, do at least one of:
  - Stop keying `admin_panel` on a client-settable trait such as `role`.
  - Evaluate `admin_panel` on the server only, using server-set traits.
  - Make the flag visible to the server-side key only.

  Any trait that gates something sensitive should be set by the server, as `plan` now is.
- `index.html` is not touched. The dropdown is disabled from `app.js`.
- Existing `acme_visitor` cookies are unsigned, so they are replaced with a signed one on the next visit. Visitors will therefore get new identifiers once.

Proposed change (a suggestion to review; Gatecrasher never applies it):

--- a/app.js+++ b/app.js@@ -9,17 +9,7 @@   const hit = document.cookie.split("; ").find((c) => c.startsWith(name + "="));   return hit ? decodeURIComponent(hit.split("=")[1]) : null; } -// Each visitor gets a random browser-generated ID kept in a cookie.-function visitorId() {-  let id = cookie("acme_visitor");-  if (!id) {-    id = "visitor-" + crypto.randomUUID();-    document.cookie = "acme_visitor=" + id + "; path=/; max-age=31536000; SameSite=Lax";-  }-  return id;-}- function show(id, visible) {   document.getElementById(id).hidden = !visible; }@@ -45,24 +35,24 @@ }  async function main() {-  const id = visitorId();+  // The server assigns the visitor id (HttpOnly cookie) and sets the plan trait.+  const identity = await fetch("/api/identity", { method: "POST" });+  if (!identity.ok) {+    throw new Error("could not establish identity");+  }+  const { identifier: id, plan } = await identity.json();   document.getElementById("visitor").textContent = id;-  const plan = cookie("acme_plan") || "free";-  document.getElementById("plan").value = plan;+  const planSelect = document.getElementById("plan");+  planSelect.value = plan;+  planSelect.disabled = true;   await flagsmith.init({     environmentID: FLAGSMITH_ENV_KEY,     api: FLAGSMITH_API,     identity: id,-    traits: { plan: plan },     onChange: render,   });   render();-  document.getElementById("plan").addEventListener("change", async (e) => {-    document.cookie = "acme_plan=" + e.target.value + "; path=/; max-age=31536000; SameSite=Lax";-    await flagsmith.setTrait("plan", e.target.value);-    render();-  });   loadCheckout(); }  main();

Why

What could break

  • app.js:56 Will break This will break: app.js:56 sets plan client-side. Move it to your server (PR draft attached).
    traits: { plan: plan },
  • app.js:62 Will break This will break: app.js:62 sets plan client-side. Move it to your server (PR draft attached).
    await flagsmith.setTrait("plan", e.target.value);
State snapshot this plan is bound to
allow_client_traits
true
hide_sensitive_data
false

Approved by operator via web on ; typed environment confirmation recorded.

Before and after

The change took effect in 5.4 s.

FindingBeforeAfterProof
Traits of qa***@acmeshop.dev are readable by anyone with the public client key GC-1305BD20 EXPLOITABLE BLOCKEDTest identity returned 0 traits; values [MASKED]
Forging email=a@acmeshop.dev unlocks staff_preview (segment "staff") GC-1A45D85C EXPLOITABLE BLOCKEDcurl -s -X POST 'http://localhost:8000/api/v1/identities/' -H 'X-Environment-Key: <CLIENT_KEY>' -H 'Content-Type: application/json' -d '{"identifier":"gc-probe-verify-0","traits":[{"trait_key":"email","trait_value":"a@acmeshop.dev","transient":true}],"transient":true}' → staff_preview is off (exploited state on)
Identity override on beta_dashboard is readable by anyone who knows the identifier GC-58B8A822 EXPLOITABLE BLOCKEDTest identity override checked; values [MASKED]
Forging plan=gold unlocks premium_export (segment "gold_plan") GC-688647D2 EXPLOITABLE BLOCKEDcurl -s -X POST 'http://localhost:8000/api/v1/identities/' -H 'X-Environment-Key: <CLIENT_KEY>' -H 'Content-Type: application/json' -d '{"identifier":"gc-probe-verify-0","traits":[{"trait_key":"plan","trait_value":"gold","transient":true}],"transient":true}' → premium_export is off (exploited state on)
Forging role=admin unlocks admin_panel (segment "admins") GC-70850605 EXPLOITABLE BLOCKEDcurl -s -X POST 'http://localhost:8000/api/v1/identities/' -H 'X-Environment-Key: <CLIENT_KEY>' -H 'Content-Type: application/json' -d '{"identifier":"gc-probe-65b9a852a40e53b758ec355867a51b31","traits":[{"trait_key":"role","trait_value":"admin","transient":true}],"transient":true}' → admin_panel is off (exploited state on)
Traits of ce***@acmeshop.dev are readable by anyone with the public client key GC-914405C1 EXPLOITABLE BLOCKEDTest identity returned 0 traits; values [MASKED]
Production: "Hide sensitive data" is OFF GC-9FE52BC7 EXPLOITABLE BLOCKEDhide_sensitive_data=true
Production: "Allow client SDKs to set user traits" is ON GC-A60CCA1A EXPLOITABLE BLOCKEDallow_client_traits=false

Mark project_nightjar_launch_2026_12_15 Server-side only on Production

verified PRODUCTION

Plan plan-ab69ce83 · Production · feature:project_nightjar_launch_2026_12_15 · hash 25f48d06e473 · created

What changes

Mark feature project_nightjar_launch_2026_12_15 as Server-side only so client SDKs stop receiving it feature.patch

Before and after for Mark feature `project_nightjar_launch_2026_12_15` as Server-side only so client SDKs stop receiving it
SettingBeforeAfter
is_server_key_onlyfalsetrue

Consider renaming project_nightjar_launch_2026_12_15 to a neutral name before release: flag names are visible to anyone holding the client key. Renaming is a code and Flagsmith change you make by hand. manual Guidance only, never executed

Why

What could break

No code that reads this setting was found in the scanned repository.

State snapshot this plan is bound to
is_server_key_only
false

Approved by operator via web on ; typed environment confirmation recorded.

Before and after

The change took effect in 7.3 s.

FindingBeforeAfterProof
Unreleased product leaked through flag: project_nightjar_launch_2026_12_15 GC-07590992 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → project_nightjar_launch_2026_12_15 visible to client key: false
Sensitive flag "project_nightjar_launch_2026_12_15" is not "Server-side only" GC-64038665 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → project_nightjar_launch_2026_12_15 visible to client key: false

Mark payment_config Server-side only on Production

verified PRODUCTION

Plan plan-a651a081 · Production · feature:payment_config · hash 8e063e920a61 · created

What changes

Mark feature payment_config as Server-side only so client SDKs stop receiving it feature.patch

Before and after for Mark feature `payment_config` as Server-side only so client SDKs stop receiving it
SettingBeforeAfter
is_server_key_onlyfalsetrue

Draft a pull request to move this value to server-side config and read the flag on your server (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Keep payment_config server-side only (no app code change needed)

## Finding

The `payment_config` flag value contains an `api_secret` field (detected at `$.api_secret`). The Production client-side environment key can read it through `/api/v1/flags/`, so anyone who loads the storefront can retrieve the payment provider secret.

## What the app code already does

The affected files are already safe against this finding:

- `app.js` never reads `payment_config` through the Flagsmith browser SDK. It only calls `flagsmith.hasFeature` / `getValue` for UI flags (`premium_export`, `admin_panel`, `staff_preview`, `early_access_ai`, `pricing_page`, `banner_text`, `maintenance_mode`).
- `main.go` exposes `GET /api/checkout-config`, which reads `payment_config` with the server-side key (`serverFlagValue`) and returns only `provider` and `webhook`. The secret never leaves the server.
- `index.html` only displays the non-secret fields returned by that endpoint.

The leak is therefore caused by how the flag is configured in Flagsmith, not by anything the app does. Moving the secret out of the client-visible value inside these files would not change what the client key can read, so this PR does not change application code.

## Required remediation (outside the repo)

1. **Rotate the payment provider secret** stored in `payment_config.api_secret` (the `acme_live_key`). It has been exposed to any holder of the client key, so treat it as compromised.
2. **Restrict `payment_config` to server-side keys only** in Flagsmith (mark the flag as server-key-only / not available to client-side environment keys) for the Production environment.
3. **Remove the secret from the flag value** where practical: keep only non-secret settings (`provider`, `webhook`) in the flag and load `api_secret` from the server's own secret store or environment variables.
4. Re-run the audit and confirm that `curl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>'` no longer returns `payment_config`.

## Verification

After step 2, `/api/checkout-config` should keep working, since `serverFlagValue` uses the server-side key, which can still see server-key-only flags.

no diff was produced for this fix

Rotate the secret exposed by payment_config at its issuer. Treat it as compromised: it was served to every browser. Gatecrasher cannot rotate secrets for you. manual Guidance only, never executed

Why

What could break

No code that reads this setting was found in the scanned repository.

State snapshot this plan is bound to
is_server_key_only
false

Approved by operator via web on ; typed environment confirmation recorded.

Before and after

The change took effect in 1.2 s.

FindingBeforeAfterProof
Sensitive flag "payment_config" is not "Server-side only" GC-0B5C5F67 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → payment_config visible to client key: false
Secret in a client-visible flag value: payment_config GC-8B6A1273 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → payment_config visible to client key: false

Mark internal_api_url Server-side only on Production

verified PRODUCTION

Plan plan-e7a06dac · Production · feature:internal_api_url · hash 47b15e3d59a3 · created

What changes

Mark feature internal_api_url as Server-side only so client SDKs stop receiving it feature.patch

Before and after for Mark feature `internal_api_url` as Server-side only so client SDKs stop receiving it
SettingBeforeAfter
is_server_key_onlyfalsetrue

Draft a pull request to move this value to server-side config and read the flag on your server (review and open it yourself; Gatecrasher never pushes code). pr.draft Guidance only, never executed

PR draft
Keep internal_api_url server-side only (internal URL leaked to browsers)

## Finding

The `internal_api_url` flag in **Production** is returned to any browser that holds the client-side environment key. Its value is a private-network address of an internal admin endpoint (detected as `private_ip`). Anyone can read it with the public client key, which reveals internal network topology and an admin path.

## Analysis

- `app.js` and `index.html` never read `internal_api_url`. The storefront does not need it in the browser.
- `main.go` also does not use it today. It already has a server-side pattern for flags that must not reach the client: `serverFlagValue` reads a flag with the server-side key, and `/api/checkout-config` returns only non-secret fields.
- The exposure comes from the flag's configuration in Flagsmith, not from application code. The flag is visible to the client-side key, so no change to `app.js`, `index.html` or `main.go` can stop it from being served.

## Recommended remediation (Flagsmith configuration)

1. In the Production environment, make `internal_api_url` **server-side only** (restrict it to server-side environment keys) so the client-side key no longer receives it.
2. Check that nothing else in the browser relies on the flag. The code in this repo does not.
3. Consider rotating or restricting the internal admin endpoint it points to, since the address has been publicly readable.
4. If a backend service needs this value, read it on the server with `serverFlagValue(ctx, "internal_api_url")` in `main.go`. Never forward it to the client in a response or template it into `app.js`.

## Verification

After the change, request `/api/v1/flags/` with the client-side key. `internal_api_url` should no longer appear in the response. A server-side key request should still return it.

No application code changes are required for this finding.

no diff was produced for this fix

Why

What could break

No code that reads this setting was found in the scanned repository.

State snapshot this plan is bound to
is_server_key_only
false

Approved by operator via web on ; typed environment confirmation recorded.

Before and after

The change took effect in 1.2 s.

FindingBeforeAfterProof
Sensitive flag "internal_api_url" is not "Server-side only" GC-03878136 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → internal_api_url visible to client key: false
Internal URL leaked to every browser: internal_api_url GC-63E8DE85 EXPLOITABLE BLOCKEDcurl -s 'http://localhost:8000/api/v1/flags/' -H 'X-Environment-Key: <CLIENT_KEY>' → internal_api_url visible to client key: false