Skip to content

fix(deploy): classify secret and public setting boundaries - #9670

Merged
Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:codex/issue-9663-secret-boundary-ratchet
Jul 14, 2026
Merged

Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:codex/issue-9663-secret-boundary-ratchet

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a name-only deployment setting policy and diff ratchet for secret, config, and public build bindings.
  • Move browser-delivered build configuration to GitHub environment variables, including the admin dashboard.
  • Move backend non-secret runtime settings to an environment ConfigMap while retaining credentials and MCP_OAUTH_CLIENTS_JSON in secret sources.

Closes #9663

Root cause and durable guard

Deployment wiring had no authoritative classification boundary, so public and non-secret settings could be added through secret sources. The policy plus CI/local ratchet now rejects new or changed mismatched bindings, including direct Secret Manager fetches, and fixture tests cover each source class.

Rollout

No live deployment was run. Before deploying, provision the documented GitHub environment variables for each environment; the ConfigMap script fails before touching the cluster when a required value is absent. Delete obsolete Secret Manager entries only after the new path has rolled out successfully.

Validation

  • bash backend/test.sh
  • make preflight
  • scripts/pr-preflight --suggest
  • python3 .github/scripts/check_deployment_secret_boundary.py --base origin/main
  • python3 .github/scripts/test_check_deployment_secret_boundary.py
  • backend/.venv/bin/python backend/scripts/validate-backend-runtime-env.py --env dev --check-workflows --check-rendered-cloud-run
  • backend/.venv/bin/python backend/scripts/validate-backend-runtime-env.py --env prod --check-workflows --check-rendered-cloud-run
  • Helm template rendering for dev/prod backend-listen and pusher charts

Review in cubic

@Git-on-my-level
Git-on-my-level merged commit 08c8589 into BasedHardware:main Jul 14, 2026
22 of 25 checks passed
Git-on-my-level added a commit that referenced this pull request Jul 14, 2026
## Summary
- migrate the legacy development Cloud Run `GOOGLE_CLIENT_ID` Secret
Manager binding before the normal candidate deploy applies the public
literal
- preserve serving traffic during the type transition with
`--no-traffic`
- add a tested development-only preflight migration contract, including
idempotency and multi-container fail-closed behavior

## Root cause
`GOOGLE_CLIENT_ID` was intentionally reclassified as public
configuration in #9670, but the existing dev `backend` and
`backend-sync` services still hold Secret Manager bindings. Cloud Run
rejects changing that binding type in the same `gcloud run deploy`
command as `--update-env-vars`.

The dev auto-deploy now invokes the existing Cloud Run preflight helper
before the usual candidate deployment. It refuses non-dev projects,
detects only the exact legacy binding, and creates a no-traffic
transition revision before the normal no-traffic candidate deployment
and validation/traffic-shift gates. No production workflow or service is
changed.

## Verification
- RED: the migration contract test failed before the implementation
existed
- selected Cloud Run deployment-contract suite: **121 passed**
- YAML parse of `.github/workflows/gcp_backend_auto_dev.yml` — passed
- `git diff --check` — passed
- `gcloud run services update --help` verified `--no-traffic`; read-only
dev inspection confirmed both affected services currently bind
`GOOGLE_CLIENT_ID` from Secret Manager

## Scope
Development-only migration. No production deployment, configuration
write, traffic shift, or secret deletion is included.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9693?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Jul 14, 2026
## Summary
- fail pusher auto-deploys before Helm when the shared backend runtime
ConfigMap is missing
- enforce the ConfigMap preflight across every pusher Helm workflow
- preserve the existing dev pusher replica during failed rollouts

## Root cause
PR #9670 made pusher depend on `dev-omi-backend-config`, but the
push-triggered pusher workflow omitted the preflight added to the manual
workflow. A concurrent backend deploy failed before creating the
ConfigMap, while pusher Helm replaced the only healthy replica.

## Durable guard
- repository deployment policy rejects any pusher Helm workflow lacking
a pre-Helm ConfigMap check
- self-test covers valid, missing, and incorrectly ordered preflights
- rendered Helm test requires dev pusher `maxUnavailable: 0` and
`maxSurge: 1`

## Validation
- `python3 .github/scripts/check-deployment-concurrency.py --self-test`
- `python3 .github/scripts/check-deployment-concurrency.py`
- `python3 .github/scripts/check_deployment_secret_boundary.py --base
origin/main`
- `/Users/dazheng/workspace/omi/backend/.venv/bin/python -m pytest
backend/tests/unit/test_rendered_deployment_contract.py -q` (`9 passed`)
- `OMI_PR_BODY_FILE=/tmp/omi-dev-pusher-config-pr.md scripts/pre-push`
(`Fast pre-push checks passed`)

## Operational verification
- context-pinned rollback restored dev pusher revision 110's template as
deployment revision 112
- deployment is `1/1` ready and available with one ready EndpointSlice
endpoint
- in-cluster `/health` via port-forward returned `200
{"status":"healthy"}`
- migrated all 18 required non-secret values from the existing dev
Kubernetes Secret to GitHub development environment variables and
`dev-omi-backend-config`; values were never printed
- retained the old secret keys until the ConfigMap-backed current pusher
revision is deployed and verified

## Deployment note
Landing this PR changes the dev pusher chart and triggers its
auto-deploy. The new workflow preflights the now-provisioned ConfigMap
before Helm, and the rollout preserves the healthy replica if the
candidate cannot start.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9691?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…ware#9670)

## Summary

- Add a name-only deployment setting policy and diff ratchet for secret,
config, and public build bindings.
- Move browser-delivered build configuration to GitHub environment
variables, including the admin dashboard.
- Move backend non-secret runtime settings to an environment ConfigMap
while retaining credentials and `MCP_OAUTH_CLIENTS_JSON` in secret
sources.

Closes BasedHardware#9663

## Root cause and durable guard

Deployment wiring had no authoritative classification boundary, so
public and non-secret settings could be added through secret sources.
The policy plus CI/local ratchet now rejects new or changed mismatched
bindings, including direct Secret Manager fetches, and fixture tests
cover each source class.

## Rollout

No live deployment was run. Before deploying, provision the documented
GitHub environment variables for each environment; the ConfigMap script
fails before touching the cluster when a required value is absent.
Delete obsolete Secret Manager entries only after the new path has
rolled out successfully.

## Validation

- `bash backend/test.sh`
- `make preflight`
- `scripts/pr-preflight --suggest`
- `python3 .github/scripts/check_deployment_secret_boundary.py --base
origin/main`
- `python3 .github/scripts/test_check_deployment_secret_boundary.py`
- `backend/.venv/bin/python
backend/scripts/validate-backend-runtime-env.py --env dev
--check-workflows --check-rendered-cloud-run`
- `backend/.venv/bin/python
backend/scripts/validate-backend-runtime-env.py --env prod
--check-workflows --check-rendered-cloud-run`
- Helm template rendering for dev/prod backend-listen and pusher charts

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9670?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent deployment secret sprawl with a classification ratchet and config migration

1 participant