Skip to content

Add property-based tests for HMAC signature verification edge cases #277

@mikewheeleer

Description

@mikewheeleer

Description

Webhook signature verification in src/webhookDelivery.ts needs adversarial coverage. Add property-based tests that fuzz signatures, headers, and bodies to ensure no malformed input bypasses verification or throws unhandled errors.

Requirements and context

  • Use generated inputs (random bytes, truncated signatures, wrong-length HMACs, mismatched encodings) to assert rejection.
  • Confirm constant-time comparison behavior and that errors route through safeErrors.ts.
  • Acceptance: fuzz suite runs deterministically with a fixed seed; zero accepted forgeries; branch coverage on verify path >= 95%.

Suggested execution

  • Fork the repo and create a branch:
    • git checkout -b test/hmac-property-tests
  • Implement changes:
    • src/webhookDelivery.ts
    • Tests: src/webhookDelivery.test.ts
    • Docs: docs/webhook-signature-verification.md
    • 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

test(webhooks): add property-based HMAC verification tests

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