Skip to content

feat(deploy): sync the portal's Numina and Stripe keys and allow their APIs - #598

Merged
devantler merged 1 commit into
mainfrom
claude/portal-billing-tenant-597
Nov 15, 2026
Merged

devantler merged 1 commit into
mainfrom
claude/portal-billing-tenant-597

Conversation

@devantler

Copy link
Copy Markdown
Contributor

Merge precondition: do not merge this PR until both of these hold:

  1. feat(business-site): let the tenant read its billing keys and resolve their APIs platform#6339 is deployed. It lets the business-site role read both entries and gives the pods DNS visibility.
  2. The maintainer confirms both OpenBao entries exist: apps/business-site/numina (property api-key) and apps/business-site/stripe (properties api-key, webhook-secret).

Until then the two new ExternalSecrets cannot sync, and the tenant's Flux reconciliation (wait: true) cannot become healthy once a release containing them is adopted.

Summary

This prepares the tenant package for the portal's Numina invoices and Stripe card payments (#587, #588, #590). Both flags, portal-invoice-billing and portal-card-billing, stay off.

  • ExternalSecrets. They mirror external-secret-disclosure.yaml: the namespaced openbao SecretStore, refreshInterval: 1h, creationPolicy: Owner, and named properties of one exact entry each.

    • business-site-numina reads apps/business-site/numina property api-key.
    • business-site-stripe reads apps/business-site/stripe properties api-key and webhook-secret.
  • Egress (network-policy.yaml): the egress: [{}] default-deny rule becomes one rule that allows TCP 443 to exactly api.numina.app and api.stripe.com by toFQDNs matchName. Any egress rule keeps every other destination default-denied.

  • Docs (deploy/README.md): a new "Portal billing inputs" section. It names the Secrets and entries, the files to project, their confinement and the exact portal-settings lines:

    PORTAL_NUMINA_TOKEN_FILE=/run/webapp-inputs/numina-api-key
    PORTAL_STRIPE_KEY_FILE=/run/webapp-inputs/stripe-api-key
    PORTAL_STRIPE_WEBHOOK_SECRET_FILE=/run/webapp-inputs/stripe-webhook-secret
    

    The optional PORTAL_NUMINA_API_URL, PORTAL_NUMINA_SALES_ACCOUNT, PORTAL_NUMINA_VAT_CODE and PORTAL_STRIPE_API_URL keep their defaults when omitted. The runtime refuses billing lines unless the five portal dependency keys are present too. The egress paragraph now describes the new rule.

  • Validators:

    • scripts/check-tenant-package.mjs admits exactly nine resources with exactly these three ExternalSecrets and this egress rule.
    • scripts/tenant-package.test.mjs adds 24 refusals: a missing or duplicate billing sync, a foreign entry, tenant or property, the shared cluster store, overwriting or merging into the disclosure Secret, an inline value, a bulk import, an extra or missing Stripe property, a projected billing key, an extra name, a wildcard or * pattern, port 80, an extra port, port-only or port-unrestricted egress, a second rule, and the old [{}].
    • scripts/verify-runtime-publication.sh admits the two new manifest members, and scripts/runtime-verification.test.sh adds a missing-Stripe and an altered-Numina control.

Why the keys are not projected yet

The platform's WebApp RGD declares secretProjections with maxItems=1 and always renders the volume with optional: false. So:

  • a second or third projected Secret is refused by the WebApp schema;
  • adding the billing keys to the projected Secret would make every new Pod, including the public pages, fail to start whenever a billing entry is missing;
  • optional projections are not available.

The runtime reads these files only when portal settings name them, and the portal-settings projection is not wired yet. So nothing reads them today. The README records the three items (numina-api-key, stripe-api-key, stripe-webhook-secret) to add once the one projected Secret carries these keys. This interacts with #594, which moves the single projection to a platform-composed business-site-runtime Secret. If that Secret is where the keys end up, the platform composes them there, and these tenant ExternalSecrets may become redundant. That is the maintainer's call.

