fix: include type field in encrypted set-default values #82
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.
Summary
Fixes a bug where
set-default --secretwas not sending thetypefield and was using the wrong field name for encrypted values, causing the value to not be properly sent to the server.Problem
When setting encrypted values using
reforge set-default --secret, the API payload was malformed:typefieldstringas the field name instead ofvalueThis caused encrypted values to fail when sent to the
/internal/ops/v1/set-defaultendpoint.Solution
stringtovaluetype: 'string'field to encrypted valuesPayload Comparison
Before (Incorrect) ❌
{ "configKey": "test.secret", "currentVersionId": 1, "environmentId": 5, "value": { "string": "encrypted-data--iv--tag", "confidential": true, "decryptWith": "reforge.secrets.encryption.key" } }After (Correct) ✅
{ "configKey": "test.secret", "currentVersionId": 1, "environmentId": 5, "value": { "type": "string", "value": "encrypted-data--iv--tag", "confidential": true, "decryptWith": "reforge.secrets.encryption.key" } }Files Changed
src/util/encryption.ts- Fixed encrypted value field namesrc/commands/set-default.ts- Added type field to encrypted valuestest/responses/set-default.ts- Added validation for encrypted value structurepackage.json- Version bump to 0.0.12Test Plan
The existing test at
test/commands/set-default.test.ts:100-105validates encrypted value creation. With the added mock handler validation, this test would fail before the fix and passes after.🤖 Generated with Claude Code