feat(secrets): Infisical $secret provider (H1)#150
Merged
Conversation
Register a self-hosted (or cloud) Infisical as a Tier-2 secrets backend, mirroring the Vault provider (dependency-free net/http, no SDK). Auth is either Universal Auth (machine identity: clientId + client secret exchanged for a short-lived access token) or a static service/access token used directly as a Bearer token. Secrets are read via GET /api/v3/secrets/raw/<name>?workspaceId&environment&secretPath. Marker key grammar "[<secretPath>#]<secretName>" (path defaults to "/"); project and environment are fixed per named provider (register multiple for multiple envs), mirroring how Vault takes a namespace. Config: a `type: infisical` entry under secrets.providers reusing address/tokenSecret* and adding clientId/projectId/environment. Only the resolved value is used transiently (handed to provider.Apply); never persisted — same discipline as every $secret backend. Unit-tested with a fake Infisical server: universal-auth + static-token happy paths, bad credentials, missing secret (404), malformed key, no-auth, and end-to-end through the registry + resolver. Also switches registerConfiguredSecretProviders' loop to index-based iteration (the enlarged config struct tripped gocritic's rangeValCopy).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
H1 — Infisical
$secretproviderRegisters a self-hosted (or cloud) Infisical as a Tier-2 secrets backend, so openctl can read secrets from it via
{$secret: {provider: "infisical", key: "..."}}. Mirrors the existing Vault provider (dependency-freenet/http, no SDK).Auth (two modes)
clientId+ a client secret are exchanged at/api/v1/auth/universal-auth/loginfor a short-lived access token.clientIdis set, the configured token is used directly as a Bearer service/access token.Secrets are then read via
GET /api/v3/secrets/raw/<name>?workspaceId&environment&secretPathwith the Bearer token.Marker + config
[<secretPath>#]<secretName>— path defaults to/. e.g.key: "DB_PASSWORD"orkey: "/app/prod#DB_PASSWORD".namespace).type: infisicalentry undersecrets.providers, reusingaddress/tokenSecret/tokenSecretFileand addingclientId/projectId/environment.Only the resolved value is used transiently (handed to
provider.Apply); never persisted — the same git-safety discipline as every$secretbackend. Deploying Infisical itself is a plain HelmRelease.Tests
Fake Infisical
httptestserver: universal-auth + static-token happy paths, bad credentials, missing secret (404), malformed key, no-auth-configured, and end-to-end through the registry + resolver.Also switches
registerConfiguredSecretProviders' loop to index-based iteration (the enlarged config struct tripped gocritic'srangeValCopy).Local CI: build,
go test ./...(+-raceon secrets), gofmt, vet, staticcheck, golangci-lint (0 issues), modernize — all green.