Skip to content

Add signature verification edge-case tests for internal/auth/verify.go #166

Description

@Jagadeeshftw

📌 Description

internal/auth/verify.go (175 lines) verifies the signed SIWE message against the claimed wallet address. There's no dedicated test file, so edge cases like a valid signature over a different message, or a signature from a different key, aren't demonstrably rejected.

🧩 Requirements and context

  • Add a test where the signature is valid but over a different message payload (must be rejected).
  • Add a test where the address case (checksum vs lowercase) differs from the signing key's derived address.
  • Add a test for a truncated/malformed signature byte string.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b test/auth-verify-signature-edge-cases

2. Implement changes

  • Add test: new internal/auth/verify_test.go.

3. Test and commit

  • Run tests:
go test ./internal/auth/... -run Verify -v
  • Cover edge cases: signature-message mismatch, address-case mismatch, malformed signature bytes, empty signature.
  • Include test output and details in the PR description.

Example commit message

test: add signature verification edge-case tests to internal/auth/verify.go

✅ Acceptance criteria

  • All listed edge cases have an explicit passing test asserting rejection.
  • No regression to currently-valid signature verification.
  • Coverage report shows verify.go branches previously untested are now covered.

🔒 Security notes

This is the core wallet-auth trust boundary. Validate that address comparison is case-insensitive-correct (checksummed) and that signature verification can't be tricked by a valid-but-unrelated signature.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuebackendBackend / API worksecuritySecurity hardening / audittestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions