feat: add fetch-kms-secrets composite action#108
Open
qwang1113 wants to merge 1 commit into
Open
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 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.
782a8ec to
d27dd5c
Compare
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.
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 → KMSGetSecretValue→ hybrid (AES-256-GCM + RSA-OAEP-SHA256) decrypt →$GITHUB_ENV.Design
crypto/fs/https). Nonpm install, no bundling, no vendoreddist/— 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.AssumeRoleWithOIDCis anonymous (matches OneKey backendutils/secrets/volcengine-oidc); only the KMS call is V4-signed (hand-rolled HMAC-SHA256 chain).Security
::add-mask::-registered before use; multi-line values are masked per line.volc-kms-regionis allowlist-validated before interpolation into the KMS host (anti-SSRF).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.mdfor usage and the KMS payload contract.