Repository navigation
JavaScript GCP KMS Storage: document v1.1.0 behavior changes and fix README gaps (KSM-1536) - #1200
Conversation
…S storage README gaps (KSM-1536) CHANGELOG.md was excluded from the published npm tarball, so the only place the v1.1.0 behavior changes were documented never reached a consumer who installs from npm. Added it to package.json's files array. Added a Behavior Notes section to the README covering the Node 20 floor, the directory-write and symlink-replacement requirements, the zero-length-config hard error, and the 0600 file mode. Added an explicit warning to the Decrypt Config section: decryptConfig(true) writes the client ID, app key, and device private key to disk in plaintext, and documented how to re-encrypt (call init() again, which detects and re-encrypts a plaintext config automatically). Documented KSM_CONFIG_FILE and its precedence against the constructor argument. Corrected the IAM role discrepancy between the README and GcpKeyConfig.ts, verified against both the actual GCP KMS API calls this package makes (getCryptoKey, getPublicKey, encrypt, decrypt, asymmetricDecrypt -- no key/keyring-management calls anywhere) and Google's own predefined-role permission tables: removed roles/cloudkms.admin from GcpKeyConfig.ts, which this package never needs, and added roles/cloudkms.viewer to both files, since none of the other three listed roles include cloudkms.cryptoKeys.get, which getKeyDetails() calls via getCryptoKey().
mgallego-keeper
left a comment
There was a problem hiding this comment.
Summary
This PR adds CHANGELOG.md to the files array in package.json. It adds a Behavior Notes section and a plaintext-autosave warning to README.md. It also corrects the IAM role list in both README.md and src/GcpKeyConfig.ts.
Verification
I read src/GcpKmsClient.ts and src/utils.ts directly. This package only calls getCryptoKey, getPublicKey, encrypt, decrypt, and asymmetricDecrypt against the GCP KMS API. It never calls a key- or keyring-management operation. Removing roles/cloudkms.admin from the doc comment is correct.
I checked Google's own Cloud KMS permissions-and-roles reference. roles/cloudkms.viewer is the only one of the four listed roles that includes cloudkms.cryptoKeys.get. getKeyDetails() needs that permission through getCryptoKey(). Adding roles/cloudkms.viewer is correct and minimal. None of the other three roles need to change.
I checked the new Behavior Notes section, the decryptConfig(true) warning, and the KSM_CONFIG_FILE documentation against the actual source. Each one matches loadConfig()'s re-encryption branch and the constructor's fallback chain.
I merged this PR onto the release branch tip and ran npm ci and the full test suite. All 124 tests pass, as expected for a docs-and-comment change.
Merge order
See the note on #1189 for the overlap and merge order across #1196 to #1200. This PR and #1198 both add a line to CHANGELOG.md at the same point in the file. That produces a real merge conflict, confirmed by testing it directly. The fix is a one-line manual resolution: keep both new lines.
1ce01c4
into
release/storage/javascript/gcp-kms/v1.1.0
…-1534-package-json-engines-overrides Brings the branch up to date with #1200-#1203 and #1199 (it was cut before #1200 merged). Resolves the CHANGELOG conflict by keeping both the KSM-1534 and KSM-1514 entries, and fixes the stale docs Mateo's review flagged: - README.md: Node.js 20 -> 22 (this PR's own fix) - CHANGELOG.md: rescope the "Both entries below" intro to the two entries it actually describes (KSM-1450/1458), not the newly-adjacent KSM-1534 entry - CHANGELOG.md: KSM-1534 entry no longer implies a released version ever declared >=20 (none did; 1.0.0 had no engines field at all) - CHANGELOG.md: KSM-1500 entry drops the now-false "CI already tests on Node 20" claim, since CI tests on 22 as of this same ticket
Summary
JavaScript GCP KMS Storage: the shipped documentation didn't describe v1.1.0's behavior changes, presented the plaintext-autosave option with no warning, and disagreed with the source on required IAM roles.
Changes
Documentation
CHANGELOG.mdwas excluded from the published npm tarball (missing frompackage.json'sfilesarray), so the only documentation of the v1.1.0 behavior changes never reached an npm consumer. Added it. (KSM-1536)decryptConfig(true)writes the client ID, app key, and device private key to disk in plaintext, noted the real 0600 mitigation without overstating it, and documented the re-encrypt path (init()detects and re-encrypts a plaintext config automatically).KSM_CONFIG_FILEenvironment variable and its precedence against the constructor argument (verified against the actual fallback chain inGCPKeyValueStore.ts's constructor).GcpKeyConfig.ts's doc comment. Verified against two independent sources: (1) every GCP KMS API call this package actually makes (getCryptoKey,getPublicKey,encrypt,decrypt,asymmetricDecrypt— no key/keyring-management call anywhere), and (2) Google's own predefined-role permission tables. Removedroles/cloudkms.adminfromGcpKeyConfig.ts— this package never calls anything that needs it. Addedroles/cloudkms.viewerto both files — none of the other three listed roles includecloudkms.cryptoKeys.get, whichgetKeyDetails()calls viagetCryptoKey(), andcloudkms.vieweris the minimal predefined role that has it.Testing
Doc-only changes plus one comment-only edit in
GcpKeyConfig.ts; both clean.Breaking Changes
None.
Related Issues