fix: add build-time validation for env config (fix #26) - #62
Open
elevasyncsolutions-jpg wants to merge 1 commit into
Open
fix: add build-time validation for env config (fix #26)#62elevasyncsolutions-jpg wants to merge 1 commit into
elevasyncsolutions-jpg wants to merge 1 commit into
Conversation
- Validate NEXT_PUBLIC_STELLAR_NETWORK against allowed values (PUBLIC, TESTNET) - Throw in production if STELLAR_NETWORK is missing (prevents accidental testnet signing) - Validate NEXT_PUBLIC_API_URL is a valid URL - Throw in production if API_URL is missing (prevents localhost fallback) - Clear error messages explain the financial risk of misconfiguration Closes MergeFi#26
|
Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
@chonilius Ready for review. This PR Build-time config validation (fix #26). All CI green. Mergeable. Pays USDC on Stellar (Soroban) on merge. |
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.
Summary
Adds build-time validation for
NEXT_PUBLIC_STELLAR_NETWORKandNEXT_PUBLIC_API_URLenvironment variables to prevent dangerous misconfigurations that could lead to signing transactions with the wrong network passphrase or silent API failures.Problem
Without validation, a production build accidentally shipped with:
NEXT_PUBLIC_STELLAR_NETWORKunset → silently falls back toTESTNET→ signs transactions with testnet passphrase in production (real funds at risk)NEXT_PUBLIC_STELLAR_NETWORKmisspelled (e.g.,"MAINNET") → same silent fallbackNEXT_PUBLIC_API_URLunset → falls back tohttp://localhost:4000/api→ all API calls fail silentlyChanges
NEXT_PUBLIC_STELLAR_NETWORK: Validates againstPUBLICandTESTNET. Throws in production if missing or invalid with clear explanation of the financial risk.NEXT_PUBLIC_API_URL: Validates URL format. Throws in production if missing or invalid.Error messages
Testing
Closes #26