Validation

  • kubectl kustomize deploy | node scripts/check-tenant-package.mjs: accepted.
  • node --test scripts/tenant-package.test.mjs: 118/118 pass.
  • bash scripts/runtime-verification.test.sh, bash scripts/publishing-contract.test.sh, bash scripts/runtime-release.test.sh and bash scripts/runtime-publisher-contract.test.sh: pass.
  • Kyverno 1.19.2 apply against the platform's policies on the rendered package, as the business-site service account in a managed-by: kro namespace:
    • restrict-tenant-network-policies passes the new CiliumNetworkPolicy. Three negative controls fail as expected: matchPattern: "*", port-only egress and toEntities: [world].
    • restrict-tenant-secret-stores passes the SecretStore and all three ExternalSecrets. A ClusterSecretStore variant fails.
  • shellcheck is clean for both changed scripts. markdownlint (MegaLinter's config) and markdown-table-formatter --check are clean for the README. jscpd with MegaLinter's v10.2.0 config finds no clone in any changed file.
  • Not run locally: node scripts/tenant-runtime-smoke.test.mjs. webapp.yaml is unchanged, and the committed baseline image predates the current runtime arguments, so CI runs the smoke against its newly built image.

Fixes #597

🤖 Generated with Claude Code

…r APIs

Add the business-site-numina and business-site-stripe ExternalSecrets
through the namespaced openbao store, and allow HTTPS egress to exactly
api.numina.app and api.stripe.com. The WebApp does not project the new
Secrets: the platform admits one non-optional projection, so a missing
billing entry would stop the public pages from starting. The README
records the projection items and portal-settings lines for later.

The tenant validator, its tests and the publication verifier admit
exactly the new manifests and refuse widened variants. Both billing
flags stay off.

Refs #597

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review for the tenant package admits exactly the two billing ExternalSecrets and FQDN egress, the validators refuse widened variants, and nothing can stop the public pages from starting while the billing entries are missing

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T10:41:21.124582Z 9479635 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Exercised at 94796353:

  • Rendered manifests: kubectl kustomize deploy renders nine resources: three ExternalSecrets, the SecretStore, the WebApp, the CiliumNetworkPolicy, the budget and two routes. node scripts/check-tenant-package.mjs accepts the rendered package.
  • Validators:
    • node --test scripts/tenant-package.test.mjs: 118/118, including 24 new refusals.
    • bash scripts/runtime-verification.test.sh: pass, with new missing-Stripe and altered-Numina controls.
    • bash scripts/publishing-contract.test.sh, bash scripts/runtime-release.test.sh and bash scripts/runtime-publisher-contract.test.sh: pass.
  • Kyverno (CLI 1.19.2, rendered objects, applied as business-site:business-site in a managed-by: kro namespace):
    • restrict-tenant-network-policies: the new policy passes. matchPattern: "*", port-only and toEntities: [world] controls fail.
    • restrict-tenant-secret-stores: the store and all three ExternalSecrets pass. A ClusterSecretStore variant fails.
  • Cilium/DNS: the generated allow-dns is L4-only. A tenant rule naming kube-system is refused, so the FQDN rule relies on platform#6339's DNS-visibility policy.
  • WebApp: the projection is unchanged (business-site-disclosure only). The platform RGD allows one non-optional projection (maxItems=1, optional: false), so the billing Secrets are synced but not mounted.
  • Linters: markdownlint, markdown-table-formatter --check and jscpd (MegaLinter v10.2.0 config; no clone in a changed file) are clean. No live cluster was touched.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9479635389

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown

✅MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 1.91s
✅ CSS stylelint 1 0 0 0 2.69s
✅ GO golangci-lint yes yes no no 179.89s
✅ GO revive 162 0 0 1.24s
✅ HTML djlint 5 0 0 3.82s
✅ HTML htmlhint 5 0 0 0.67s
✅ JSON jsonlint 2 0 0 0.1s
✅ JSON prettier 2 0 0 0 0.94s
✅ JSON v8r 2 0 0 1.67s
✅ MARKDOWN markdownlint 17 0 0 0 2.71s
✅ MARKDOWN markdown-table-formatter 17 0 0 0 0.5s
✅ REPOSITORY betterleaks yes no no 1.01s
✅ REPOSITORY checkov yes no no 23.38s
✅ REPOSITORY git_diff yes no no 0.26s
✅ REPOSITORY grype yes no no 249.98s
✅ REPOSITORY osv-scanner yes no no 217.61s
✅ REPOSITORY secretlint yes no no 1.61s
✅ REPOSITORY syft yes no no 3.75s
✅ REPOSITORY trivy yes no no 14.54s
✅ REPOSITORY trivy-sbom yes no no 0.41s
✅ REPOSITORY trufflehog yes no no 5.06s
✅ SPELL cspell 189 0 0 8.42s
✅ SPELL lychee 24 0 0 183.2s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.2.0 --custom-flavor-setup --custom-flavor-linters COPYPASTE_JSCPD,CSS_STYLELINT,GO_GOLANGCI_LINT,GO_REVIVE,HTML_DJLINT,HTML_HTMLHINT,JSON_JSONLINT,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_GRYPE,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_CSPELL,SPELL_LYCHEE

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@devantler
devantler marked this pull request as ready for review November 15, 2026 14:54
@devantler
devantler requested a review from a team as a code owner November 15, 2026 14:54
@devantler
devantler merged commit 4f0d66f into main Nov 15, 2026
40 checks passed
@devantler
devantler deleted the claude/portal-billing-tenant-597 branch November 15, 2026 14:54
devantler added a commit that referenced this pull request Nov 15, 2026
#598's billing test pinned the WebApp's one projection to
business-site-disclosure and forbade a portal-settings argument. This PR
projects the platform's business-site-runtime instead, with the portal
settings file. The test keeps its point: one Secret, never optional, and no
Numina or Stripe Secret in it.

Refs #302

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devantler added a commit that referenced this pull request Nov 15, 2026
…594)

* feat(deploy): project the platform's runtime Secret into the WebApp

The WebApp now projects the platform-composed `business-site-runtime` Secret
with exactly four items (company-disclosure as disclosure, portal-settings,
portal-client-secret, portal-database-ca) and passes
`--portal-settings-projection /run/webapp-inputs/portal-settings`. While
sign-in is off the settings item holds only a comment line, so the portal
reads none of the other portal items and stays closed.

The package validator admits exactly that Secret, those items and the
appended argument pair, and the package tests refuse missing, renamed,
extra or relocated inputs. The Docker smoke mounts fictional files for all
four items, proves serving fails closed without the disclosure or the
settings item, and keeps the portal closed with a comment-only settings
file. The public receipt check omits the settings argument, which it
refuses by design. The projection fixture now verifies every copied item
and drops macOS tar metadata that a Linux daemon cannot set.

The retained disclosure ExternalSecret is no longer projected; removing it
is a later cleanup. Merge only after `business-site-runtime` exists in
production: without it the Pods cannot start.

Refs #302

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(deploy): keep billing keys out of the runtime projection

#598's billing test pinned the WebApp's one projection to
business-site-disclosure and forbade a portal-settings argument. This PR
projects the platform's business-site-runtime instead, with the portal
settings file. The test keeps its point: one Secret, never optional, and no
Numina or Stripe Secret in it.

Refs #302

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Prepare the tenant package for the portal's Numina and Stripe billing

1 participant