Infisical Integration Guide

Technology: infisical · Category: tooling · Last reviewed: 2026-10-20

Source: https://tech-stack.codeamanilabs.org/guide/infisical

Insight:

Infisical is the team-scale, deployed counterpart to codeAmani's local Hazina vault: a Machine Identity fetches secrets at runtime, and on Vercel or GitHub Actions OIDC auth removes even the bootstrap secret. Secret Syncs push values into Vercel/GitHub for you. Rotation and dynamic secrets need the Advanced plan ($40/identity/mo), and the CLI now nests secrets commands under infisical sm.

██╗███╗   ██╗███████╗██╗███████╗██╗ ██████╗ █████╗ ██╗
██║████╗  ██║██╔════╝██║██╔════╝██║██╔════╝██╔══██╗██║
██║██╔██╗ ██║█████╗  ██║███████╗██║██║     ███████║██║
██║██║╚██╗██║██╔══╝  ██║╚════██║██║██║     ██╔══██║██║
██║██║ ╚████║██║     ██║███████║██║╚██████╗██║  ██║███████╗
╚═╝╚═╝  ╚═══╝╚═╝     ╚═╝╚══════╝╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝

Infisical Integration Guide

Focus: Centralize codeAmani's deployed secrets (Anthropic/OpenAI keys, Stripe, Supabase/Neon URLs, Cloudflare R2, and Daraja/M-Pesa for Kenya-targeted projects) in one open-source, self-hostable platform. Workloads authenticate as a Machine Identity: Universal Auth anywhere, or OIDC from Vercel and GitHub Actions so there's no long-lived secret at all. Inject locally with infisical sm run, push to platforms with Secret Syncs, and catch leaks with infisical scan.

Overview

Infisical is an open-source (MIT core) security platform. Its products are now Secrets Management, Certificate Management (PKI), KMS, Privileged Access (PAM), Agent Vault (a credential-brokering proxy for AI agents), and Secret Scanning. For codeAmani, Secrets Management is the main one. Secrets are organized as project → environment → folder path.

Ways to consume secrets, from least to most code:

Surface What it does When codeAmani uses it
Secret Syncs Infisical pushes a project path into Vercel env vars, GitHub Actions secrets, Netlify, Cloudflare Workers, Supabase, and 50+ other destinations. Changes propagate automatically Default for Vercel apps: no runtime code, no cold-start fetch
CLI infisical sm run -- <cmd> Injects secrets as env vars into a child process; nothing is written to disk Local dev, scripts, containers
GitHub Action Infisical/secrets-action Fetches secrets into a job via OIDC or Universal Auth CI/CD
Infisical Agent (infisical agent) Daemon that renews tokens and renders secrets/leases to files through Go templates VMs, containers, sidecars
SDK @infisical/sdk (Node), infisicalsdk (Python) Fetches at runtime; also handles dynamic-secret leases and KMS encrypt/sign Long-running servers, rotation-aware code
MCP server @infisical/mcp Lets Claude/Cursor list, read, and create secrets through tools Admin chores from an agent, with read-only tools and masking on

How it relates to Hazina

codeAmani's own Hazina vault (packages/hazina) is local-only. It keeps developer-machine credentials encrypted under Windows DPAPI, and coding agents see only ${VAULT:…} references. Infisical is the deployed, team-scale layer: it serves secrets to running workloads, CI, and teammates, and it adds rotation, dynamic secrets, syncs, and audit logs. The two fit together:

flowchart LR
  subgraph Dev["Developer machine"]
    H["Hazina vault<br/>DPAPI-encrypted, local only"]
  end
  subgraph Inf["Infisical project · env · path"]
    S["Secrets"]
    R["Rotation · Dynamic secrets"]
  end
  H -->|"bootstrap creds"| CLI["infisical sm run"]
  CLI --> S
  S -->|"Secret Sync"| V["Vercel env vars"]
  S -->|"Secret Sync"| G["GitHub Actions secrets"]
  F["Vercel function"] -->|"OIDC JWT"| Inf
  R --> S

Official Documentation

