Skip to content

Trust twilio.world hosts for URL-based plugin installs - #703

Open
andrewdmaclean-work wants to merge 1 commit into
twilio:mainfrom
andrewdmaclean-work:trust-twilio-world-plugin-installs
Open

Trust twilio.world hosts for URL-based plugin installs#703
andrewdmaclean-work wants to merge 1 commit into
twilio:mainfrom
andrewdmaclean-work:trust-twilio-world-plugin-installs

Conversation

@andrewdmaclean-work

Copy link
Copy Markdown

What

Adds a host allowlist so plugins installed from a twilio.world URL don't trigger the "untrusted source" warning + confirmation prompt.

Why

isTwilioPlugin only checked the npm package name against ALLOWED_ORGS. Plugins installed from a git/tarball URL carry no package name (oclif's parsePlugin() returns { url, type: 'repo' } with no name), so isTwilioPlugin(undefined) always returned false — meaning every URL-based install unconditionally hit:

WARNING!!! You are attempting to install a plugin from an untrusted source.

TwilioWorld is a Twilio developer training platform that distributes its CLI plugin as a phone-verified, per-user tarball served from a Twilio-owned twilio.world host (twilio plugins:install "https://…twilio.world/cli/plugin/{session}-{code}"). Learners shouldn't be told the official Twilio plugin is malicious.

How

  • New ALLOWED_HOSTS (['twilio.world']) checked against the install URL's hostname. A host matches if it equals an entry or is a subdomain of one (.endsWith('.twilio.world')), so cli.twilio.world is trusted but twilio.world.evil.com and nottwilio.world are not.
  • isTwilioPlugin(name, url) gains a URL branch (wrapped in try/catch for malformed URLs); when a URL is present it takes precedence over the name check.
  • plugin-install hook now passes options.plugin.url through.

Twilio owns twilio.world and all of its subdomains, so this is "trust our own domain" — the URL-based counterpart to the existing @twilio/ / @twilio-labs/ npm-org allowlist.

Testing

  • New test/services/plugins.test.js — exact host, subdomain, disallowed host, substring-spoof rejection, malformed URL, and url-beats-name precedence.
  • Extended test/hooks/plugin-install.test.js — trusted URL suppresses the warning; untrusted URL still warns.
  • Full suite: 218 passing, lint clean, 100% coverage on plugins.js.

Note for reviewers

This ships to all twilio-cli users via the release pipeline. Existing installs benefit after twilio update; fresh installs pick it up automatically. This is intended as a standing entry, mirroring how the npm-org allowlist trusts Twilio-owned scopes.

🤖 Generated with Claude Code

Plugins installed from a git/tarball URL (rather than an npm package name)
always triggered the "untrusted source" warning and confirmation prompt,
because isTwilioPlugin only checked the npm package name against
ALLOWED_ORGS and URL installs carry no name.

Add a host allowlist (ALLOWED_HOSTS) checked against the install URL's
hostname, matching an entry exactly or as a subdomain. twilio.world is a
Twilio-owned developer training platform that serves a phone-verified,
per-user plugin tarball, so installs from it should not warn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants