Skip to content

Verify Soroban escrow contract metadata against expected hash in contractMetadata #271

@mikewheeleer

Description

@mikewheeleer

Description

contractMetadata (with src/contractMetadata.integration.test.ts) loads on-chain contract details, but the backend should pin and verify expected contract metadata so a swapped or unexpected escrow contract is rejected before any webhook-driven settlement action.

Requirements and context

  • Pin expected contract hash/version per network; verify fetched metadata matches before use.
  • On mismatch, refuse to operate and emit a safe error via src/errors/safeErrors.ts; alert via metrics.
  • Source expected values from validated sorobanEnv.ts; document rotation procedure.
  • Acceptance: integration test covers matching metadata (proceed) and mismatched metadata (reject).

Suggested execution

  • Fork the repo and create a branch:
    • git checkout -b security/contract-metadata-pinning
  • Implement changes:
    • src/contractMetadata.ts
    • Tests: src/contractMetadata.integration.test.ts
    • Docs: docs/backend
    • Include TSDoc/NatSpec-style doc comments
    • Validate security assumptions (input validation, auth, signature verification, secret redaction, idempotency)

Test and commit

  • Run tests: npm test (coverage: npm run test:ci)
  • Cover edge cases
  • Include test output and security notes in the PR

Example commit message

feat(stellar): pin and verify escrow contract metadata

Guidelines

  • Minimum 95% line coverage on new/changed code
  • No secrets in repo; use .env + deployment secrets only
  • Clear documentation
  • Timeframe: 96 hours from assignment

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions