Skip to content

fix: guard validateTwilioCredentials against null/non-object input#111

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
kylezengo:fix/twilio-null-input-guard
Jun 27, 2026
Merged

fix: guard validateTwilioCredentials against null/non-object input#111
ralyodio merged 1 commit into
profullstack:masterfrom
kylezengo:fix/twilio-null-input-guard

Conversation

@kylezengo

Copy link
Copy Markdown
Contributor

Summary

  • validateTwilioCredentials(null) previously threw TypeError: Cannot read properties of null (reading 'accountSid') because the function accessed object properties before checking the input type
  • Added early return guard at the top of the function for null, undefined, and non-object inputs
  • Added test cases covering null, undefined, and string inputs

Changes

  • src/lib/utils/twilio-validator.js: added null/type guard at top of validateTwilioCredentials
  • tests/twilio-validator.test.js: added 3 new test cases for invalid input types

Fixes #107

Calling validateTwilioCredentials(null) previously threw a TypeError
because the function attempted to read properties before checking the
input type. Added an early return for null/non-object inputs.
Adds test cases for null, undefined, and string inputs.

Fixes profullstack#107
@ralyodio ralyodio merged commit df27a01 into profullstack:master Jun 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Twilio credential validator throws on null input

2 participants