Skip to content

[Backend] Startup validation only checks presence of secrets, not their format or length #14

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

src/config/env.ts validateEnvVars only checks that required vars are non-empty, so JWT_SECRET, INTERNAL_API_KEY and LOAN_MANAGER_ADMIN_SECRET pass with a single weak character; the admin secret is not even checked to be a valid Stellar secret until first use.

Acceptance criteria

  • Enforce a minimum length/entropy for JWT_SECRET and INTERNAL_API_KEY at startup
  • Validate LOAN_MANAGER_ADMIN_SECRET parses as a Stellar secret key at startup
  • Fail fast with a clear message naming the offending var
  • Add tests for the new validation rules

Files to touch

  • src/config/env.ts
  • src/middleware/auth.ts
  • src/services/sorobanService.ts

Out of scope

  • Secret rotation tooling
  • Vault integration

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions