Keeping the fork publishable
The discipline that lets a private Azure fork ship AGPL source without leaking deployment IP: the three-repo, three-tier model, the upstream PRs, and the leakage gates.
Configuration extraction and sanitization
Several artefacts in this repository contain hardcoded values that identify our specific deployment, our tenant, or other internal state. These must be extracted to env vars or sanitized to placeholders before any Tier B publication.
This document is the sanitization checklist. The agent runbook includes a pre-push regex pass that fails if any of these survive in a publication branch.
The hardcoded identifiers
The following identifiers must not appear in any Tier B file. They are tenant- or deployment-specific and reveal internal state.
Resource group / resource names
| Identifier | Where it currently appears | Action |
|---|---|---|
rg-mike-dev |
Bicep, scripts, runbooks | Keep in Tier C only. Sanitize Tier B docs to <your-resource-group>. |
rg-mike-prod |
Bicep, scripts | Same. |
kv-mike-dev / kv-mike-prod |
Bicep, scripts, install manifest, install route | The install manifest (backend/src/lib/install/manifest.ts) reads KEY_VAULT_NAME from env — already extracted. Verify before publishing. |
stmikedev (storage account) |
Bicep, env example | Bicep is Tier C. Env example uses stmikedev as a placeholder — replace with <your-storage-account>. |
acrmike.azurecr.io / acrmikedev |
Bicep, parameters, runbooks | Tier C only. Sanitize Tier B docs. |
cae-mike-dev |
Bicep, runbooks | Tier C only. |
pg-mike-dev |
Bicep, runbooks | Tier C only. |
appi-mike-dev / law-mike-dev |
(Historical — observability removed) | Kept in sanitization regex as a safety net for stale references. |
victoriousmoss-0c5f2882.uksouth.azurecontainerapps.io |
frontend/.env.production, runbooks |
Critical. This is the live FQDN of our deployed dev backend. See FQDN section below. |
Entra GUIDs in frontend/.env.production
This file currently contains:
NEXT_PUBLIC_ENTRA_CLIENT_ID=267c319b-8135-46cf-82e8-25a9570745b0NEXT_PUBLIC_ENTRA_TENANT_ID=7994793f-3dc8-4db8-ae7d-68ba9898985dNEXT_PUBLIC_ENTRA_BACKEND_SCOPE=api://5e7f4433-4673-4a0d-8946-c119586eb5b1/access_as_userNEXT_PUBLIC_REDIRECT_URI=https://backend.victoriousmoss-0c5f2882.uksouth.azurecontainerapps.io/login
These are real values for our deployment. They are committed to
the repo so the bundled-frontend Docker build picks them up via
NEXT_PUBLIC_* baking. That is fine for our internal deployment but
makes frontend/.env.production Tier C.
Two fixes are possible. Pick one before publication:
Option 1 (recommended): inject at build time
Move frontend/.env.production out of the repo. In our internal
CI/Bicep flow, the deploy pipeline generates this file at build time
using parameters from the deployment. The published fork ships
without .env.production and the README documents the convention:
"if you bundle the frontend with the backend, generate
frontend/.env.production at image-build time with your tenant's
values."
Option 2: sanitize to placeholders
Replace the four real values with placeholder GUIDs (e.g.
00000000-0000-0000-0000-000000000000). The published file then
demonstrates the variable shape without leaking our IDs.
This is less robust — at some point someone will commit real values back into the published file and we won't notice. Option 1 is preferred.
Internal-issue references in commit messages
Many commits reference our internal issue numbers (feat(install): slice 5 — manifest model, check runner, rendered checklist,
docs(023):, feat(install): slice 8). These are fine in this
internal repo but mean little to a public-fork reader.
The squashed Tier B publication uses one new commit message; the
internal commit history does not appear in the public fork. So this
is automatically resolved — as long as the publication is squashed
as documented in 03-fork-publication.md.
Documentation references to internal issue paths
Several Tier B docs link to docs/issues/azure-migration/<n>-...
files. Some of those targets are also Tier B; some are Tier C. After
the docs/issues/ pruning step in the agent runbook, the surviving
Tier B docs may have broken cross-links into deleted Tier C docs.
Fix: the agent runbook includes a "fix dangling cross-links" pass that runs after the Tier C deletion. Either remove the sentence containing the dead link or replace it with a one-line description of what the missing doc covered.
Environment example files
backend/.env.example and frontend/.env.local.example currently
mention deployment-specific names in comments (e.g.
AZURE_STORAGE_ACCOUNT_NAME=stmikedev). These need a sanitization
pass — replace concrete names with <your-storage-account>-style
placeholders.
The variable names themselves (AZURE_STORAGE_ACCOUNT_NAME,
KEY_VAULT_NAME, ENTRA_TENANT_ID, etc.) are public and need no
change.
Configuration that needs to move out of the application code
The user requested a review of "configuration which needs to be extracted and refactored out of the main app so that we're not having to publish it as part of the AGPL branch."
Here is the audit. None of these are blocking — all are clean because we already designed for it — but the agent should verify each before publishing.
Already extracted (env-driven, no changes needed)
- All Azure SDK auth uses
DefaultAzureCredential+KEY_VAULT_NAME/AZURE_CLIENT_IDenv vars. No hardcoded GUIDs inlib/config.ts. - All Entra config (
ENTRA_TENANT_ID,ENTRA_BACKEND_CLIENT_ID,ENTRA_CLIENT_ID,ENTRA_CLIENT_SECRET,ENTRA_REDIRECT_URI,ENTRA_ADMIN_GROUP_IDS,ENTRA_MEMBER_GROUP_IDS) is env-driven. - All Azure OpenAI config (
AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_API_KEY,AZURE_OPENAI_API_VERSION,AZURE_OPENAI_DEPLOYMENT) is env-driven, with per-user overrides inuser_profiles. - All R2 / blob storage config is env-driven.
- All download-token signing is env-driven via
DOWNLOAD_SIGNING_SECRET.
Already extracted, but with our naming convention baked in
backend/src/lib/install/manifest.ts enumerates specific KV secret
names (anthropic-api-key, openai-api-key, pg-admin-password,
postgrest-jwt-secret, etc.). These are our naming convention for
the install configurator's read/write surface.
Decision: ship these as-is in Tier B. They are application-layer
documentation of "what this app expects to find in its KV"; they do
not reveal anything about how the KV gets provisioned. A third-party
operator reading the manifest learns "the app reads a secret called
anthropic-api-key" — that is information they need to use the app.
Not extracted — would-be-fork-only-anyway
scripts/install/*.ps1 reference our specific secret names, role
assignments, and KV conventions. These are Tier C and never reach
the public fork.
infra/modules/*.bicep reference everything by our naming
convention. These are Tier C.
The pre-push sanitization regex
Before pushing to the public fork, run this exact command:
grep -rE "victoriousmoss-0c5f2882|267c319b-8135-46cf|7994793f-3dc8-4db8|5e7f4433-4673-4a0d|rg-mike-(dev|prod)|kv-mike-(dev|prod)|stmikedev|acrmikedev|acrmike\.azurecr\.io|cae-mike-(dev|prod)|pg-mike-(dev|prod)|appi-mike-(dev|prod)|law-mike-(dev|prod)" \
--include="*.ts" --include="*.tsx" --include="*.json" \
--include="*.md" --include="*.yml" --include="*.yaml" \
--include="*.sh" --include="*.mjs" --include="Caddyfile" \
--include="Dockerfile" --include="*.example"
Required result: zero matches. Any match means a Tier C identifier survived the publication. Investigate, fix, re-run.
The list of identifiers in the regex must be kept up to date as our deployment evolves — if we provision a new Azure resource with a different naming pattern, add it here.