feat(selfhost): optional Infisical secrets management for self-host deploys - #5785
Conversation
…eploys
Adds a maybe_infisical_run helper (scripts/lib/selfhost-deploy-common.sh)
that prefixes a command with `infisical run --` when SELFHOST_USE_INFISICAL=1
is set, wiring Infisical's own intended integration shape in at the
deploy-script level with zero application code changes. Strictly opt-in:
unset (the default), neither deploy script even checks whether the
infisical binary exists, so an operator who has never heard of Infisical
is completely unaffected. Wired into both deploy-selfhost-image.sh and
deploy-selfhost-prebuilt.sh's restart (`docker compose up`) step only --
the actual container process launch, not the image pull/build steps that
don't need injected secrets.
Documents setup (cloud vs. self-hosted Infisical) and, importantly, the
real technical boundary of this integration: infisical run -- only injects
vars into its own child process's environment, which Docker Compose only
picks up for environment: entries using ${VAR} interpolation -- not for
the blanket env_file: .env passthrough the native-secrets list (GitHub
App key, webhook secret, API/MCP tokens, etc.) already uses. The docs are
explicit that Infisical is additive for other variables, not a drop-in
override for those pre-wired secrets.
Closes JSONbored#5120
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5785 +/- ##
=======================================
Coverage 95.06% 95.06%
=======================================
Files 580 580
Lines 46156 46156
Branches 14804 14804
=======================================
Hits 43880 43880
Misses 1516 1516
Partials 760 760
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-14 15:41:56 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
maybe_infisical_runhelper (scripts/lib/selfhost-deploy-common.sh) that prefixes a command withinfisical run --whenSELFHOST_USE_INFISICAL=1is set — Infisical's own intended integration shape, wired in at the deploy-script level with zero application code changes (src/never knows or cares which mechanism supplied a givenenv.SOMETHING).infisicalbinary exists — an operator who has never heard of Infisical is completely unaffected.deploy-selfhost-image.shanddeploy-selfhost-prebuilt.sh, but only at the restart (docker compose up) step — the actual container process launch — not the image pull/build steps, which don't need injected secrets.docs/self-hosting-security, plus — importantly — the real technical boundary of this integration:infisical run --only injects vars into its own child process's environment, which Docker Compose only picks up forenvironment:entries using${VAR}interpolation, not for the blanketenv_file: .envpassthrough the native-secrets list (GitHub App key, webhook secret, API/MCP tokens, etc.) already uses. The docs are explicit that Infisical is additive for other variables, not a drop-in override for those pre-wired secrets — so operators don't assume broader coverage than the integration actually has.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Closes #5120
Validation
git diff --checknpm run actionlint(ran as part ofnpm run test:ci)npm run typechecknpm run test:coverage— ran the full suite; 48 test files / 130 tests fail identically on a cleanupstream/maincheckout with zero changes (confirmed by stashing this PR's diff and re-running on the exact same base commit) — pre-existing, broad Windows-environment flakiness (subprocess-timing, symlink-handling, and native-SQLite-behavior tests) unrelated to this change. None of the failing files are ones this PR touches.npm run ui:lintnpm run ui:typechecktest/unit/selfhost-deploy-common.test.ts(new — coversmaybe_infisical_run's opt-in/opt-out and fail-closed-when-missing branches directly) andtest/unit/selfhost-image-deploy.test.ts(extended — confirms the wrapper is actually wired into the real deploy script's restart step, and only that step)If any required check was skipped, explain why:
npm run cf-typegen:check(part ofnpm run test:ci) fails locally on this Windows dev machine with awrangler ENOENT—scripts/gen-cf-typegen.mjscallsexecFileSync("wrangler", ...)withoutshell: true, which cannot invoke npm's.cmdshim on Windows (reproduces in isolation, independent of any change in this PR; passes fine on the actual CI's Linux runners). Every step innpm run test:cibefore that point passed.infisicalbinary standing in for the real CLI: the opt-in flag genuinely gates whether infisical is invoked at all (both directions), the wrapper fails closed with a clear error whenSELFHOST_USE_INFISICAL=1but theinfisicalbinary isn't installed (rather than silently deploying without the secrets an operator asked for), and only the restart/upstep is wrapped, notpull. A maintainer or another contributor with a real Infisical account should verify end-to-end before this integration is fully trusted — the shell-level wrapping logic is solid, but I cannot personally attest that real Infisical-sourced secrets resolve into a running container.Safety
UI Evidencesection. N/A — this PR's onlyapps/loopover-uichange is a static documentation page (new prose section on an existing docs route); no interactive/stateful UI surface to screenshot.docs/self-hosting-securityupdated; no changelog edit.)Notes
.env+ Docker Composesecrets:path is untouched and unaffected — confirmed by the existingselfhost-image-deploy.test.tssuite's pre-existing tests all still passing unmodified alongside the new Infisical-specific ones.