Dotenvx Secrets 标志

Dotenvx Secrets

组织热门
kortix-ai
dotenvx-secrets

How this repo manages API secrets and the four local-run environments (local/dev/staging/prod). They are dotenvx-ENCRYPTED in git and the keys live in Dotenv Armor. Load this WHENEVER you touch a secret, API key, token, credential, or any apps/api/.env* file; whenever the user pastes a key/token/secret to store or use; whenever choosing/switching which environment to run; and whenever adding, reading, rotating, or sharing a secret.

概览

发布者kortix-ai
代码仓库CompanyOS
技能名称dotenvx-secrets
星标数
20.8K
复刻数
3.5K
附带文件
仅含指令
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 kortix-ai 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Dotenvx Secrets AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/kortix-ai/CompanyOS/tree/dev/.agents/skills/dotenvx-secrets
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kortix-ai/CompanyOS.git /tmp/CompanyOS
mkdir -p .claude/skills
cp -r /tmp/CompanyOS/.agents/skills/dotenvx-secrets .claude/skills/dotenvx-secrets
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Dotenvx Secrets,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Dotenvx Secrets。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Dotenvx Secrets 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Secrets & environments (this repo)

API secrets are encrypted in git with dotenvx; the decryption keys live off-device in Dotenv Armor. This is mandatory — a plaintext secret never belongs in a tracked file.

Armor organization and operational boundary

All API and web profiles belong to the single Armor organization kortix. Always pass --team kortix when pushing or pulling. Never rely on the CLI's personal-team default.

Access is scoped per member, per armored key (Dotenvx Armor FGAC, Business plan; one armored key == one .env* file). Since 2026-08-26 the two PROD keys (apps/api/.env.prod, apps/web/.env.prod) are granted to the owner only. Every other member (admin or member role) has all .env, .env.dev, and .env.staging keys. Armor refuses a non-owner dotenvx run -f .env.prod (PERMISSION_DENIED on CLI 2.x); that is the intended boundary, not a broken login.

Manage access with dotenvx curl (CLI >= 2.18):

sh
dotenvx curl "https://armor.dotenvx.com/api/teams/kortix/members"          # member ids + roles
dotenvx curl "https://armor.dotenvx.com/api/armor/keypairs?per=100"        # keys, named per file
dotenvx curl "https://armor.dotenvx.com/api/teams/kortix/members/<id>/keypairs/<public_key>/grant"  --request POST
dotenvx curl "https://armor.dotenvx.com/api/teams/kortix/members/<id>/keypairs/<public_key>/revoke" --request POST
dotenvx curl "https://armor.dotenvx.com/api/logs?team=kortix&events=keypair/access&keypair=<public_key>"  # who decrypted it

Use the /api/teams/kortix/... routes: the PROD public keys also exist in the leftover kortix-ai-prod team, so the bare /api/armor/keypairs/... routes return DOTENVX_TEAM_REQUIRED. There is no read endpoint for the access matrix; read it in the web UI (Keypair › Team tab) or infer it from /api/logs. A grant/revoke takes effect on the next dotenvx run; it cannot retract a private key already pulled into a local .env.keys — rotate the keypair for that.

The four environments (local-run secrets)

There are four environments, each a separate encrypted file with its own keypair. They differ only in which backend the locally-running API talks to — same code, different DB / Stripe / keys:

pnpm commandEnvFileAPI talks toprivate key in .env.keys
pnpm devlocalapps/api/.env100% local stack (local Supabase in Docker, test Stripe) + runs web + tunnelDOTENV_PRIVATE_KEY
pnpm dev:dev-envdevapps/api/.env.devthe dev stack — dev Supabase DB, test Stripe, dev keys (dev-api.kortix.com)DOTENV_PRIVATE_KEY_DEV
pnpm dev:staging-envstagingapps/api/.env.stagingthe staging stack — staging Supabase DB, test Stripe, staging keys (staging-api.kortix.com)DOTENV_PRIVATE_KEY_STAGING
pnpm dev:prod-envprodapps/api/.env.prodthe prod stack — prod Supabase DB, LIVE Stripe, prod keys (api.kortix.com)DOTENV_PRIVATE_KEY_PROD

What each profile may contain (enforced by pnpm test:envs)

  • .env (local) is the only profile safe to hand to someone without production clearance (trial hires, contractors before a background check). Its DB is local Docker. It must not contain a credential that reaches customer data. scripts/secrets-envs-separation.py fails pnpm test:envs when any key in .env, .env.dev, or .env.staging equals a .env.prod value or a credential DSN (scheme://user:pass@host) names a prod host — the VALUE decides, never the key name, because DATABASE_URL, SUPABASE_URL and KORTIX_URL carry production reach with no KEY/SECRET/TOKEN in the name. A bare host (CLOUDFLARE_ZONE_NAME=kortix.com) or a sender address does not reach prod, and a prod host is any label under kortix.com (only dev, staging and *.kortix.internal are their own stacks); scripts/secrets-shared-with-prod.allowlist lists the remaining shared vendor keys with the reason and the rotation that removes each line, plus the brand values (one public domain, sender address or zone name that serves every environment and can never diverge). An entry waives only the shared-value match, never a prod host or a LIVE key. Do not add to that file to make the test pass — split the credential.

  • .env.dev: the Kortix DEV Supabase project holds signups from dev.kortix.com (2,793 users on 2026-08-26). The owner classifies them as synthetic test accounts, so dev is not customer data. It is still not safe for people without production clearance until every prod-shared vendor key in scripts/secrets-shared-with-prod.allowlist is split (dev/staging carry the prod AWS IAM user, Daytona key, and Pipedream client today).

  • .env.dev / .env.staging / .env.prod mirror the deployed env 1:1. Runtime truth for a deployed env is the AWS Secrets Manager blob kortix-<env>-env (ECS injects it as KORTIX_ENV_JSON; dev in us-east-2, staging and prod in eu-west-2) plus the plain environment entries on the API task definition (KORTIX_PREVIEW_BASE_DOMAIN, LLM_GATEWAY_PROXY_TARGET, …). Nothing syncs the files automatically: kortix-dev-env and kortix-prod-env are edited by operators, kortix-staging-env is rebuilt as existing blob + overrides on each staging deploy. scripts/secrets-sm-parity.py closes the gap: check fails on any SM/task-def key that is missing or different in the file; pull copies SM → file. Keys allowed to exist only in a file (ops metadata, terraform inputs, Cloudflare tokens, the owner record of dead prod keys) are listed in scripts/secrets-file-only.allowlist. Run it with an MFA session: pnpm test:envs --sm (uses AWS_PROFILE=kortix-mfa; refresh with aws sts get-session-token --serial-number arn:aws:iam::935064898258:mfa/markokraemer-mfa --token-code <code>). Direction rule: SM → file for anything already running; file → SM only as a deliberate change with a rollout (aws secretsmanager put-secret-value).

  • Which region to edit. Each blob lives in exactly one region: the region of its row in blob_region (.github/actions/aws-env/fetch.sh). CI and ECS read it there, so edit it there. kortix-ci-env, kortix-preview-env and kortix-dev-env are in us-east-2; kortix-prod-env and kortix-staging-env are in eu-west-2. No blob has a replica, and nothing is in us-west-2: the us-west-2 copies were retired on 2026-10-12 (replication stopped, copies scheduled for deletion on 2026-11-11). A blob without a blob_region row fails the aws-env read; add the row before the first workflow reads it.

  • Each profile owns its internal secrets (INTERNAL_SERVICE_KEY, API_KEY_SECRET, GATEWAY_INTERNAL_TOKEN, TUNNEL_SIGNING_SECRET). INTERNAL_SERVICE_KEY authenticates internal service calls such as the billing cron (apps/api/src/billing/index.ts), so the .env.dev/.env.staging value must equal the deployed env's AWS SM value; rotate both together.

  • pnpm dev runs the full local stack (web + API + local Supabase + tunnel) via scripts/dev-local.sh.

  • pnpm dev:dev-env / pnpm dev:staging-env / pnpm dev:prod-env run the API only, locally, against the selected remote backend (dotenvx run -f apps/api/.env.<environment> -- bun run --hot src/index.ts). They do not start local Supabase.

  • ⚠️ pnpm dev:prod-env points your local API at production — DB writes and Stripe calls are real. Use deliberately.

CRITICAL — .env.prod is NOT what production runs

The deployed production infra loads its env from AWS Secrets Manager at runtime. apps/api/.env.prod is only for running locally against the prod backend. Editing apps/api/.env.prod does not change what production runs — to change real prod secrets, update AWS Secrets Manager.

The one rule (non-negotiable)

Never write a plaintext secret into a tracked file, a commit, or a code/PR artifact. Every secret goes in through dotenvx, which encrypts it in place. The only plaintext that ever exists is in process memory at runtime and in the gitignored apps/api/.env.keys / apps/api/.env.local.

When the user pastes a key/token/secret

Do not paste it into a file, echo it back, or commit it. Store it encrypted in the right env file:

sh
dotenvx set THE_KEY_NAME 'pasted-value' -f apps/api/.env        # local
dotenvx set THE_KEY_NAME 'pasted-value' -f apps/api/.env.dev    # dev
dotenvx set THE_KEY_NAME 'pasted-value' -f apps/api/.env.staging # staging
dotenvx set THE_KEY_NAME 'pasted-value' -f apps/api/.env.prod   # prod

This re-encrypts the file in place (value becomes KEY=encrypted:…). Then commit. No Armor push is needed for a new/changed secret — the keypair is unchanged, so teammates can already decrypt it; the new ciphertext just rides in git.

How it works

  • Every value is AES-encrypted. The public key (encrypts) sits at the top of each file and is safe to commit; the private key (decrypts) never touches git.
  • Private keys live in Dotenv Armor (cloud) and/or the gitignored apps/api/.env.keys.
  • dotenvx run -f <file> -- <cmd> decrypts in memory and injects real env vars — nothing plaintext hits disk.

Commands

TaskCommand
Run local / dev / staging / prodpnpm dev · pnpm dev:dev-env · pnpm dev:staging-env · pnpm dev:prod-env
Verify all 4 envs decrypt + no non-prod value equals or names prodpnpm test:envs (allowlist: scripts/secrets-shared-with-prod.allowlist)
Verify each env file equals its AWS SM blobpnpm test:envs --sm (needs kortix-mfa session); python3 scripts/secrets-sm-parity.py pull <env> copies SM → file
Read a secretdotenvx get KEY -f apps/api/.env (or .env.dev / .env.staging / .env.prod)
Add / change a secretdotenvx set KEY value -f apps/api/.env (or .env.dev / .env.staging / .env.prod), then commit
First time / new machine (non-prod profiles)dotenvx armor login with dotenvx 2.7.1+. pnpm dev and pnpm worktree start then decrypt through the login; no .env.keys needed. For offline runs only: from each app directory, for f in .env .env.dev .env.staging; do dotenvx armor pull --team kortix -f "$f"; done
Run against prod (owner only)pnpm dev:prod-env — decrypts through Armor at run time; do not armor pull -f .env.prod into .env.keys
Share a NEW profile / rotated keyPush every profile with --team kortix
Remove a key from the clouddotenvx armor down --team kortix -f <file>

Armor login security

Use dotenvx 2.7.1 or newer for Armor authentication. Since 2.7.1, a fresh login stores DOTENVX_ARMOR_TOKEN in the native OS secret store when available instead of the plaintext settings file. The repo pins dotenvx 2.38.2, so every pnpm script (pnpm dev, pnpm worktree start, pnpm stripe:listen) reads the same login. dotenvx 1.x reads only the settings file, so a 1.x binary fails with [MISSING_PRIVATE_KEY] after a 2.x login; the API then reports the values it could not decrypt as a dotenvx warning. Existing users must upgrade once and re-authenticate:

sh
dotenvx armor logout
dotenvx armor login

Verify with dotenvx armor status and dotenvx armor settings username. Never print or paste dotenvx armor settings token --unmask into logs, tickets, or shell history.

Automation token caveat

Dotenvx 2.14.0 does not forward run --token to its runtime Armor provider. On a logged-in workstation it can silently fall back to the interactive user's token, making an authorization check look broader than the automation token really is. Verify token scope with an explicit team pull instead:

sh
dotenvx armor pull --token "$DOTENV_ARMOR_TOKEN" --team kortix -f <file>
dotenvx run --no-armor -f <file> -- <command>

Use that sequence only in an ephemeral automation workspace and remove the generated .env.keys when the job ends. Do not use run --token as proof of a team boundary until the upstream forwarding bug is fixed.

Rotating every keypair

dotenvx 2.x has no rotate (2.38.2 included). Run rotation with the last 1.x release, the same pin the deploy workflows use: npx --yes @dotenvx/dotenvx@1.75.1 rotate. dotenvx 1.x cannot read the Armor login (see "Armor login security"), so give it the current key explicitly: DOTENV_PRIVATE_KEY="$(dotenvx keypair DOTENV_PRIVATE_KEY -f .env)" (the suffix follows the file: _DEV, _STAGING). Armor login, push and pull use the repo or global 2.x CLI.

rotate --no-armor deliberately leaves a transitional old,new value in .env.keys. Armor accepts exactly one private key, so never push that combined value. After proving the new ciphertext decrypts, retain only the new private key, push it explicitly to the kortix organization, then prove a clean Armor pull matches the local key before merging. Remove the old armored key only after the rotated ciphertext is merged and available to every authorized consumer.

Keypair rotation blocks an old key from decrypting the new ciphertext. It cannot make somebody forget secrets they already decrypted, and old ciphertext remains in git history. Rotate the underlying vendor credentials too when full credential revocation is required.

Machine-local overrides

Need a different value just on your machine? Put it in the gitignored apps/api/.env.local (plaintext is fine — never committed). Bun loads it at higher precedence than apps/api/.env. Never edit a committed profile file to a machine-local value.

Guardrails (don't bypass)

  • apps/api/.env.keys, apps/api/.env.local, apps/web/.env, supabase/.env are gitignored.
  • Version-controlled git hooks in .githooks/, armed automatically by pnpm install (the root package.json prepare script runs git config core.hooksPath .githooks; run it by hand only if you never installed deps). Every committable .env is dotenvx-managed, no exceptions: the pre-commit hook discovers any staged .env/.env.<env> (new services included) and auto-encrypts it (--no-armor, mints a keypair into the adjacent .env.keys for new files), then blocks the commit if any unencrypted, non-gitignored .env remains; pre-push re-checks. Excluded: .env.keys (private keys) and .env.example (templates); gitignored files like .env.local / supabase/.env are never staged so they're untouched.
  • .gitleaks.toml exempts only the dotenvx ciphertext lines in the encrypted profiles (condition = "AND" + regexTarget = "line" + encrypted: / DOTENV_PUBLIC_KEY regexes), so secret-scan passes while a plaintext value in those same files still fails. Never write a path-only allowlist — it exempts the whole file. Until 2026-08-29 this one was path-only, and a plaintext apps/api/.env carrying a Postgres password and an HMAC secret scanned as no leaks found. secrets-guard.yml now fails the build if a path-only allowlist reappears.
  • secrets-guard.yml runs pnpm secrets:check (scripts/check-env-encrypted.sh) on every PR: a structural assertion that every value in a committed .env profile starts with encrypted:. It catches what patterns miss — a plaintext postgres://user:pass@host slips past gitleaks but not this. Run it locally any time.
  • Note the gate shapes: pre-commit step 1b reads every staged .env from the index and refuses a value that is not encrypted:…, with any dotenvx version. pre-push runs dotenvx ext precommit (deprecated in 2.x, still blocking). gitleaks runs on the pull request, i.e. after the push. Only the hook runs before the commit exists.
  • dotenvx protect is a one-time machine setup, never a hook step. It installs a global git clean filter (filter.dotenvx.* with required = true in ~/.gitconfig, .env* patterns in the global attributes file) that encrypts .env* on git add. The filter runs the binary that installed it, so install it with the global CLI from outside any checkout: cd ~ && ~/.local/bin/dotenvx protect (or wherever which dotenvx points). Run from a worktree's node_modules, it points every repository at that worktree, and git add of a .env* file fails (exit 128) once the worktree is removed. Repair: run the same command again. Check with git config --global --get filter.dotenvx.clean.
  • GitHub secret-scanning push protection is enabled on the repo.

If a guard fires, the fix is to encrypt the value, never to bypass it.

The web app (apps/web) — same setup

apps/web has the same four encrypted profiles (apps/web/.env / .env.dev / .env.staging / .env.prod) and its own keypairs in apps/web/.env.keys. All keys live in the kortix Armor organization. Decrypted the same way: pnpm dev (via load_local_env) and the environment-specific web scripts.

Maintenance state: the database is the source of truth (kortix.platform_settings['maintenance_config'], public GET /v1/system/maintenance, admin-only PUT /v1/system/maintenance, set from /admin/utils). The web app mirrors it into Vercel Edge Config (EDGE_CONFIG, EDGE_CONFIG_ID, VERCEL_API_TOKEN in apps/web/.env.{dev,staging,prod}) so the web middleware reads it without the API. The admin blocking level locks the web app only; the api-router Worker refuses API and gateway writes only when an operator sets MAINTENANCE_LEVEL_OVERRIDE=blocking on it (infra/cloudflare/workers/api-router/wrangler.toml). dev, staging and prod share ONE Edge Config store, so each environment owns its own key maintenance_config_<prod|staging|dev>, derived from the API host (apps/web/src/lib/maintenance-store.ts). The legacy shared key maintenance_config in that store is no longer read.

Out of scope (not dotenvx-managed)

supabase/.env (local Supabase CLI / GitHub OAuth) is intentionally plaintext + gitignored — it's auto-loaded by the Supabase CLI, which can't read dotenvx encryption. Don't try to dotenvx-manage it.

常见问题

Dotenvx Secrets AI 技能有什么作用?

How this repo manages API secrets and the four local-run environments (local/dev/staging/prod). They are dotenvx-ENCRYPTED in git and the keys live in Dotenv Armor. Load this WHENEVER you touch a secret, API key, token, credential, or any apps/api/.env* file; whenever the user pastes a key/token/secret to store or use; whenever choosing/switching which environment to run; and whenever adding, reading, rotating, or sharing a secret.

为什么在 TypingMind 中使用 Dotenvx Secrets?

因为您只需安装一次,就能搭配任何模型使用。Dotenvx Secrets 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Dotenvx Secrets?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/kortix-ai/CompanyOS/tree/dev/.agents/skills/dotenvx-secrets。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Dotenvx Secrets?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Dotenvx Secrets 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Dotenvx Secrets 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Dotenvx Secrets AI 技能免费吗?

kortix-ai 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