Skip to content

feat: add fetch-kms-secrets composite action#108

Open
qwang1113 wants to merge 1 commit into
OneKeyHQ:mainfrom
qwang1113:feat/fetch-kms-secrets
Open

feat: add fetch-kms-secrets composite action#108
qwang1113 wants to merge 1 commit into
OneKeyHQ:mainfrom
qwang1113:feat/fetch-kms-secrets

Conversation

@qwang1113
Copy link
Copy Markdown

What

Adds fetch-kms-secrets, a composite action that bootstraps CI secrets without any long-lived Volcengine AK/SK:

GitHub OIDC → Volcengine STS AssumeRoleWithOIDC → temporary creds → KMS GetSecretValue → hybrid (AES-256-GCM + RSA-OAEP-SHA256) decrypt → $GITHUB_ENV.

Design

  • Zero runtime dependencies — only Node builtins (crypto/fs/https). No npm install, no bundling, no vendored dist/ — the smallest supply-chain surface for a secret-handling action.
  • scripts/envelope.js — single source of truth for the "OK1" envelope (seal/open), shared by the runtime and the ops CLI so they can never drift.
  • scripts/secret-tool.js — ops CLI: keygen / encrypt / decrypt.
  • STS AssumeRoleWithOIDC is anonymous (matches OneKey backend utils/secrets/volcengine-oidc); only the KMS call is V4-signed (hand-rolled HMAC-SHA256 chain).
  • Two independent control planes: IAM/STS gates "can read KMS"; the RSA private key (a GitHub Secret) gates "can decrypt and use".

Security

  • Every decrypted value + STS credential is ::add-mask::-registered before use; multi-line values are masked per line.
  • volc-kms-region is allowlist-validated before interpolation into the KMS host (anti-SSRF).
  • Remote response bodies and key material never appear in errors; the private key never touches disk.

Tests

npm test (node --test, zero deps) — 22 tests: envelope round-trip, runtime/CLI parity, GCM tamper rejection, malformed-envelope rejection, V4 signature structure, keygen perms/overwrite/bits, runtime fail-fast.

Verification

Verified end-to-end on a real Volcengine account (cn-beijing): OIDC → STS → KMS GetSecretValue → hybrid decrypt → masked value in $GITHUB_ENV.

See fetch-kms-secrets/README.md for usage and the KMS payload contract.

@revan-zhang
Copy link
Copy Markdown
Collaborator

revan-zhang commented May 31, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

GitHub OIDC -> Volcengine STS AssumeRoleWithOIDC -> KMS GetSecretValue ->
hybrid (AES-256-GCM + RSA-OAEP-SHA256) decrypt -> JSON k/v -> $GITHUB_ENV.
Zero runtime deps. scripts/envelope.js is the single source of truth for the
OK1 envelope (shared by the runtime and the ops CLI); scripts/secret-tool.js
provides keygen/encrypt/decrypt.

Hardening: per-line masking for multi-line secret values; allowlist validation
of volc-kms-region before it is interpolated into the KMS host. Unit tests
(node --test) cover the envelope, runtime/CLI parity, V4 signing, keygen, and
fail-fast paths.
@qwang1113 qwang1113 force-pushed the feat/fetch-kms-secrets branch from 782a8ec to d27dd5c Compare June 1, 2026 02:08
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.

2 participants