fix(settings): persist only the billing delta so resolved secrets never hit disk#60
Merged
Aayam Bansal (aayambansal) merged 1 commit intoJul 5, 2026
Conversation
…er hit disk
The Spend toggle PUT round-tripped Config.getGlobal() into
Config.updateGlobal(). getGlobal() returns the resolved config, with
{env:VAR} and {file:...} references substituted, so flipping a toggle
rewrote openscience.json with plaintext secrets and destroyed the env
indirection. updateGlobal already deep-merges into the raw file, so the
route only needs to pass the billing delta.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Fixes #51.
The Spend toggle PUT handler round-tripped the entire resolved global config:
getGlobal()resolves{env:VAR}and{file:...}references, so flipping a toggle in Settings wrote the literal secrets into~/.config/openscience/openscience.jsonand destroyed the env indirection.updateGlobalalready deep-merges into the raw on-disk file, so the route now passes only the delta:Added a regression test that drives the real route against an isolated config containing
"apiKey": "{env:...}"and asserts the reference survives, the resolved value never hits disk, and onlybillingis written. It fails on main (the failure output shows the plaintext key in the file) and passes here.Full backend suite: 829 pass / 0 fail. Typecheck clean.