Skip to content

feat(plugins): add dynamic plugin commands - #1731

Open
developerkunal wants to merge 1 commit into
DXCDT-2604/plugin-commandsfrom
DXCDT-2605/dynamic-plugin-commands
Open

developerkunal wants to merge 1 commit into
DXCDT-2604/plugin-commandsfrom
DXCDT-2605/dynamic-plugin-commands

Conversation

@developerkunal

@developerkunal developerkunal commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🔧 Changes

Installed plugins now show up as commands: auth0 <plugin> for the plugin's root command and auth0 <plugin> <command> for each of its other commands. This adds the checks before a plugin starts, the environment and timeout it runs with, and the error shape for a failed run. The feature is still behind the build gate, so a stable build registers no plugin command.

Registration. At startup the CLI reads each plugin's plugin.json, checked against the lockfile hash, without hashing the executable or using the network. A core command always wins over a plugin of the same name, with a stderr warning when it runs.

Arguments. The CLI takes out only the flags it owns and passes everything else, and everything after a bare --, to the plugin untouched. A call such as auth0 plugin-name --flag scan, where scan could be a subcommand, is refused as ambiguous, so the root command cannot run with the permissions meant for scan.

Checks before every run, in this order, all failing closed

  1. Plugins are not turned off with AUTH0_CLI_PLUGINS_DISABLED.
  2. The installed files match the lockfile.
  3. The registry index is usable and the version is not revoked.
  4. The call is allowed: an interactive command needs a terminal, and the output flags and agent mode need a matching manifest declaration.
  5. The tenant has approved the plugin's permissions, by a recorded approval or a pin.
  6. Only then is a session opened, so an unapproved or revoked plugin never triggers a login. The session tenant must equal the approved tenant.
  7. The files are verified again after the session opens. The gap between the check and the start is not closed completely.

How the plugin runs

  • The proxy gets only the scopes of the invoked command.
  • The plugin gets a small environment: a short allowlist from the user's environment, the proxy variables, the CLI owned flags as AUTH0_PLUGIN_<NAME>, and the variables the command declared in permissions.env. Nothing starting with AUTH0_ is passed through, and the manifest validator now rejects any AUTH0_ variable name.
  • On timeout or Ctrl-C the plugin is asked to stop and then killed after a short grace period. Denied proxy calls are summarized as a warning on stderr.

Failed runs. A new additive error class plugin covers a non-zero exit, a timeout, an interrupt and a failed start. The plugin's own exit code is in details.exitCode of the JSON error envelope. Other refusals use the existing validation and auth classes.

Existing code. The CLI now keeps the access token and tenant domain in memory for the proxy, and never prints them. resolveAgentMode stops reading arguments at --.

📚 References

DXCDT-2605. Part of the plugin framework stack of 11 PRs, and it builds on the PR below it (DXCDT-2604).

🔬 Testing

The new code is covered by unit tests.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@developerkunal
developerkunal requested a review from a team as a code owner October 24, 2026 14:47
@developerkunal
developerkunal force-pushed the DXCDT-2605/dynamic-plugin-commands branch from 8ee6021 to 494a96f Compare October 24, 2026 15:30
@developerkunal
developerkunal force-pushed the DXCDT-2605/dynamic-plugin-commands branch 2 times, most recently from 88526bc to ac95530 Compare November 2, 2026 14:31
- Register installed plugins as `auth0 <plugin> [command]` in builds where the plugin feature is on, reading only the lockfile and manifest at startup
- Pre-scan the CLI-owned global flags and pass everything else, and everything after `--`, to the plugin untouched
- Check the plugin on every run before any login: enabled, verified files, registry index and revocation, call rules, tenant approval, then verify again after the session opens
- Start the loopback proxy with only the invoked command's scopes and run the plugin with a small environment and a timeout, stopping the whole process tree on timeout or interrupt
- Add the token source for the proxy, the plugin error class, and a warning when a core command shadows an installed plugin
- Reject AUTH0_ environment variables in plugin manifests and refuse a root command call that names a subcommand
@developerkunal
developerkunal force-pushed the DXCDT-2605/dynamic-plugin-commands branch from ac95530 to d8326f4 Compare November 2, 2026 19:36

This branch has not been deployed

No deployments
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.

1 participant