fix(signer): verify required env vars exist during config validation#374
Conversation
Greptile SummaryThis PR closes a real operator footgun: signer validation previously only checked that env-var names were non-empty strings, never that the referenced variables were actually present on the host. The fix threads Key changes
Issues found
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[load_config / validate_signer_config] --> B{For each SignerConfig}
B --> C[validate_individual_signer_config]
C --> D{Signer type?}
D -->|Memory| E[validate_memory_config]
D -->|Turnkey| F[validate_turnkey_config]
D -->|Privy| G[validate_privy_config]
D -->|Vault| H[validate_vault_config]
D -->|AwsKms| I[validate_aws_kms_config]
D -->|Fireblocks| J[validate_fireblocks_config]
E --> E1{private_key_env empty?}
E1 -->|Yes| ERR[ValidationError]
E1 -->|No| E2[get_env_var_for_signer ✅ NEW]
E2 -->|Var missing| ERR
I --> I1{key_id_env / public_key_env empty?}
I1 -->|Yes| ERR
I1 -->|No| I2[get_env_var_for_signer ✅ NEW]
I2 -->|OK| I3{region_env Some?}
I3 -->|Yes| I4[⚠️ NOT validated — runtime crash if missing]
I3 -->|No| OK[✅ Validation passes]
I2 -->|Var missing| ERR
F --> F1[Check all 5 env vars empty?]
F1 -->|Any empty| ERR
F1 -->|None empty| F2[get_env_var_for_signer ✅ NEW x5]
F2 -->|Any missing| ERR
F2 --> OK
ERR --> FAIL[Config load fails early ✅]
OK --> PASS[Node starts safely ✅]
|
|
Fixed both race conditions — renamed TEST_PRIVATE_KEY to unique names |
|
✅ Fork external live tests passed. fork-external-live-pass:401704180dbe361365ecf257768b9b2e9028c8e5 |
67d25b3
into
solana-foundation:release/2.2.0
Signer validation only checked if env var names were non-empty strings —
it never verified the variables actually exist on the host. Operators
could pass config validate only to have the node crash at runtime.