Resource URL
Introduction https://infisical.com/docs/documentation/getting-started/introduction
Node SDK https://infisical.com/docs/sdks/languages/node
CLI reference (all commands) https://infisical.com/docs/cli/reference
Machine identities https://infisical.com/docs/documentation/platform/identities/machine-identities
Universal Auth https://infisical.com/docs/documentation/platform/identities/universal-auth
OIDC Auth (general) https://infisical.com/docs/documentation/platform/identities/oidc-auth/general
OIDC Auth (GitHub) https://infisical.com/docs/documentation/platform/identities/oidc-auth/github
Secret Syncs https://infisical.com/docs/integrations/secret-syncs/overview
Secret rotation https://infisical.com/docs/documentation/platform/secret-rotation/overview
Dynamic secrets https://infisical.com/docs/documentation/platform/dynamic-secrets/overview
Infisical Agent https://infisical.com/docs/integrations/platforms/infisical-agent
KMS https://infisical.com/docs/documentation/platform/kms/overview
Certificate Management (PKI) https://infisical.com/docs/documentation/platform/pki/overview
Docs MCP server and AI setup https://infisical.com/docs/documentation/getting-started/set-up-with-ai
Self-hosting https://infisical.com/docs/self-hosting/overview
Pricing https://infisical.com/pricing

Versions verified 2026-10-20

Thing Version Source
@infisical/sdk (Node) 5.0.2; requires Node.js 20+ npm view, Node SDK docs
@infisical/cli 0.44.3 (released 2026-10-19) npm view, github.com/Infisical/cli/releases
@infisical/mcp 0.0.24 (bundles @infisical/sdk 4.0.1) npm view
infisicalsdk (Python) 1.0.17 PyPI JSON
Infisical/secrets-action v1.0.18 (docs examples still show v1.0.16) GitHub releases
@vercel/oidc 4.0.1 npm view
Server image infisical/infisical v0.166.8 (2026-10-15) Docker Hub, GitHub releases

1. Machine identities: pick the auth method

A Machine Identity is the non-human principal that your app, CI job, or agent logs in as. You give it an organization role, then add it to each project with a project role. Each identity can hold several auth methods. Remove Universal Auth from identities that should only log in via OIDC; otherwise the client-secret path stays open.

Where the code runs Auth method Long-lived secret?
Vercel Functions OIDC Auth with Vercel's OIDC token None
GitHub Actions OIDC Auth (method: oidc) None
AWS Lambda / EC2 AWS IAM Auth (SDK awsIamAuth.login) None
Kubernetes Kubernetes Auth (Agent / Operator) None
Anything else (Netlify, Render, a laptop) Universal Auth (client ID + client secret) Yes, so rotate it

Universal Auth defaults (from the Universal Auth docs):

Secret zero: set an Access Token Period to get a renewable, non-expiring token, and give the client secret Max Uses = 1. The workload logs in once, then calls POST /api/v1/auth/universal-auth/renew (SDK: client.auth().universalAuth.renew()) before each period ends.

Bootstrap credentials (Universal Auth only)

These two values are the only ones that stay outside Infisical. Keep them in Hazina locally and in the platform's encrypted env store in production:

INFISICAL_CLIENT_ID=your-machine-identity-client-id
INFISICAL_CLIENT_SECRET=your-machine-identity-client-secret

Non-secret settings go in plain config:

Variable Example Notes
INFISICAL_SITE_URL https://app.infisical.com US Cloud default. EU Cloud: https://eu.infisical.com. Self-hosted: your URL
INFISICAL_PROJECT_ID <project-uuid> The CLI and SDK require it when you authenticate as a machine identity
INFISICAL_ENV dev | staging | prod Environment slug; match the slugs your project uses
INFISICAL_IDENTITY_ID <machine-identity-uuid> OIDC Auth only (Vercel / GitHub). Not a secret

2. SDK: fetch secrets at runtime (Node)

npm install @infisical/sdk@5.0.2    # v5 requires Node.js 20+; 4.0.0 is the oldest supported line
import { InfisicalSDK } from "@infisical/sdk";

// Defaults to https://app.infisical.com. Pass { siteUrl } for EU Cloud or self-hosted.
const client = new InfisicalSDK({ siteUrl: process.env.INFISICAL_SITE_URL });

await client.auth().universalAuth.login({
  clientId: process.env.INFISICAL_CLIENT_ID!,
  clientSecret: process.env.INFISICAL_CLIENT_SECRET!,
});

const secret = await client.secrets().getSecret({
  secretName: "STRIPE_SECRET_KEY",
  projectId: process.env.INFISICAL_PROJECT_ID!,
  environment: "prod",
  secretPath: "/payments",
  expandSecretReferences: true,
});
// Use secret.secretValue. Never log it.

SDK v5 facts, checked against the 5.0.2 type declarations:

Full helper: examples/fetch-secrets.ts.

3. OIDC from Vercel: no client secret at all

Vercel signs a short-lived OIDC JWT for each deployment. Infisical checks it against Vercel's discovery document and returns an access token. Nothing long-lived is stored.

Set up the identity under Authentication → OIDC Auth:

Field Value (team issuer mode)
OIDC Discovery URL https://oidc.vercel.com/<team-slug>
Issuer https://oidc.vercel.com/<team-slug>
Subject owner:<team-slug>:project:<project-name>:environment:production
Audiences https://vercel.com/<team-slug>

In the function, use getVercelOidcToken() from @vercel/oidc 4.x:

import { getVercelOidcToken } from "@vercel/oidc";
import { InfisicalSDK } from "@infisical/sdk";

const siteUrl = process.env.INFISICAL_SITE_URL ?? "https://app.infisical.com";

export async function infisicalFromVercelOidc(): Promise<InfisicalSDK> {
  const jwt = await getVercelOidcToken();
  const res = await fetch(`${siteUrl}/api/v1/auth/oidc-auth/login`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ identityId: process.env.INFISICAL_IDENTITY_ID, jwt }),
  });
  if (!res.ok) throw new Error(`Infisical OIDC login failed: HTTP ${res.status}`);
  const { accessToken } = (await res.json()) as { accessToken: string };
  return new InfisicalSDK({ siteUrl }).auth().accessToken(accessToken);
}

Full version with token caching: examples/vercel-oidc-auth.ts.

Simpler option: if the app only needs values as env vars, skip runtime fetching and use a Vercel Secret Sync (§6). Reach for OIDC + SDK when you need dynamic-secret leases, KMS, or secrets that change without a redeploy.

4. CLI: local dev, export, scanning

Install with npm install -g @infisical/cli, brew install infisical/get-cli/infisical, winget install infisical, or scoop install infisical. The Linux packages moved to artifacts-cli.infisical.com. Cloudsmith stopped serving them on 2026-09-16, and a stale apt source now makes apt-get update fail for every package on the machine.

Changes in the CLI 0.44 line that can break existing scripts:

infisical login                    # browser; falls back to terminal prompts
infisical init                     # writes .infisical.yaml (project id only)

infisical sm run -- npm run dev                                  # dev env by default
infisical sm run --env=prod --path=/shared --path=/backend -- node server.js   # last --path wins
infisical sm run --watch -- npm run dev                          # restart when secrets change

# Machine identity (CI / scripts): --projectId is REQUIRED
export INFISICAL_TOKEN=$(infisical login --method=universal-auth \
  --client-id="$INFISICAL_CLIENT_ID" --client-secret="$INFISICAL_CLIENT_SECRET" --silent --plain)
infisical sm run --projectId="$INFISICAL_PROJECT_ID" --env=prod -- npm start

eval "$(infisical sm export --format=dotenv-eval)"   # safe-quoted shell export
infisical scan                                        # code + git history; exits 1 on findings
infisical scan install --pre-commit-hook

Patterns: examples/infisical-run.sh. Cheatsheet: reference/cli-cheatsheet.md.

5. CI/CD: GitHub Actions with OIDC

Prefer OIDC: GitHub mints a JWT for each job, and Infisical exchanges it for an access token. No client secret lives in GitHub.

Configure the identity's OIDC Auth:

New GitHub subject format: on GitHub.com, repos created after 2026-07-15 use immutable subjects that include numeric IDs, for example repo:octocat@583231/example-repo@1296269:ref:refs/heads/main. Decode a real token with github/actions-oidc-debugger before you set the subject.

# .github/workflows/deploy.yml
permissions:
  id-token: write     # required to request the OIDC JWT
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - uses: Infisical/secrets-action@v1.0.18
        with:
          method: "oidc"
          identity-id: ${{ vars.INFISICAL_IDENTITY_ID }}   # not a secret
          project-slug: "your-project-slug"                # v1.0.18 also accepts project-id
          env-slug: "prod"
          secret-path: "/"
          # domain: "https://eu.infisical.com"             # EU Cloud or self-hosted
      - run: npm run deploy                                # secrets are now env vars

Action inputs, from the docs:

Input Default Notes
method universal Or oidc, aws-iam
project-slug, env-slug — Required
identity-id — Required for oidc and aws-iam
client-id, client-secret — Required for universal
oidc-audience — Custom aud claim
secret-path /
recursive false Include subfolders
include-imports true
export-type env Or file
file-output-path /.env Used when export-type is file
domain https://app.infisical.com
extra-headers — For instances behind a header-based firewall

Release v1.0.17 added secret-name (fetch a single secret), and v1.0.18 added project-id. Full workflow: examples/github-actions-oidc.yml.

6. Secret Syncs: push to Vercel and GitHub

A Secret Sync combines an App Connection (credentials for the destination), a source (project environment + path), a destination, and options. With Auto-Sync on, changes propagate automatically.

Plan limits: 10 syncs on Free, 25 on Pro, 50 on Advanced, unlimited on Enterprise.

7. Secret rotation and dynamic secrets

Rotation replaces a stored credential on an interval. Most providers are dual-phase: two credential sets overlap (active → inactive → revoked), so there's no downtime. Each rotation needs an App Connection with permission to create and revoke keys.

Rotation providers relevant to codeAmani:

Dynamic secrets generate a fresh credential for each lease, with a TTL, and revoke it when the lease ends. Supported targets include PostgreSQL, MySQL, Redis, MongoDB/Atlas, AWS/GCP IAM, Kubernetes, GitHub, SSH, and TOTP. To lease from the SDK:

const { lease } = await client.dynamicSecrets().leases.create({
  dynamicSecretName: "neon-readonly",
  projectSlug: "your-project-slug",
  environmentSlug: "prod",
  ttl: "15m",               // vercel/ms string; defaults to the secret's default TTL
});
// lease.data holds the credentials; lease.expiresAt tells you when to renew.
await client.dynamicSecrets().leases.renew(lease.id, {
  projectSlug: "your-project-slug", environmentSlug: "prod", ttl: "15m",
});

Plan gate: on Cloud, full rotation and dynamic secrets need the Advanced plan ($40/identity/mo, billed annually). Pro only rotates public databases and has no dynamic secrets. Self-hosted instances need an Enterprise licence for these features.

Example: examples/leases-and-kms.ts.

8. Infisical Agent (token renewal + file injection)

Use the Agent on VMs and containers where you can't change the app code. Run infisical agent --config agent.yaml. The Agent:

Sample config: examples/agent-config.yaml.

Two similarly named features are different things:

9. KMS and PKI

10. MCP servers: setup and troubleshooting

Infisical has two MCP servers. Don't mix them up:

Server Transport Auth Use
Docs MCP https://infisical.com/docs/mcp Remote HTTP None Search and read the current docs
Infisical MCP @infisical/mcp 0.0.24 Local stdio (npx) Machine identity Manage secrets, projects, environments, folders
claude mcp add --transport http infisical-docs https://infisical.com/docs/mcp

@infisical/mcp reads these env vars:

It exposes 10 tools: list-secrets, get-secret, create-secret, update-secret, delete-secret, list-projects, create-project, create-environment, create-folder, and invite-members-to-project.

Lock it down: set INFISICAL_ENABLED_TOOLS=list-projects,list-secrets,get-secret and INFISICAL_MASK_SECRET_VALUES=true, so secret values never enter the model's context. Back it with a read-only identity scoped to one project.

CONNECT_TIMEOUT after 30000 ms (the error the codeAmani session hit on 2026-10-20) has these usual causes:

  1. Cold npx -y download. The first run downloads the package and its dependencies, which can take longer than Claude Code's 30 s connect window. Pre-install it (npm i -g @infisical/mcp@0.0.24) and point the config at node <npm-root -g>/@infisical/mcp/dist/index.js. Or start claude with MCP_TIMEOUT=60000 to widen the window.
  2. Windows + npx. A bare npx command can hang on Windows. Use "command": "cmd", "args": ["/c", "npx", "-y", "@infisical/mcp@0.0.24"], or the node path above.
  3. Missing env vars fail fast; they don't time out. The server validates its env with zod at startup and exits, which shows up as connection closed. Login is lazy (it happens on the first tool call), so a bad client secret shows up as a tool error, not a connect failure.
  4. Pin the version and skip the global bin. The global bin is named mcp, which can collide with other packages, so prefer the explicit node …/dist/index.js path.
  5. Test outside Claude: run npx @modelcontextprotocol/inspector node <path>/dist/index.js with the env vars set.

Full walkthrough: reference/mcp-setup.md.

11. Pricing (Secrets Management, checked 2026-10-20)

Plan Price Identities Envs / project Syncs Rotation Dynamic Audit log
Free $0 5 (human + machine) 3 10 No No n/a
Pro $20/identity/mo annual · $23 monthly Unlimited 6 25 Public DBs only No 30 days
Advanced $40/identity/mo annual · $46 monthly Unlimited 12 50 Yes Yes 90 days
Enterprise Custom (annual) Unlimited Unlimited Unlimited Yes Yes Custom

Machine identities count as identities, so a project with 3 developers and 3 workload identities already exceeds Free's limit of 5. Paid plans include a 30-day trial.

Other products are priced separately:

12. Self-hosting

The MIT-licensed core is free to self-host. Enterprise features (SSO enforcement, gateways, rotation and dynamic secrets, HSM) need a licence.

For EU data residency without self-hosting, use EU Cloud at https://eu.infisical.com.

codeAmani notes

Official docs: