You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go SDK: one wrong character in CS_CLIENT_KEY makes NewClient hang at full CPU, past its context deadline #1850
The Go SDK is in languages/golang in this repository. It encrypts values in a Go program, and gets its keys from ZeroKMS, CipherStash's key management service. In November 2026 we audited version v0.1.0-rc.7 by building programs against a dev workspace and PostgreSQL 17 with EQL (Encrypt Query Language) v4.
Problem
We changed one character at the end of a real CS_CLIENT_KEY and called NewClient with a context deadline. NewClient did not return. The process used a full CPU core, and was stopped after 10 minutes.
A typo in a deployment's secret hangs the service at start, instead of failing with a clear error.
Proposal
Validate the client key's encoding before any expensive step, and return ErrConfig that names CS_CLIENT_KEY.
Make sure NewClient returns when its context ends, whatever the guest is doing.
Add a test with a malformed key and a short deadline.
Evidence
Verified by running code. The key with one wrong character came from a real client key.
Status
#1914 does part of this issue. It does not close it.
Done in fix(golang): refuse a malformed client key at once, with ErrConfig #1914: steps 1 and 3. stack-kms refuses a client key whose permutations are invalid, before any key is derived. encrypt.NewClient checks the key's encoding first, and returns the new encrypt.ErrConfig, with Help that names CS_CLIENT_KEY. A test covers a malformed key.
Left to do: step 2. NewClient does not yet return when its context ends while the guest is still working.
Step 2 is left because stopping a running guest needs wazero's WithCloseOnContextDone. That option was removed from the encrypt runtime on 2026-11-23, because it made decrypt cost about 4 times the CPU. The other way is to let NewClient return while the stuck step keeps running in a goroutine. That leaves a goroutine and one CPU core busy for as long as the guest runs.
#1911 tracks the same malformed-key problem in the other language SDKs.
Activity
docs(stack-kms): describe the permutation check without a private link
fix(stack-kms): refuse a keyset that does not parse with a fixed message
refactor(golang): build the key encoding error in one helper