Skip to content

fix(twitterapiio): fail closed when webhook secret is missing #582

Description

@ambikeesshh

TwitterApiIO webhooks accept requests when no signing secret is set.

keyBuilder does return res ?? '', and the verifier treats an empty secret plus a missing signature as valid:

if (!signature) {
  if (!secret) return { valid: true };
}

Handlers still persist tweets after that. Same class of bug as GitLab's empty-secret fail-open.

Fix

  • empty/missing secret should return { valid: false, error: '...' }
  • keyBuilder should throw (or otherwise fail) when webhook signature is missing, not return ''

Check

  • missing secret is rejected
  • missing signature with a configured secret is rejected
  • no DB write on failed verification
  • small unit test for the reject path
pnpm --filter @corsair-dev/twitterapiio test

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdifficulty: easySmall scoped fixgood first issueGood for newcomerspluginChanges inside a plugin package

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions