fix(sync): skip post-processing when resolving secrets for sync#371
fix(sync): skip post-processing when resolving secrets for sync#371
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Greptile SummaryThis PR fixes a bug where The fix introduces
Confidence Score: 5/5PR is safe to merge — fixes a real double-extraction bug with correct logic and comprehensive tests The change is minimal, well-contained, and directly addresses the described bug. The new for_raw_resolve() abstraction is clean and all three unit tests plus new integration tests validate correct behaviour. No P0/P1 issues found. No files require special attention Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant SyncCmd as sync command
participant ForRaw as for_raw_resolve()
participant Resolver as resolve_secrets_batch
participant Provider as Source Provider
participant Age as Age Provider (target)
User->>SyncCmd: fnox sync -p age
SyncCmd->>ForRaw: sc.for_raw_resolve()
Note over ForRaw: strips json_path, sync, default
ForRaw-->>SyncCmd: raw SecretConfig
SyncCmd->>Resolver: resolve_secrets_batch(raw configs)
Resolver->>Provider: fetch raw value (e.g. full JSON blob)
Provider-->>Resolver: '{"username":"admin",...}'
Resolver-->>SyncCmd: raw plaintext map
SyncCmd->>Age: encrypt(raw plaintext)
Age-->>SyncCmd: encrypted blob
SyncCmd->>SyncCmd: store sync = { provider, encrypted_blob }
Note over SyncCmd: json_path preserved in config,\napplied at read time only
Greploops — Automatically fix all review issues by running Reviews (3): Last reviewed commit: "Merge branch 'main' into rpendleton/fix-..." | Re-trigger Greptile |
When syncing secrets that use json_path, resolve_secrets_batch was applying json_path extraction before storing the result, caching the extracted value instead of the full raw secret. When reading the secret after that sync, json_path would be applied again to the already-extracted value, failing with "Failed to parse JSON secret". Add SecretConfig::for_raw_resolve() which strips post-processing fields (json_path, sync, default) so callers that need raw provider values have a single, consistent method to use. Both sync and reencrypt now use it, ensuring new post-processing steps only need updating in one place. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f51591c to
b04f098
Compare
|
The LocalStack CI failure is likely unrelated and due to changes described in this announcement. LocalStack is consolidating its community and pro editions into a single unified image, and moving forward, newer versions of the |
### 🚀 Features - **(provider)** add Doppler secrets manager provider by [@natefaerber](https://github.com/natefaerber) in [#376](#376) ### 🐛 Bug Fixes - **(ci)** pin LocalStack to v4 (last free community version) by [@jdx](https://github.com/jdx) in [#379](#379) - **(sync)** skip post-processing when resolving secrets for sync by [@rpendleton](https://github.com/rpendleton) in [#371](#371) ### 🚜 Refactor - **(providers)** extract shared error helpers to FnoxError methods by [@jdx](https://github.com/jdx) in [#380](#380) ### 📦️ Dependency Updates - lock file maintenance by [@renovate[bot]](https://github.com/renovate[bot]) in [#369](#369) - update taiki-e/upload-rust-binary-action digest to 0e34102 by [@renovate[bot]](https://github.com/renovate[bot]) in [#372](#372) - update dependency vue to v3.5.32 by [@renovate[bot]](https://github.com/renovate[bot]) in [#373](#373) ### New Contributors - @natefaerber made their first contribution in [#376](#376) - @rpendleton made their first contribution in [#371](#371)
Summary
When syncing secrets that use
json_path,resolve_secrets_batchwas applyingjson_pathextraction before storing the result, caching the extracted value instead of the full raw secret. When reading the secret after that sync,json_pathwould be applied again to the already-extracted value, failing with "Failed to parse JSON secret".Fix
Add
SecretConfig::for_raw_resolve()which strips post-processing fields (json_path,sync,default) so callers that need raw provider values have a single, consistent method to use. Bothsyncandreencryptnow use it, ensuring new post-processing steps only need updating in one place.Test plan
cargo test— unit tests forfor_raw_resolve()mise run test:bats -- test/sync.bats— added tests for syncing secrets withjson_pathmise run test:bats -- test/reencrypt.bats— added tests for reencrypt (with and withoutjson_path)🤖 Generated with Claude Code